aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLEstateData.cs
diff options
context:
space:
mode:
authorBlueWall2012-01-21 23:26:27 -0500
committerBlueWall2012-01-21 23:26:27 -0500
commit32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85 (patch)
tree8c19dbfa8975080d7bbbeaa1e2de4072520c899f /OpenSim/Data/MySQL/MySQLEstateData.cs
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85.zip
opensim-SC-32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85.tar.gz
opensim-SC-32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85.tar.bz2
opensim-SC-32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85.tar.xz
Telehub Support:
Telehub settings now persist to the database and are saved across sim restarts. So-far this only works on MySQL. this is a work in progress, teleport routing is not yet implemented.
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLEstateData.cs66
1 files changed, 65 insertions, 1 deletions
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs
index 3d647ca..a357268 100644
--- a/OpenSim/Data/MySQL/MySQLEstateData.cs
+++ b/OpenSim/Data/MySQL/MySQLEstateData.cs
@@ -157,6 +157,7 @@ namespace OpenSim.Data.MySQL
157 DoCreate(es); 157 DoCreate(es);
158 158
159 LoadBanList(es); 159 LoadBanList(es);
160 LoadSpawnPoints(es);
160 161
161 es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); 162 es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers");
162 es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); 163 es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users");
@@ -210,7 +211,7 @@ namespace OpenSim.Data.MySQL
210 } 211 }
211 212
212 LoadBanList(es); 213 LoadBanList(es);
213 214 LoadSpawnPoints(es);
214 es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); 215 es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers");
215 es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); 216 es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users");
216 es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups"); 217 es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups");
@@ -297,11 +298,74 @@ namespace OpenSim.Data.MySQL
297 } 298 }
298 299
299 SaveBanList(es); 300 SaveBanList(es);
301 SaveSpawnPoints(es);
300 SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers); 302 SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers);
301 SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess); 303 SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess);
302 SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups); 304 SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups);
303 } 305 }
304 306
307 private void LoadSpawnPoints(EstateSettings es)
308 {
309 es.ClearSpawnPoints();
310
311 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
312 {
313 dbcon.Open();
314
315 using (MySqlCommand cmd = dbcon.CreateCommand())
316 {
317 uint EstateID = es.EstateID;
318 cmd.CommandText = "select PointX, PointY, PointZ from spawn_points where EstateID = ?EstateID";
319 cmd.Parameters.AddWithValue("?EstateID", es.EstateID);
320
321 using (IDataReader r = cmd.ExecuteReader())
322 {
323 while (r.Read())
324 {
325 Vector3 point = new Vector3();
326
327 point.X = (float)r["PointX"];
328 point.Y = (float)r["PointY"];
329 point.Z = (float)r["PointZ"];
330
331 es.AddSpawnPoint(point);
332 }
333 }
334 }
335 }
336 }
337
338 private void SaveSpawnPoints(EstateSettings es)
339 {
340 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
341 {
342 dbcon.Open();
343
344 using (MySqlCommand cmd = dbcon.CreateCommand())
345 {
346 cmd.CommandText = "delete from spawn_points where EstateID = ?EstateID";
347 cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString());
348
349 cmd.ExecuteNonQuery();
350
351 cmd.Parameters.Clear();
352
353 cmd.CommandText = "insert into spawn_points (EstateID, PointX, PointY, PointZ) values ( ?EstateID, ?PointX, ?PointY,?PointZ)";
354
355 foreach (Vector3 p in es.SpawnPoints())
356 {
357 cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString());
358 cmd.Parameters.AddWithValue("?PointX", p.X);
359 cmd.Parameters.AddWithValue("?PointY", p.Y);
360 cmd.Parameters.AddWithValue("?PointZ", p.Z);
361
362 cmd.ExecuteNonQuery();
363 cmd.Parameters.Clear();
364 }
365 }
366 }
367 }
368
305 private void LoadBanList(EstateSettings es) 369 private void LoadBanList(EstateSettings es)
306 { 370 {
307 es.ClearBans(); 371 es.ClearBans();