From 68365c20c0b3a3164881398f3bc3710f7960c52d Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 22 Jan 2012 11:36:04 +0000 Subject: Move Telehub tables and data from EstateSettings to RegionSettings. This is damage control es EstateSettings is not the place this can be put. EstateSettings is nt unique to a region and therefore would introduce a hard limit of one telehub per estate, completely shutting off the option of having SL style telehubs, e.g. one per region. Whole estate teleport routing can still be implemented id desiresd, this way all options are open while the other way most options get closed off. --- OpenSim/Data/MySQL/MySQLSimulationData.cs | 70 +++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'OpenSim/Data/MySQL/MySQLSimulationData.cs') diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 6d14b82..3883e24 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -846,6 +846,8 @@ namespace OpenSim.Data.MySQL } } + LoadSpawnPoints(rs); + return rs; } @@ -1017,6 +1019,7 @@ namespace OpenSim.Data.MySQL } } } + SaveSpawnPoints(rs); } public List LoadLandObjects(UUID regionUUID) @@ -1828,5 +1831,72 @@ namespace OpenSim.Data.MySQL } } } + + private void LoadSpawnPoints(RegionSettings rs) + { + rs.ClearSpawnPoints(); + + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "select PointX, PointY, PointZ from spawn_points where RegionID = ?RegionID"; + cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString()); + + using (IDataReader r = cmd.ExecuteReader()) + { + while (r.Read()) + { + Vector3 point = new Vector3(); + + point.X = (float)r["PointX"]; + point.Y = (float)r["PointY"]; + point.Z = (float)r["PointZ"]; + + rs.AddSpawnPoint(point); + } + } + } + } + } + } + + private void SaveSpawnPoints(RegionSettings rs) + { + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "delete from spawn_points where RegionID = ?RegionID"; + cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString()); + + cmd.ExecuteNonQuery(); + + cmd.Parameters.Clear(); + + cmd.CommandText = "insert into spawn_points (RegionID, PointX, PointY, PointZ) values ( ?EstateID, ?PointX, ?PointY,?PointZ)"; + + foreach (Vector3 p in rs.SpawnPoints()) + { + cmd.Parameters.AddWithValue("?EstateID", rs.RegionUUID.ToString()); + cmd.Parameters.AddWithValue("?PointX", p.X); + cmd.Parameters.AddWithValue("?PointY", p.Y); + cmd.Parameters.AddWithValue("?PointZ", p.Z); + + cmd.ExecuteNonQuery(); + cmd.Parameters.Clear(); + } + } + } + } + } } } -- cgit v1.1