From 1cd26ba85ee50c3b1dea8e3519670866985548fd Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 22 Jan 2012 11:46:16 -0500 Subject: [PATCH 1/4] Hooking up new telehub data to the database --- OpenSim/Data/MySQL/MySQLSimulationData.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 3883e24f74..a2d5435128 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; } From 74c1ed77a44c96aed5c0b2c0eb828e6383792bfc Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 22 Jan 2012 14:51:15 -0500 Subject: [PATCH 2/4] Finish connecting Telehub to database --- OpenSim/Data/MySQL/MySQLSimulationData.cs | 22 ++++++++-- OpenSim/Framework/RegionSettings.cs | 50 +++-------------------- 2 files changed, 25 insertions(+), 47 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index a2d5435128..a48b91b3d2 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); } /// diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs index a2dd64f173..9b5bbf28cb 100644 --- a/OpenSim/Framework/RegionSettings.cs +++ b/OpenSim/Framework/RegionSettings.cs @@ -449,17 +449,14 @@ namespace OpenSim.Framework } // Connected Telehub position - private float m_TelehubPosX; - private float m_TelehubPosY; - private float m_TelehubPosZ; + private Vector3 m_TelehubPos; public Vector3 TelehubPos { get { if (HasTelehub) { - Vector3 Pos = new Vector3(m_TelehubPosX, m_TelehubPosY, m_TelehubPosZ); - return Pos; + return m_TelehubPos; } else { @@ -468,53 +465,18 @@ namespace OpenSim.Framework } set { - - m_TelehubPosX = value.X; - m_TelehubPosY = value.Y; - m_TelehubPosZ = value.Z; + m_TelehubPos = value; } } // Connected Telehub rotation - private float m_TelehubRotX; - private float m_TelehubRotY; - private float m_TelehubRotZ; - private float m_TelehubRotW; + private Quaternion m_TelehubRot; public Quaternion TelehubRot { get - { - if (HasTelehub) - { - Quaternion quat = new Quaternion(); - - quat.X = m_TelehubRotX; - quat.Y = m_TelehubRotY; - quat.Z = m_TelehubRotZ; - quat.W = m_TelehubRotW; - - return quat; - } - else - { - // What else to do?? - Quaternion quat = new Quaternion(); - - quat.X = m_TelehubRotX; - quat.X = m_TelehubRotY; - quat.X = m_TelehubRotZ; - quat.X = m_TelehubRotW; - - return quat; - } - } + { return m_TelehubRot; } set - { - m_TelehubRotX = value.X; - m_TelehubRotY = value.Y; - m_TelehubRotZ = value.Z; - m_TelehubRotW = value.W; - } + { m_TelehubRot = value; } } // Our Connected Telehub's SpawnPoints From d1ef7ee5ca0b3ad66d0a26d8ec2d73839607aa3f Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 22 Jan 2012 16:27:49 -0500 Subject: [PATCH 3/4] Add note about setting up test databases --- TESTING.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/TESTING.txt b/TESTING.txt index 54fc976e95..08a0698d2f 100644 --- a/TESTING.txt +++ b/TESTING.txt @@ -69,3 +69,6 @@ Example nunit-console2 OpenSim.Framework.Tests.dll (on linux) nunit-console OpenSim.Framework.Tests.dll (on windows) + +See the file OpenSim/Data/Tests/Resources/TestDataConnections.ini +for information to setup testing for data From 7c404375c7eeecc09228d49cca4d0fe162712a8c Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 22 Jan 2012 23:20:10 +0000 Subject: [PATCH 4/4] Fix up some parameter naming --- OpenSim/Data/MySQL/MySQLSimulationData.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index a48b91b3d2..b94f6ac701 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);