aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL
diff options
context:
space:
mode:
authorMelanie2012-01-22 11:36:04 +0000
committerMelanie2012-01-22 11:36:04 +0000
commit68365c20c0b3a3164881398f3bc3710f7960c52d (patch)
treebef00ac36c0dc8f33c1df3066c9d0e09dbb71aa9 /OpenSim/Data/MySQL
parentTelehub Support: (diff)
downloadopensim-SC-68365c20c0b3a3164881398f3bc3710f7960c52d.zip
opensim-SC-68365c20c0b3a3164881398f3bc3710f7960c52d.tar.gz
opensim-SC-68365c20c0b3a3164881398f3bc3710f7960c52d.tar.bz2
opensim-SC-68365c20c0b3a3164881398f3bc3710f7960c52d.tar.xz
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.
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLEstateData.cs65
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs70
-rw-r--r--OpenSim/Data/MySQL/Resources/EstateStore.migrations21
-rw-r--r--OpenSim/Data/MySQL/Resources/RegionStore.migrations26
4 files changed, 95 insertions, 87 deletions
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs
index a357268..3dd46cb 100644
--- a/OpenSim/Data/MySQL/MySQLEstateData.cs
+++ b/OpenSim/Data/MySQL/MySQLEstateData.cs
@@ -157,7 +157,6 @@ namespace OpenSim.Data.MySQL
157 DoCreate(es); 157 DoCreate(es);
158 158
159 LoadBanList(es); 159 LoadBanList(es);
160 LoadSpawnPoints(es);
161 160
162 es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); 161 es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers");
163 es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); 162 es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users");
@@ -211,7 +210,6 @@ namespace OpenSim.Data.MySQL
211 } 210 }
212 211
213 LoadBanList(es); 212 LoadBanList(es);
214 LoadSpawnPoints(es);
215 es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); 213 es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers");
216 es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); 214 es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users");
217 es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups"); 215 es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups");
@@ -298,74 +296,11 @@ namespace OpenSim.Data.MySQL
298 } 296 }
299 297
300 SaveBanList(es); 298 SaveBanList(es);
301 SaveSpawnPoints(es);
302 SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers); 299 SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers);
303 SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess); 300 SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess);
304 SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups); 301 SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups);
305 } 302 }
306 303
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
369 private void LoadBanList(EstateSettings es) 304 private void LoadBanList(EstateSettings es)
370 { 305 {
371 es.ClearBans(); 306 es.ClearBans();
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
846 } 846 }
847 } 847 }
848 848
849 LoadSpawnPoints(rs);
850
849 return rs; 851 return rs;
850 } 852 }
851 853
@@ -1017,6 +1019,7 @@ namespace OpenSim.Data.MySQL
1017 } 1019 }
1018 } 1020 }
1019 } 1021 }
1022 SaveSpawnPoints(rs);
1020 } 1023 }
1021 1024
1022 public List<LandData> LoadLandObjects(UUID regionUUID) 1025 public List<LandData> LoadLandObjects(UUID regionUUID)
@@ -1828,5 +1831,72 @@ namespace OpenSim.Data.MySQL
1828 } 1831 }
1829 } 1832 }
1830 } 1833 }
1834
1835 private void LoadSpawnPoints(RegionSettings rs)
1836 {
1837 rs.ClearSpawnPoints();
1838
1839 lock (m_dbLock)
1840 {
1841 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1842 {
1843 dbcon.Open();
1844
1845 using (MySqlCommand cmd = dbcon.CreateCommand())
1846 {
1847 cmd.CommandText = "select PointX, PointY, PointZ from spawn_points where RegionID = ?RegionID";
1848 cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString());
1849
1850 using (IDataReader r = cmd.ExecuteReader())
1851 {
1852 while (r.Read())
1853 {
1854 Vector3 point = new Vector3();
1855
1856 point.X = (float)r["PointX"];
1857 point.Y = (float)r["PointY"];
1858 point.Z = (float)r["PointZ"];
1859
1860 rs.AddSpawnPoint(point);
1861 }
1862 }
1863 }
1864 }
1865 }
1866 }
1867
1868 private void SaveSpawnPoints(RegionSettings rs)
1869 {
1870 lock (m_dbLock)
1871 {
1872 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1873 {
1874 dbcon.Open();
1875
1876 using (MySqlCommand cmd = dbcon.CreateCommand())
1877 {
1878 cmd.CommandText = "delete from spawn_points where RegionID = ?RegionID";
1879 cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString());
1880
1881 cmd.ExecuteNonQuery();
1882
1883 cmd.Parameters.Clear();
1884
1885 cmd.CommandText = "insert into spawn_points (RegionID, PointX, PointY, PointZ) values ( ?EstateID, ?PointX, ?PointY,?PointZ)";
1886
1887 foreach (Vector3 p in rs.SpawnPoints())
1888 {
1889 cmd.Parameters.AddWithValue("?EstateID", rs.RegionUUID.ToString());
1890 cmd.Parameters.AddWithValue("?PointX", p.X);
1891 cmd.Parameters.AddWithValue("?PointY", p.Y);
1892 cmd.Parameters.AddWithValue("?PointZ", p.Z);
1893
1894 cmd.ExecuteNonQuery();
1895 cmd.Parameters.Clear();
1896 }
1897 }
1898 }
1899 }
1900 }
1831 } 1901 }
1832} 1902}
diff --git a/OpenSim/Data/MySQL/Resources/EstateStore.migrations b/OpenSim/Data/MySQL/Resources/EstateStore.migrations
index 591295b..df82a2e 100644
--- a/OpenSim/Data/MySQL/Resources/EstateStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/EstateStore.migrations
@@ -78,25 +78,4 @@ ALTER TABLE estate_settings AUTO_INCREMENT = 100;
78COMMIT; 78COMMIT;
79 79
80 80
81:VERSION 33 #--------------------- ( Supporting Telehubs
82 81
83BEGIN;
84CREATE TABLE IF NOT EXISTS `spawn_points` (
85 `EstateID` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
86 `PointX` float NOT NULL,
87 `PointY` float NOT NULL,
88 `PointZ` float NOT NULL,
89 KEY `EstateID` (`EstateID`)
90) ENGINE=Innodb;
91
92ALTER TABLE `estate_settings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL;
93ALTER TABLE `estate_settings` ADD COLUMN `TelehubName` varchar(255) NOT NULL;
94ALTER TABLE `estate_settings` ADD COLUMN `TelehubEnabled` tinyint(4) NOT NULL;
95ALTER TABLE `estate_settings` ADD COLUMN `TelehubPosX` float NOT NULL;
96ALTER TABLE `estate_settings` ADD COLUMN `TelehubPosY` float NOT NULL;
97ALTER TABLE `estate_settings` ADD COLUMN `TelehubPosZ` float NOT NULL;
98ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotX` float NOT NULL;
99ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotY` float NOT NULL;
100ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotZ` float NOT NULL;
101ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotW` float NOT NULL;
102COMMIT; \ No newline at end of file
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
index 987625b..ce66cfb 100644
--- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
@@ -841,4 +841,28 @@ alter table regionban ENGINE = MyISAM;
841alter table regionsettings ENGINE = MyISAM; 841alter table regionsettings ENGINE = MyISAM;
842alter table terrain ENGINE = MyISAM; 842alter table terrain ENGINE = MyISAM;
843 843
844COMMIT; \ No newline at end of file 844COMMIT;
845
846:VERSION 39 #--------------- Telehub support
847
848BEGIN;
849CREATE TABLE IF NOT EXISTS `spawn_points` (
850 `RegionID` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
851 `PointX` float NOT NULL,
852 `PointY` float NOT NULL,
853 `PointZ` float NOT NULL,
854 KEY `EstateID` (`EstateID`)
855) ENGINE=Innodb;
856
857ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL;
858ALTER TABLE `regionsettings` ADD COLUMN `TelehubName` varchar(255) NOT NULL;
859ALTER TABLE `regionsettings` ADD COLUMN `TelehubEnabled` tinyint(4) NOT NULL;
860ALTER TABLE `regionsettings` ADD COLUMN `TelehubPosX` float NOT NULL;
861ALTER TABLE `regionsettings` ADD COLUMN `TelehubPosY` float NOT NULL;
862ALTER TABLE `regionsettings` ADD COLUMN `TelehubPosZ` float NOT NULL;
863ALTER TABLE `regionsettings` ADD COLUMN `TelehubRotX` float NOT NULL;
864ALTER TABLE `regionsettings` ADD COLUMN `TelehubRotY` float NOT NULL;
865ALTER TABLE `regionsettings` ADD COLUMN `TelehubRotZ` float NOT NULL;
866ALTER TABLE `regionsettings` ADD COLUMN `TelehubRotW` float NOT NULL;
867COMMIT;
868