From cbf5ff4a9371c067dbe36ef28487c8784b9229d2 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Thu, 27 Dec 2007 05:37:48 +0000 Subject: * Added Sit Target persistence over sim restarts for mySQL and MonoSQLite. * SAVE YOUR PRIM DATA, THIS MAKES CHANGES TO YOUR PRIMS TABLE * The first time you run OpenSim after updating past this revision, you'll see a lot of Errors. Be calm, shutdown the simulator, and start it again and your prims table will be updated. * MSSQL added the fields to the Initial CreateTable section, however, you'll need to add the fields to your prims table if you want it to persist. --- OpenSim/Framework/Data.MySQL/MySQLDataStore.cs | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs index 962d573..61b22a0 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs @@ -523,6 +523,16 @@ namespace OpenSim.Framework.Data.MySQL createCol(prims, "RotationY", typeof(Double)); createCol(prims, "RotationZ", typeof(Double)); createCol(prims, "RotationW", typeof(Double)); + // sit target + createCol(prims, "SitTargetOffsetX", typeof(Double)); + createCol(prims, "SitTargetOffsetY", typeof(Double)); + createCol(prims, "SitTargetOffsetZ", typeof(Double)); + + createCol(prims, "SitTargetOrientW", typeof(Double)); + createCol(prims, "SitTargetOrientX", typeof(Double)); + createCol(prims, "SitTargetOrientY", typeof(Double)); + createCol(prims, "SitTargetOrientZ", typeof(Double)); + // Add in contraints prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; @@ -688,7 +698,26 @@ namespace OpenSim.Framework.Data.MySQL Convert.ToSingle(row["RotationZ"]), Convert.ToSingle(row["RotationW"]) ); + try + { + prim.SetSitTargetLL(new LLVector3( + Convert.ToSingle(row["SitTargetOffsetX"]), + Convert.ToSingle(row["SitTargetOffsetX"]), + Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( + Convert.ToSingle(row["SitTargetOrientW"]), + Convert.ToSingle(row["SitTargetOrientX"]), + Convert.ToSingle(row["SitTargetOrientY"]), + Convert.ToSingle(row["SitTargetOrientX"]))); + } + catch (System.InvalidCastException) + { + // Database table was created before we got here and needs to be created! :P + using (MySqlCommand cmd = new MySqlCommand("ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;", m_connection)) + { + cmd.ExecuteNonQuery(); + } + } return prim; } @@ -798,6 +827,19 @@ namespace OpenSim.Framework.Data.MySQL row["RotationY"] = prim.RotationOffset.Y; row["RotationZ"] = prim.RotationOffset.Z; row["RotationW"] = prim.RotationOffset.W; + + // Sit target + LLVector3 sitTargetPos = prim.GetSitTargetPositionLL(); + row["SitTargetOffsetX"] = sitTargetPos.X; + row["SitTargetOffsetY"] = sitTargetPos.Y; + row["SitTargetOffsetZ"] = sitTargetPos.Z; + + LLQuaternion sitTargetOrient = prim.GetSitTargetOrientationLL(); + row["SitTargetOrientW"] = sitTargetOrient.W; + row["SitTargetOrientX"] = sitTargetOrient.X; + row["SitTargetOrientY"] = sitTargetOrient.Y; + row["SitTargetOrientZ"] = sitTargetOrient.Z; + } private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) -- cgit v1.1