From 122745fe1c17ff0862f5a0cb2f97e8abf8d67cb6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 04:28:49 +0100 Subject: refactor: replace scale limiting code with more elegant Math.Min calls --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ffde68e..f5b8daf 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2846,12 +2846,9 @@ namespace OpenSim.Region.Framework.Scenes /// public void Resize(Vector3 scale) { - if (scale.X > ParentGroup.Scene.m_maxNonphys) - scale.X = ParentGroup.Scene.m_maxNonphys; - if (scale.Y > ParentGroup.Scene.m_maxNonphys) - scale.Y = ParentGroup.Scene.m_maxNonphys; - if (scale.Z > ParentGroup.Scene.m_maxNonphys) - scale.Z = ParentGroup.Scene.m_maxNonphys; + scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxNonphys); + scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys); + scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys); // m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); @@ -2865,12 +2862,9 @@ namespace OpenSim.Region.Framework.Scenes { if (PhysActor.IsPhysical) { - if (scale.X > ParentGroup.Scene.m_maxPhys) - scale.X = ParentGroup.Scene.m_maxPhys; - if (scale.Y > ParentGroup.Scene.m_maxPhys) - scale.Y = ParentGroup.Scene.m_maxPhys; - if (scale.Z > ParentGroup.Scene.m_maxPhys) - scale.Z = ParentGroup.Scene.m_maxPhys; + scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys); + scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys); + scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys); } PhysActor.Size = scale; -- cgit v1.1