From 6535f23e4b8fec9578dae5275db69b237a99e498 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 7 Jul 2012 02:05:01 +0200 Subject: Add saving vehicle physics data to the database --- OpenSim/Data/MySQL/MySQLSimulationData.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 5e4df3a..fecc329 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -175,7 +175,8 @@ namespace OpenSim.Data.MySQL "PassCollisions, " + "LinkNumber, MediaURL, KeyframeMotion, " + "PhysicsShapeType, Density, GravityModifier, " + - "Friction, Restitution) values (" + "?UUID, " + + "Friction, Restitution, Vehicle " + + ") values (" + "?UUID, " + "?CreationDate, ?Name, ?Text, " + "?Description, ?SitName, ?TouchName, " + "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + @@ -209,7 +210,7 @@ namespace OpenSim.Data.MySQL "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " + "?LinkNumber, ?MediaURL, ?KeyframeMotion, " + "?PhysicsShapeType, ?Density, ?GravityModifier, " + - "?Friction, ?Restitution)"; + "?Friction, ?Restitution, ?Vehicle)"; FillPrimCommand(cmd, prim, obj.UUID, regionUUID); @@ -1258,6 +1259,15 @@ namespace OpenSim.Data.MySQL prim.GravityModifier = (float)(double)row["GravityModifier"]; prim.Friction = (float)(double)row["Friction"]; prim.Bounciness = (float)(double)row["Restitution"]; + + SOPVehicle vehicle = null; + + if (row["Vehicle"].ToString() != String.Empty) + { + vehicle = SOPVehicle.FromXml2(row["Vehicle"].ToString()); + if (vehicle != null) + prim.VehicleParams = vehicle; + } return prim; } @@ -1635,6 +1645,11 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier); cmd.Parameters.AddWithValue("Friction", (double)prim.Friction); cmd.Parameters.AddWithValue("Restitution", (double)prim.Bounciness); + + if (prim.VehicleParams != null) + { + cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2()); + } } /// -- cgit v1.1 From 3024bdd097ab3d4378501da1d00fa6e12da3dfe6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 7 Jul 2012 02:29:21 +0200 Subject: Fix storing vehicle data --- 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 fecc329..7df5a81 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -1647,9 +1647,9 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("Restitution", (double)prim.Bounciness); if (prim.VehicleParams != null) - { cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2()); - } + else + cmd.Parameters.AddWithValue("Vehicle", String.Empty); } /// -- cgit v1.1