From fdf5f55a5b0e8936277053d3d24faef23a8f3061 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 26 Nov 2008 12:23:56 +0000 Subject: Yay for unit tests. Increased the type width of the prims and primshapes tables, and changed the database modules to actually push these doubles down into the database layer. --- OpenSim/Data/MySQL/MySQLRegionData.cs | 76 ++++++++++----------- OpenSim/Data/MySQL/Resources/025_RegionStore.sql | 78 ++++++++++++---------- OpenSim/Data/Tests/BasicRegionTest.cs | 4 +- ...nSim.Region.ScriptEngine.Shared.Api.Runtime.mdp | 1 + 4 files changed, 82 insertions(+), 77 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index a3ac38e..f64b142 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -1078,38 +1078,38 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("EveryoneMask", prim.EveryoneMask); cmd.Parameters.AddWithValue("BaseMask", prim.BaseMask); // vectors - cmd.Parameters.AddWithValue("PositionX", prim.OffsetPosition.X); - cmd.Parameters.AddWithValue("PositionY", prim.OffsetPosition.Y); - cmd.Parameters.AddWithValue("PositionZ", prim.OffsetPosition.Z); - cmd.Parameters.AddWithValue("GroupPositionX", prim.GroupPosition.X); - cmd.Parameters.AddWithValue("GroupPositionY", prim.GroupPosition.Y); - cmd.Parameters.AddWithValue("GroupPositionZ", prim.GroupPosition.Z); - cmd.Parameters.AddWithValue("VelocityX", prim.Velocity.X); - cmd.Parameters.AddWithValue("VelocityY", prim.Velocity.Y); - cmd.Parameters.AddWithValue("VelocityZ", prim.Velocity.Z); - cmd.Parameters.AddWithValue("AngularVelocityX", prim.AngularVelocity.X); - cmd.Parameters.AddWithValue("AngularVelocityY", prim.AngularVelocity.Y); - cmd.Parameters.AddWithValue("AngularVelocityZ", prim.AngularVelocity.Z); - cmd.Parameters.AddWithValue("AccelerationX", prim.Acceleration.X); - cmd.Parameters.AddWithValue("AccelerationY", prim.Acceleration.Y); - cmd.Parameters.AddWithValue("AccelerationZ", prim.Acceleration.Z); + cmd.Parameters.AddWithValue("PositionX", (double)prim.OffsetPosition.X); + cmd.Parameters.AddWithValue("PositionY", (double)prim.OffsetPosition.Y); + cmd.Parameters.AddWithValue("PositionZ", (double)prim.OffsetPosition.Z); + cmd.Parameters.AddWithValue("GroupPositionX", (double)prim.GroupPosition.X); + cmd.Parameters.AddWithValue("GroupPositionY", (double)prim.GroupPosition.Y); + cmd.Parameters.AddWithValue("GroupPositionZ", (double)prim.GroupPosition.Z); + cmd.Parameters.AddWithValue("VelocityX", (double)prim.Velocity.X); + cmd.Parameters.AddWithValue("VelocityY", (double)prim.Velocity.Y); + cmd.Parameters.AddWithValue("VelocityZ", (double)prim.Velocity.Z); + cmd.Parameters.AddWithValue("AngularVelocityX", (double)prim.AngularVelocity.X); + cmd.Parameters.AddWithValue("AngularVelocityY", (double)prim.AngularVelocity.Y); + cmd.Parameters.AddWithValue("AngularVelocityZ", (double)prim.AngularVelocity.Z); + cmd.Parameters.AddWithValue("AccelerationX", (double)prim.Acceleration.X); + cmd.Parameters.AddWithValue("AccelerationY", (double)prim.Acceleration.Y); + cmd.Parameters.AddWithValue("AccelerationZ", (double)prim.Acceleration.Z); // quaternions - cmd.Parameters.AddWithValue("RotationX", prim.RotationOffset.X); - cmd.Parameters.AddWithValue("RotationY", prim.RotationOffset.Y); - cmd.Parameters.AddWithValue("RotationZ", prim.RotationOffset.Z); - cmd.Parameters.AddWithValue("RotationW", prim.RotationOffset.W); + cmd.Parameters.AddWithValue("RotationX", (double)prim.RotationOffset.X); + cmd.Parameters.AddWithValue("RotationY", (double)prim.RotationOffset.Y); + cmd.Parameters.AddWithValue("RotationZ", (double)prim.RotationOffset.Z); + cmd.Parameters.AddWithValue("RotationW", (double)prim.RotationOffset.W); // Sit target Vector3 sitTargetPos = prim.SitTargetPositionLL; - cmd.Parameters.AddWithValue("SitTargetOffsetX", sitTargetPos.X); - cmd.Parameters.AddWithValue("SitTargetOffsetY", sitTargetPos.Y); - cmd.Parameters.AddWithValue("SitTargetOffsetZ", sitTargetPos.Z); + cmd.Parameters.AddWithValue("SitTargetOffsetX", (double)sitTargetPos.X); + cmd.Parameters.AddWithValue("SitTargetOffsetY", (double)sitTargetPos.Y); + cmd.Parameters.AddWithValue("SitTargetOffsetZ", (double)sitTargetPos.Z); Quaternion sitTargetOrient = prim.SitTargetOrientationLL; - cmd.Parameters.AddWithValue("SitTargetOrientW", sitTargetOrient.W); - cmd.Parameters.AddWithValue("SitTargetOrientX", sitTargetOrient.X); - cmd.Parameters.AddWithValue("SitTargetOrientY", sitTargetOrient.Y); - cmd.Parameters.AddWithValue("SitTargetOrientZ", sitTargetOrient.Z); + cmd.Parameters.AddWithValue("SitTargetOrientW", (double)sitTargetOrient.W); + cmd.Parameters.AddWithValue("SitTargetOrientX", (double)sitTargetOrient.X); + cmd.Parameters.AddWithValue("SitTargetOrientY", (double)sitTargetOrient.Y); + cmd.Parameters.AddWithValue("SitTargetOrientZ", (double)sitTargetOrient.Z); cmd.Parameters.AddWithValue("PayPrice", prim.PayPrice[0]); cmd.Parameters.AddWithValue("PayButton1", prim.PayPrice[1]); @@ -1131,17 +1131,17 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("TextureAnimation", prim.TextureAnimation); cmd.Parameters.AddWithValue("ParticleSystem", prim.ParticleSystem); - cmd.Parameters.AddWithValue("OmegaX", prim.RotationalVelocity.X); - cmd.Parameters.AddWithValue("OmegaY", prim.RotationalVelocity.Y); - cmd.Parameters.AddWithValue("OmegaZ", prim.RotationalVelocity.Z); + cmd.Parameters.AddWithValue("OmegaX", (double)prim.RotationalVelocity.X); + cmd.Parameters.AddWithValue("OmegaY", (double)prim.RotationalVelocity.Y); + cmd.Parameters.AddWithValue("OmegaZ", (double)prim.RotationalVelocity.Z); - cmd.Parameters.AddWithValue("CameraEyeOffsetX", prim.GetCameraEyeOffset().X); - cmd.Parameters.AddWithValue("CameraEyeOffsetY", prim.GetCameraEyeOffset().Y); - cmd.Parameters.AddWithValue("CameraEyeOffsetZ", prim.GetCameraEyeOffset().Z); + cmd.Parameters.AddWithValue("CameraEyeOffsetX", (double)prim.GetCameraEyeOffset().X); + cmd.Parameters.AddWithValue("CameraEyeOffsetY", (double)prim.GetCameraEyeOffset().Y); + cmd.Parameters.AddWithValue("CameraEyeOffsetZ", (double)prim.GetCameraEyeOffset().Z); - cmd.Parameters.AddWithValue("CameraAtOffsetX", prim.GetCameraAtOffset().X); - cmd.Parameters.AddWithValue("CameraAtOffsetY", prim.GetCameraAtOffset().Y); - cmd.Parameters.AddWithValue("CameraAtOffsetZ", prim.GetCameraAtOffset().Z); + cmd.Parameters.AddWithValue("CameraAtOffsetX", (double)prim.GetCameraAtOffset().X); + cmd.Parameters.AddWithValue("CameraAtOffsetY", (double)prim.GetCameraAtOffset().Y); + cmd.Parameters.AddWithValue("CameraAtOffsetZ", (double)prim.GetCameraAtOffset().Z); if (prim.GetForceMouselook()) cmd.Parameters.AddWithValue("ForceMouselook", 1); @@ -1363,9 +1363,9 @@ byte[] textureEntry = (byte[]) row["Texture"]; // shape is an enum cmd.Parameters.AddWithValue("Shape", 0); // vectors - cmd.Parameters.AddWithValue("ScaleX", s.Scale.X); - cmd.Parameters.AddWithValue("ScaleY", s.Scale.Y); - cmd.Parameters.AddWithValue("ScaleZ", s.Scale.Z); + cmd.Parameters.AddWithValue("ScaleX", (double)s.Scale.X); + cmd.Parameters.AddWithValue("ScaleY", (double)s.Scale.Y); + cmd.Parameters.AddWithValue("ScaleZ", (double)s.Scale.Z); // paths cmd.Parameters.AddWithValue("PCode", s.PCode); cmd.Parameters.AddWithValue("PathBegin", s.PathBegin); diff --git a/OpenSim/Data/MySQL/Resources/025_RegionStore.sql b/OpenSim/Data/MySQL/Resources/025_RegionStore.sql index 47fb6dd..e8f5d70 100644 --- a/OpenSim/Data/MySQL/Resources/025_RegionStore.sql +++ b/OpenSim/Data/MySQL/Resources/025_RegionStore.sql @@ -1,42 +1,46 @@ BEGIN; -alter table prims change column `PositionX` `PositionX` float default NULL; -alter table prims change column `PositionY` `PositionY` float default NULL; -alter table prims change column `PositionZ` `PositionZ` float default NULL; -alter table prims change column `GroupPositionX` `GroupPositionX` float default NULL; -alter table prims change column `GroupPositionY` `GroupPositionY` float default NULL; -alter table prims change column `GroupPositionZ` `GroupPositionZ` float default NULL; -alter table prims change column `VelocityX` `VelocityX` float default NULL; -alter table prims change column `VelocityY` `VelocityY` float default NULL; -alter table prims change column `VelocityZ` `VelocityZ` float default NULL; -alter table prims change column `AngularVelocityX` `AngularVelocityX` float default NULL; -alter table prims change column `AngularVelocityY` `AngularVelocityY` float default NULL; -alter table prims change column `AngularVelocityZ` `AngularVelocityZ` float default NULL; -alter table prims change column `AccelerationX` `AccelerationX` float default NULL; -alter table prims change column `AccelerationY` `AccelerationY` float default NULL; -alter table prims change column `AccelerationZ` `AccelerationZ` float default NULL; -alter table prims change column `RotationX` `RotationX` float default NULL; -alter table prims change column `RotationY` `RotationY` float default NULL; -alter table prims change column `RotationZ` `RotationZ` float default NULL; -alter table prims change column `RotationW` `RotationW` float default NULL; -alter table prims change column `SitTargetOffsetX` `SitTargetOffsetX` float default NULL; -alter table prims change column `SitTargetOffsetY` `SitTargetOffsetY` float default NULL; -alter table prims change column `SitTargetOffsetZ` `SitTargetOffsetZ` float default NULL; -alter table prims change column `SitTargetOrientW` `SitTargetOrientW` float default NULL; -alter table prims change column `SitTargetOrientX` `SitTargetOrientX` float default NULL; -alter table prims change column `SitTargetOrientY` `SitTargetOrientY` float default NULL; -alter table prims change column `SitTargetOrientZ` `SitTargetOrientZ` float default NULL; -alter table prims change column `LoopedSoundGain` `LoopedSoundGain` float NOT NULL default '0'; -alter table prims change column `OmegaX` `OmegaX` float NOT NULL default '0'; -alter table prims change column `OmegaY` `OmegaY` float NOT NULL default '0'; -alter table prims change column `OmegaZ` `OmegaZ` float NOT NULL default '0'; -alter table prims change column `CameraEyeOffsetX` `CameraEyeOffsetX` float NOT NULL default '0'; -alter table prims change column `CameraEyeOffsetY` `CameraEyeOffsetY` float NOT NULL default '0'; -alter table prims change column `CameraEyeOffsetZ` `CameraEyeOffsetZ` float NOT NULL default '0'; -alter table prims change column `CameraAtOffsetX` `CameraAtOffsetX` float NOT NULL default '0'; -alter table prims change column `CameraAtOffsetY` `CameraAtOffsetY` float NOT NULL default '0'; -alter table prims change column `CameraAtOffsetZ` `CameraAtOffsetZ` float NOT NULL default '0'; -alter table prims change column `CollisionSoundVolume` `CollisionSoundVolume` float NOT NULL default '0'; +alter table prims change column `PositionX` `PositionX` double default NULL; +alter table prims change column `PositionY` `PositionY` double default NULL; +alter table prims change column `PositionZ` `PositionZ` double default NULL; +alter table prims change column `GroupPositionX` `GroupPositionX` double default NULL; +alter table prims change column `GroupPositionY` `GroupPositionY` double default NULL; +alter table prims change column `GroupPositionZ` `GroupPositionZ` double default NULL; +alter table prims change column `VelocityX` `VelocityX` double default NULL; +alter table prims change column `VelocityY` `VelocityY` double default NULL; +alter table prims change column `VelocityZ` `VelocityZ` double default NULL; +alter table prims change column `AngularVelocityX` `AngularVelocityX` double default NULL; +alter table prims change column `AngularVelocityY` `AngularVelocityY` double default NULL; +alter table prims change column `AngularVelocityZ` `AngularVelocityZ` double default NULL; +alter table prims change column `AccelerationX` `AccelerationX` double default NULL; +alter table prims change column `AccelerationY` `AccelerationY` double default NULL; +alter table prims change column `AccelerationZ` `AccelerationZ` double default NULL; +alter table prims change column `RotationX` `RotationX` double default NULL; +alter table prims change column `RotationY` `RotationY` double default NULL; +alter table prims change column `RotationZ` `RotationZ` double default NULL; +alter table prims change column `RotationW` `RotationW` double default NULL; +alter table prims change column `SitTargetOffsetX` `SitTargetOffsetX` double default NULL; +alter table prims change column `SitTargetOffsetY` `SitTargetOffsetY` double default NULL; +alter table prims change column `SitTargetOffsetZ` `SitTargetOffsetZ` double default NULL; +alter table prims change column `SitTargetOrientW` `SitTargetOrientW` double default NULL; +alter table prims change column `SitTargetOrientX` `SitTargetOrientX` double default NULL; +alter table prims change column `SitTargetOrientY` `SitTargetOrientY` double default NULL; +alter table prims change column `SitTargetOrientZ` `SitTargetOrientZ` double default NULL; +alter table prims change column `LoopedSoundGain` `LoopedSoundGain` double NOT NULL default '0'; +alter table prims change column `OmegaX` `OmegaX` double NOT NULL default '0'; +alter table prims change column `OmegaY` `OmegaY` double NOT NULL default '0'; +alter table prims change column `OmegaZ` `OmegaZ` double NOT NULL default '0'; +alter table prims change column `CameraEyeOffsetX` `CameraEyeOffsetX` double NOT NULL default '0'; +alter table prims change column `CameraEyeOffsetY` `CameraEyeOffsetY` double NOT NULL default '0'; +alter table prims change column `CameraEyeOffsetZ` `CameraEyeOffsetZ` double NOT NULL default '0'; +alter table prims change column `CameraAtOffsetX` `CameraAtOffsetX` double NOT NULL default '0'; +alter table prims change column `CameraAtOffsetY` `CameraAtOffsetY` double NOT NULL default '0'; +alter table prims change column `CameraAtOffsetZ` `CameraAtOffsetZ` double NOT NULL default '0'; +alter table prims change column `CollisionSoundVolume` `CollisionSoundVolume` double NOT NULL default '0'; + +alter table primshapes change column `ScaleX` `ScaleX` double NOT NULL default '0'; +alter table primshapes change column `ScaleY` `ScaleY` double NOT NULL default '0'; +alter table primshapes change column `ScaleZ` `ScaleZ` double NOT NULL default '0'; COMMIT; diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs index 4428e0d..fac0466 100644 --- a/OpenSim/Data/Tests/BasicRegionTest.cs +++ b/OpenSim/Data/Tests/BasicRegionTest.cs @@ -220,7 +220,7 @@ namespace OpenSim.Data.Tests uint localid = localID+1; localID = localID + 1; string name = "Adam West"; - byte material = (byte) random.Next(255); + byte material = (byte) random.Next(127); ulong regionh = (ulong)random.NextDouble() * (ulong)random.Next(); int pin = random.Next(); Byte[] partsys = new byte[8]; @@ -381,7 +381,7 @@ namespace OpenSim.Data.Tests TaskInventoryDictionary dic = new TaskInventoryDictionary(); localID = localID + 1; string name = "West Adam"; - byte material = (byte) random.Next(255); + byte material = (byte) random.Next(127); ulong regionh = (ulong)random.NextDouble() * (ulong)random.Next(); int pin = random.Next(); Byte[] partsys = new byte[8]; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp index baabe65..708afab 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp @@ -22,6 +22,7 @@ + -- cgit v1.1