aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorTeravus Ovares2007-12-27 05:37:48 +0000
committerTeravus Ovares2007-12-27 05:37:48 +0000
commitcbf5ff4a9371c067dbe36ef28487c8784b9229d2 (patch)
treea5b16f0cd840374dc475153d77671f1d20f06ac7 /OpenSim/Framework
parent* Added osRegionRestart(float secs) to LSL Commands (diff)
downloadopensim-SC-cbf5ff4a9371c067dbe36ef28487c8784b9229d2.zip
opensim-SC-cbf5ff4a9371c067dbe36ef28487c8784b9229d2.tar.gz
opensim-SC-cbf5ff4a9371c067dbe36ef28487c8784b9229d2.tar.bz2
opensim-SC-cbf5ff4a9371c067dbe36ef28487c8784b9229d2.tar.xz
* 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.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLDataStore.cs42
1 files changed, 42 insertions, 0 deletions
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
523 createCol(prims, "RotationY", typeof(Double)); 523 createCol(prims, "RotationY", typeof(Double));
524 createCol(prims, "RotationZ", typeof(Double)); 524 createCol(prims, "RotationZ", typeof(Double));
525 createCol(prims, "RotationW", typeof(Double)); 525 createCol(prims, "RotationW", typeof(Double));
526 // sit target
527 createCol(prims, "SitTargetOffsetX", typeof(Double));
528 createCol(prims, "SitTargetOffsetY", typeof(Double));
529 createCol(prims, "SitTargetOffsetZ", typeof(Double));
530
531 createCol(prims, "SitTargetOrientW", typeof(Double));
532 createCol(prims, "SitTargetOrientX", typeof(Double));
533 createCol(prims, "SitTargetOrientY", typeof(Double));
534 createCol(prims, "SitTargetOrientZ", typeof(Double));
535
526 536
527 // Add in contraints 537 // Add in contraints
528 prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; 538 prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] };
@@ -688,7 +698,26 @@ namespace OpenSim.Framework.Data.MySQL
688 Convert.ToSingle(row["RotationZ"]), 698 Convert.ToSingle(row["RotationZ"]),
689 Convert.ToSingle(row["RotationW"]) 699 Convert.ToSingle(row["RotationW"])
690 ); 700 );
701 try
702 {
703 prim.SetSitTargetLL(new LLVector3(
704 Convert.ToSingle(row["SitTargetOffsetX"]),
705 Convert.ToSingle(row["SitTargetOffsetX"]),
706 Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion(
707 Convert.ToSingle(row["SitTargetOrientW"]),
708 Convert.ToSingle(row["SitTargetOrientX"]),
709 Convert.ToSingle(row["SitTargetOrientY"]),
710 Convert.ToSingle(row["SitTargetOrientX"])));
711 }
712 catch (System.InvalidCastException)
713 {
714 // Database table was created before we got here and needs to be created! :P
691 715
716 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))
717 {
718 cmd.ExecuteNonQuery();
719 }
720 }
692 return prim; 721 return prim;
693 } 722 }
694 723
@@ -798,6 +827,19 @@ namespace OpenSim.Framework.Data.MySQL
798 row["RotationY"] = prim.RotationOffset.Y; 827 row["RotationY"] = prim.RotationOffset.Y;
799 row["RotationZ"] = prim.RotationOffset.Z; 828 row["RotationZ"] = prim.RotationOffset.Z;
800 row["RotationW"] = prim.RotationOffset.W; 829 row["RotationW"] = prim.RotationOffset.W;
830
831 // Sit target
832 LLVector3 sitTargetPos = prim.GetSitTargetPositionLL();
833 row["SitTargetOffsetX"] = sitTargetPos.X;
834 row["SitTargetOffsetY"] = sitTargetPos.Y;
835 row["SitTargetOffsetZ"] = sitTargetPos.Z;
836
837 LLQuaternion sitTargetOrient = prim.GetSitTargetOrientationLL();
838 row["SitTargetOrientW"] = sitTargetOrient.W;
839 row["SitTargetOrientX"] = sitTargetOrient.X;
840 row["SitTargetOrientY"] = sitTargetOrient.Y;
841 row["SitTargetOrientZ"] = sitTargetOrient.Z;
842
801 } 843 }
802 844
803 private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) 845 private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID)