From 47d8b6c5f50a494bca520e2a8532c59561339963 Mon Sep 17 00:00:00 2001 From: Snowcrash Date: Tue, 20 Oct 2009 15:51:19 +0200 Subject: Fix rounding error in PRIM_SIZE portion of llSetPrimitiveParams --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6e17639..c3e89f6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1263,11 +1263,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected void SetScale(SceneObjectPart part, LSL_Vector scale) { // TODO: this needs to trigger a persistance save as well - if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) return; - - if (scale.x < 0.01 || scale.y < 0.01 || scale.z < 0.01) + // scale.x < 0.01 in a manner which handles rounding errors + if (Math.Round(scale.x - 0.01) > 0.0 || Math.Round(scale.y - 0.01) > 0.0 || Math.Round(scale.z - 0.01) > 0.0) return; if (part.ParentGroup.RootPart.PhysActor != null && part.ParentGroup.RootPart.PhysActor.IsPhysical) @@ -1279,12 +1278,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (scale.z > World.m_maxPhys) scale.z = World.m_maxPhys; } + if (scale.x > World.m_maxNonphys) scale.x = World.m_maxNonphys; if (scale.y > World.m_maxNonphys) scale.y = World.m_maxNonphys; if (scale.z > World.m_maxNonphys) scale.z = World.m_maxNonphys; + Vector3 tmp = part.Scale; tmp.X = (float)scale.x; tmp.Y = (float)scale.y; -- cgit v1.1