refactor: replace scale limiting code with more elegant Math.Min calls

bulletsim
Justin Clark-Casey (justincc) 2011-07-16 04:28:49 +01:00
parent 2b68ac4ba3
commit 122745fe1c
1 changed files with 6 additions and 12 deletions

View File

@ -2846,12 +2846,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="scale"></param> /// <param name="scale"></param>
public void Resize(Vector3 scale) public void Resize(Vector3 scale)
{ {
if (scale.X > ParentGroup.Scene.m_maxNonphys) scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxNonphys);
scale.X = ParentGroup.Scene.m_maxNonphys; scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys);
if (scale.Y > ParentGroup.Scene.m_maxNonphys) scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys);
scale.Y = ParentGroup.Scene.m_maxNonphys;
if (scale.Z > ParentGroup.Scene.m_maxNonphys)
scale.Z = ParentGroup.Scene.m_maxNonphys;
// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); // 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 (PhysActor.IsPhysical)
{ {
if (scale.X > ParentGroup.Scene.m_maxPhys) scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys);
scale.X = ParentGroup.Scene.m_maxPhys; scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys);
if (scale.Y > ParentGroup.Scene.m_maxPhys) scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys);
scale.Y = ParentGroup.Scene.m_maxPhys;
if (scale.Z > ParentGroup.Scene.m_maxPhys)
scale.Z = ParentGroup.Scene.m_maxPhys;
} }
PhysActor.Size = scale; PhysActor.Size = scale;