From 32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sat, 21 Jan 2012 23:26:27 -0500 Subject: 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. --- OpenSim/Data/MySQL/MySQLEstateData.cs | 66 +++++++++++++++++++++- .../Data/MySQL/Resources/EstateStore.migrations | 21 +++++++ 2 files changed, 86 insertions(+), 1 deletion(-) (limited to 'OpenSim/Data/MySQL') 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 DoCreate(es); LoadBanList(es); + LoadSpawnPoints(es); es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); @@ -210,7 +211,7 @@ namespace OpenSim.Data.MySQL } LoadBanList(es); - + LoadSpawnPoints(es); es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups"); @@ -297,11 +298,74 @@ namespace OpenSim.Data.MySQL } SaveBanList(es); + SaveSpawnPoints(es); SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers); SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess); SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups); } + private void LoadSpawnPoints(EstateSettings es) + { + es.ClearSpawnPoints(); + + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + uint EstateID = es.EstateID; + cmd.CommandText = "select PointX, PointY, PointZ from spawn_points where EstateID = ?EstateID"; + cmd.Parameters.AddWithValue("?EstateID", es.EstateID); + + 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"]; + + es.AddSpawnPoint(point); + } + } + } + } + } + + private void SaveSpawnPoints(EstateSettings es) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "delete from spawn_points where EstateID = ?EstateID"; + cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); + + cmd.ExecuteNonQuery(); + + cmd.Parameters.Clear(); + + cmd.CommandText = "insert into spawn_points (EstateID, PointX, PointY, PointZ) values ( ?EstateID, ?PointX, ?PointY,?PointZ)"; + + foreach (Vector3 p in es.SpawnPoints()) + { + cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); + cmd.Parameters.AddWithValue("?PointX", p.X); + cmd.Parameters.AddWithValue("?PointY", p.Y); + cmd.Parameters.AddWithValue("?PointZ", p.Z); + + cmd.ExecuteNonQuery(); + cmd.Parameters.Clear(); + } + } + } + } + private void LoadBanList(EstateSettings es) { es.ClearBans(); diff --git a/OpenSim/Data/MySQL/Resources/EstateStore.migrations b/OpenSim/Data/MySQL/Resources/EstateStore.migrations index df82a2e..591295b 100644 --- a/OpenSim/Data/MySQL/Resources/EstateStore.migrations +++ b/OpenSim/Data/MySQL/Resources/EstateStore.migrations @@ -78,4 +78,25 @@ ALTER TABLE estate_settings AUTO_INCREMENT = 100; COMMIT; +:VERSION 33 #--------------------- ( Supporting Telehubs +BEGIN; +CREATE TABLE IF NOT EXISTS `spawn_points` ( + `EstateID` varchar(36) COLLATE utf8_unicode_ci NOT NULL, + `PointX` float NOT NULL, + `PointY` float NOT NULL, + `PointZ` float NOT NULL, + KEY `EstateID` (`EstateID`) +) ENGINE=Innodb; + +ALTER TABLE `estate_settings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL; +ALTER TABLE `estate_settings` ADD COLUMN `TelehubName` varchar(255) NOT NULL; +ALTER TABLE `estate_settings` ADD COLUMN `TelehubEnabled` tinyint(4) NOT NULL; +ALTER TABLE `estate_settings` ADD COLUMN `TelehubPosX` float NOT NULL; +ALTER TABLE `estate_settings` ADD COLUMN `TelehubPosY` float NOT NULL; +ALTER TABLE `estate_settings` ADD COLUMN `TelehubPosZ` float NOT NULL; +ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotX` float NOT NULL; +ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotY` float NOT NULL; +ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotZ` float NOT NULL; +ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotW` float NOT NULL; +COMMIT; \ No newline at end of file -- cgit v1.1 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/MySQLEstateData.cs | 65 -------------------- OpenSim/Data/MySQL/MySQLSimulationData.cs | 70 ++++++++++++++++++++++ .../Data/MySQL/Resources/EstateStore.migrations | 21 ------- .../Data/MySQL/Resources/RegionStore.migrations | 26 +++++++- 4 files changed, 95 insertions(+), 87 deletions(-) (limited to 'OpenSim/Data/MySQL') 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 DoCreate(es); LoadBanList(es); - LoadSpawnPoints(es); es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); @@ -211,7 +210,6 @@ namespace OpenSim.Data.MySQL } LoadBanList(es); - LoadSpawnPoints(es); es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups"); @@ -298,74 +296,11 @@ namespace OpenSim.Data.MySQL } SaveBanList(es); - SaveSpawnPoints(es); SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers); SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess); SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups); } - private void LoadSpawnPoints(EstateSettings es) - { - es.ClearSpawnPoints(); - - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - uint EstateID = es.EstateID; - cmd.CommandText = "select PointX, PointY, PointZ from spawn_points where EstateID = ?EstateID"; - cmd.Parameters.AddWithValue("?EstateID", es.EstateID); - - 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"]; - - es.AddSpawnPoint(point); - } - } - } - } - } - - private void SaveSpawnPoints(EstateSettings es) - { - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - cmd.CommandText = "delete from spawn_points where EstateID = ?EstateID"; - cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); - - cmd.ExecuteNonQuery(); - - cmd.Parameters.Clear(); - - cmd.CommandText = "insert into spawn_points (EstateID, PointX, PointY, PointZ) values ( ?EstateID, ?PointX, ?PointY,?PointZ)"; - - foreach (Vector3 p in es.SpawnPoints()) - { - cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); - cmd.Parameters.AddWithValue("?PointX", p.X); - cmd.Parameters.AddWithValue("?PointY", p.Y); - cmd.Parameters.AddWithValue("?PointZ", p.Z); - - cmd.ExecuteNonQuery(); - cmd.Parameters.Clear(); - } - } - } - } - private void LoadBanList(EstateSettings es) { 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 } } + 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(); + } + } + } + } + } } } 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; COMMIT; -:VERSION 33 #--------------------- ( Supporting Telehubs -BEGIN; -CREATE TABLE IF NOT EXISTS `spawn_points` ( - `EstateID` varchar(36) COLLATE utf8_unicode_ci NOT NULL, - `PointX` float NOT NULL, - `PointY` float NOT NULL, - `PointZ` float NOT NULL, - KEY `EstateID` (`EstateID`) -) ENGINE=Innodb; - -ALTER TABLE `estate_settings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL; -ALTER TABLE `estate_settings` ADD COLUMN `TelehubName` varchar(255) NOT NULL; -ALTER TABLE `estate_settings` ADD COLUMN `TelehubEnabled` tinyint(4) NOT NULL; -ALTER TABLE `estate_settings` ADD COLUMN `TelehubPosX` float NOT NULL; -ALTER TABLE `estate_settings` ADD COLUMN `TelehubPosY` float NOT NULL; -ALTER TABLE `estate_settings` ADD COLUMN `TelehubPosZ` float NOT NULL; -ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotX` float NOT NULL; -ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotY` float NOT NULL; -ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotZ` float NOT NULL; -ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotW` float NOT NULL; -COMMIT; \ 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; alter table regionsettings ENGINE = MyISAM; alter table terrain ENGINE = MyISAM; -COMMIT; \ No newline at end of file +COMMIT; + +:VERSION 39 #--------------- Telehub support + +BEGIN; +CREATE TABLE IF NOT EXISTS `spawn_points` ( + `RegionID` varchar(36) COLLATE utf8_unicode_ci NOT NULL, + `PointX` float NOT NULL, + `PointY` float NOT NULL, + `PointZ` float NOT NULL, + KEY `EstateID` (`EstateID`) +) ENGINE=Innodb; + +ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL; +ALTER TABLE `regionsettings` ADD COLUMN `TelehubName` varchar(255) NOT NULL; +ALTER TABLE `regionsettings` ADD COLUMN `TelehubEnabled` tinyint(4) NOT NULL; +ALTER TABLE `regionsettings` ADD COLUMN `TelehubPosX` float NOT NULL; +ALTER TABLE `regionsettings` ADD COLUMN `TelehubPosY` float NOT NULL; +ALTER TABLE `regionsettings` ADD COLUMN `TelehubPosZ` float NOT NULL; +ALTER TABLE `regionsettings` ADD COLUMN `TelehubRotX` float NOT NULL; +ALTER TABLE `regionsettings` ADD COLUMN `TelehubRotY` float NOT NULL; +ALTER TABLE `regionsettings` ADD COLUMN `TelehubRotZ` float NOT NULL; +ALTER TABLE `regionsettings` ADD COLUMN `TelehubRotW` float NOT NULL; +COMMIT; + -- cgit v1.1 From 24b20f6e4b98b5d7049d2db77d8701529eab75ca Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 22 Jan 2012 15:35:14 +0000 Subject: Change the key name I missed in last commit --- OpenSim/Data/MySQL/Resources/RegionStore.migrations | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index ce66cfb..3132148 100644 --- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations @@ -851,7 +851,7 @@ CREATE TABLE IF NOT EXISTS `spawn_points` ( `PointX` float NOT NULL, `PointY` float NOT NULL, `PointZ` float NOT NULL, - KEY `EstateID` (`EstateID`) + KEY `RegionID` (`RegionID`) ) ENGINE=Innodb; ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL; -- cgit v1.1 From 1cd26ba85ee50c3b1dea8e3519670866985548fd Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 22 Jan 2012 11:46:16 -0500 Subject: Hooking up new telehub data to the database --- OpenSim/Data/MySQL/MySQLSimulationData.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 3883e24..a2d5435 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -1299,6 +1299,20 @@ namespace OpenSim.Data.MySQL newSettings.LoadedCreationID = (String) row["loaded_creation_id"]; newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]); + newSettings.HasTelehub = Convert.ToBoolean(row["TelehubEnabled"]); + newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); + newSettings.TelehubName = (string) row["TelehubName"]; + newSettings.TelehubPos = new Vector3 ( + Convert.ToSingle(row["TelehubPosX"]), + Convert.ToSingle(row["TelehubPosY"]), + Convert.ToSingle(row["TelehubPosZ"]) + ); + newSettings.TelehubRot = new Quaternion ( + Convert.ToSingle(row["TelehubRotX"]), + Convert.ToSingle(row["TelehubRotY"]), + Convert.ToSingle(row["TelehubRotZ"]), + Convert.ToSingle(row["TelehubRotW"]) + ); return newSettings; } -- cgit v1.1 From 74c1ed77a44c96aed5c0b2c0eb828e6383792bfc Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 22 Jan 2012 14:51:15 -0500 Subject: Finish connecting Telehub to database --- OpenSim/Data/MySQL/MySQLSimulationData.cs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index a2d5435..a48b91b 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -996,7 +996,11 @@ namespace OpenSim.Data.MySQL "use_estate_sun, fixed_sun, sun_position, " + "covenant, Sandbox, sunvectorx, sunvectory, " + "sunvectorz, loaded_creation_datetime, " + - "loaded_creation_id, map_tile_ID) values (?RegionUUID, ?BlockTerraform, " + + "loaded_creation_id, map_tile_ID, " + + "TelehubEnabled, TelehubObject, TelehubName, " + + "TelehubPosX, TelehubPosY, TelehubPosZ, " + + "TelehubRotX, TelehubRotY, TelehubRotZ, TelehubRotW) " + + "values (?RegionUUID, ?BlockTerraform, " + "?BlockFly, ?AllowDamage, ?RestrictPushing, " + "?AllowLandResell, ?AllowLandJoinDivide, " + "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + @@ -1011,7 +1015,10 @@ namespace OpenSim.Data.MySQL "?SunPosition, ?Covenant, ?Sandbox, " + "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + "?LoadedCreationDateTime, ?LoadedCreationID, " + - "?TerrainImageID)"; + "?TerrainImageID, " + + "?TelehubEnabled, ?TelehubObject, ?TelehubName, " + + "?TelehubPosX, ?TelehubPosY, ?TelehubPosZ, " + + "?TelehubRotX, ?TelehubRotY, ?TelehubRotZ, ?TelehubRotW )"; FillRegionSettingsCommand(cmd, rs); @@ -1643,7 +1650,16 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); - + cmd.Parameters.AddWithValue("TelehubEnabled", settings.HasTelehub); + cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); + cmd.Parameters.AddWithValue("TelehubName", settings.TelehubName); + cmd.Parameters.AddWithValue("TelehubPosX", settings.TelehubPos.X); + cmd.Parameters.AddWithValue("TelehubPosY", settings.TelehubPos.Y); + cmd.Parameters.AddWithValue("TelehubPosZ", settings.TelehubPos.Z); + cmd.Parameters.AddWithValue("TelehubRotX", settings.TelehubRot.X); + cmd.Parameters.AddWithValue("TelehubRotY", settings.TelehubRot.Y); + cmd.Parameters.AddWithValue("TelehubRotZ", settings.TelehubRot.Z); + cmd.Parameters.AddWithValue("TelehubRotW", settings.TelehubRot.W); } /// -- cgit v1.1 From 7c404375c7eeecc09228d49cca4d0fe162712a8c Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 22 Jan 2012 23:20:10 +0000 Subject: Fix up some parameter naming --- OpenSim/Data/MySQL/MySQLSimulationData.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index a48b91b..b94f6ac 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -1912,11 +1912,11 @@ namespace OpenSim.Data.MySQL cmd.Parameters.Clear(); - cmd.CommandText = "insert into spawn_points (RegionID, PointX, PointY, PointZ) values ( ?EstateID, ?PointX, ?PointY,?PointZ)"; + cmd.CommandText = "insert into spawn_points (RegionID, PointX, PointY, PointZ) values ( ?RegionID, ?PointX, ?PointY,?PointZ)"; foreach (Vector3 p in rs.SpawnPoints()) { - cmd.Parameters.AddWithValue("?EstateID", rs.RegionUUID.ToString()); + cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString()); cmd.Parameters.AddWithValue("?PointX", p.X); cmd.Parameters.AddWithValue("?PointY", p.Y); cmd.Parameters.AddWithValue("?PointZ", p.Z); -- cgit v1.1 From 48379e644206bf59e5e2059902f1d7dfd1be5e94 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 23 Jan 2012 21:23:55 +0000 Subject: IMPORTANT!!!!! Please READ. DO NOT Use this version or any before it since the Telehub commits! They will eat your babies and corrupt your database while they munch. DO NOT use anything from the first Telehub commit to this one. FIRST GOOD COMMIT is the one FOLLOWING this one. You have been warned. --- OpenSim/Data/MySQL/Resources/RegionStore.migrations | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index 3132148..720e200 100644 --- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations @@ -848,21 +848,12 @@ COMMIT; BEGIN; CREATE TABLE IF NOT EXISTS `spawn_points` ( `RegionID` varchar(36) COLLATE utf8_unicode_ci NOT NULL, - `PointX` float NOT NULL, - `PointY` float NOT NULL, - `PointZ` float NOT NULL, + `Yaw` float NOT NULL, + `Pitch` float NOT NULL, + `Distance` float NOT NULL, KEY `RegionID` (`RegionID`) ) ENGINE=Innodb; ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL; -ALTER TABLE `regionsettings` ADD COLUMN `TelehubName` varchar(255) NOT NULL; -ALTER TABLE `regionsettings` ADD COLUMN `TelehubEnabled` tinyint(4) NOT NULL; -ALTER TABLE `regionsettings` ADD COLUMN `TelehubPosX` float NOT NULL; -ALTER TABLE `regionsettings` ADD COLUMN `TelehubPosY` float NOT NULL; -ALTER TABLE `regionsettings` ADD COLUMN `TelehubPosZ` float NOT NULL; -ALTER TABLE `regionsettings` ADD COLUMN `TelehubRotX` float NOT NULL; -ALTER TABLE `regionsettings` ADD COLUMN `TelehubRotY` float NOT NULL; -ALTER TABLE `regionsettings` ADD COLUMN `TelehubRotZ` float NOT NULL; -ALTER TABLE `regionsettings` ADD COLUMN `TelehubRotW` float NOT NULL; COMMIT; -- cgit v1.1 From 87799c1f3ddfbc4b0994cac4e54498520899e4d4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 24 Jan 2012 00:32:10 +0000 Subject: Change Telehubs to store only the data that is really needed and not additional redundant information. --- OpenSim/Data/MySQL/MySQLSimulationData.cs | 53 ++++++++----------------------- 1 file changed, 13 insertions(+), 40 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index b94f6ac..ebb41a5 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -997,9 +997,7 @@ namespace OpenSim.Data.MySQL "covenant, Sandbox, sunvectorx, sunvectory, " + "sunvectorz, loaded_creation_datetime, " + "loaded_creation_id, map_tile_ID, " + - "TelehubEnabled, TelehubObject, TelehubName, " + - "TelehubPosX, TelehubPosY, TelehubPosZ, " + - "TelehubRotX, TelehubRotY, TelehubRotZ, TelehubRotW) " + + "TelehubObject) " + "values (?RegionUUID, ?BlockTerraform, " + "?BlockFly, ?AllowDamage, ?RestrictPushing, " + "?AllowLandResell, ?AllowLandJoinDivide, " + @@ -1015,10 +1013,7 @@ namespace OpenSim.Data.MySQL "?SunPosition, ?Covenant, ?Sandbox, " + "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + "?LoadedCreationDateTime, ?LoadedCreationID, " + - "?TerrainImageID, " + - "?TelehubEnabled, ?TelehubObject, ?TelehubName, " + - "?TelehubPosX, ?TelehubPosY, ?TelehubPosZ, " + - "?TelehubRotX, ?TelehubRotY, ?TelehubRotZ, ?TelehubRotW )"; + "?TerrainImageID) "; FillRegionSettingsCommand(cmd, rs); @@ -1306,20 +1301,7 @@ namespace OpenSim.Data.MySQL newSettings.LoadedCreationID = (String) row["loaded_creation_id"]; newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]); - newSettings.HasTelehub = Convert.ToBoolean(row["TelehubEnabled"]); newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); - newSettings.TelehubName = (string) row["TelehubName"]; - newSettings.TelehubPos = new Vector3 ( - Convert.ToSingle(row["TelehubPosX"]), - Convert.ToSingle(row["TelehubPosY"]), - Convert.ToSingle(row["TelehubPosZ"]) - ); - newSettings.TelehubRot = new Quaternion ( - Convert.ToSingle(row["TelehubRotX"]), - Convert.ToSingle(row["TelehubRotY"]), - Convert.ToSingle(row["TelehubRotZ"]), - Convert.ToSingle(row["TelehubRotW"]) - ); return newSettings; } @@ -1650,16 +1632,7 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); - cmd.Parameters.AddWithValue("TelehubEnabled", settings.HasTelehub); cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); - cmd.Parameters.AddWithValue("TelehubName", settings.TelehubName); - cmd.Parameters.AddWithValue("TelehubPosX", settings.TelehubPos.X); - cmd.Parameters.AddWithValue("TelehubPosY", settings.TelehubPos.Y); - cmd.Parameters.AddWithValue("TelehubPosZ", settings.TelehubPos.Z); - cmd.Parameters.AddWithValue("TelehubRotX", settings.TelehubRot.X); - cmd.Parameters.AddWithValue("TelehubRotY", settings.TelehubRot.Y); - cmd.Parameters.AddWithValue("TelehubRotZ", settings.TelehubRot.Z); - cmd.Parameters.AddWithValue("TelehubRotW", settings.TelehubRot.W); } /// @@ -1874,20 +1847,20 @@ namespace OpenSim.Data.MySQL using (MySqlCommand cmd = dbcon.CreateCommand()) { - cmd.CommandText = "select PointX, PointY, PointZ from spawn_points where RegionID = ?RegionID"; + cmd.CommandText = "select Yaw, Pitch, Distance 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(); + SpawnPoint sp = new SpawnPoint(); - point.X = (float)r["PointX"]; - point.Y = (float)r["PointY"]; - point.Z = (float)r["PointZ"]; + sp.Yaw = (float)r["Yaw"]; + sp.Pitch = (float)r["Pitch"]; + sp.Distance = (float)r["Distance"]; - rs.AddSpawnPoint(point); + rs.AddSpawnPoint(sp); } } } @@ -1912,14 +1885,14 @@ namespace OpenSim.Data.MySQL cmd.Parameters.Clear(); - cmd.CommandText = "insert into spawn_points (RegionID, PointX, PointY, PointZ) values ( ?RegionID, ?PointX, ?PointY,?PointZ)"; + cmd.CommandText = "insert into spawn_points (RegionID, Yaw, Pitch, Distance) values ( ?RegionID, ?Yaw, ?Pitch, ?Distance)"; - foreach (Vector3 p in rs.SpawnPoints()) + foreach (SpawnPoint p in rs.SpawnPoints()) { cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString()); - cmd.Parameters.AddWithValue("?PointX", p.X); - cmd.Parameters.AddWithValue("?PointY", p.Y); - cmd.Parameters.AddWithValue("?PointZ", p.Z); + cmd.Parameters.AddWithValue("?Yaw", p.Yaw); + cmd.Parameters.AddWithValue("?Pitch", p.Pitch); + cmd.Parameters.AddWithValue("?Distance", p.Distance); cmd.ExecuteNonQuery(); cmd.Parameters.Clear(); -- cgit v1.1 From 7bb01a17eee0a35271c312379be9e528338ec08c Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 24 Jan 2012 00:38:00 +0000 Subject: Add a forgotten parameter --- OpenSim/Data/MySQL/MySQLSimulationData.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index ebb41a5..31d17f1 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -1013,7 +1013,7 @@ namespace OpenSim.Data.MySQL "?SunPosition, ?Covenant, ?Sandbox, " + "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + "?LoadedCreationDateTime, ?LoadedCreationID, " + - "?TerrainImageID) "; + "?TerrainImageID, ?TelehubObject) "; FillRegionSettingsCommand(cmd, rs); -- cgit v1.1