From c0c330988f1ee149740e60574c7c9289e113d371 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 8 Feb 2009 17:41:15 +0000 Subject: * Some minor cleanup * sealed OdeScene --- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 60 +++++++++++++-------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'OpenSim/Region/Physics/OdePlugin') diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 9a4b1b0..d7d471f 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -122,14 +122,14 @@ namespace OpenSim.Region.Physics.OdePlugin Selected = 0x00000100 } - public class OdeScene : PhysicsScene + public sealed class OdeScene : PhysicsScene { - private ILog m_log; + private readonly ILog m_log; // private Dictionary m_storedCollisions = new Dictionary(); CollisionLocker ode; - protected Random fluidRandomizer = new Random(Environment.TickCount); + private Random fluidRandomizer = new Random(Environment.TickCount); private const uint m_regionWidth = Constants.RegionSize; private const uint m_regionHeight = Constants.RegionSize; @@ -153,7 +153,7 @@ namespace OpenSim.Region.Physics.OdePlugin private int framecount = 0; //private int m_returncollisions = 10; - private IntPtr contactgroup; + private readonly IntPtr contactgroup; private IntPtr LandGeom; private IntPtr WaterGeom; @@ -210,26 +210,26 @@ namespace OpenSim.Region.Physics.OdePlugin private d.NearCallback nearCallback; public d.TriCallback triCallback; public d.TriArrayCallback triArrayCallback; - private List _characters = new List(); - private List _prims = new List(); - private List _activeprims = new List(); - private List _taintedPrim = new List(); - private List _taintedActors = new List(); - private List _perloopContact = new List(); - private List _collisionEventPrim = new List(); + private readonly List _characters = new List(); + private readonly List _prims = new List(); + private readonly List _activeprims = new List(); + private readonly List _taintedPrim = new List(); + private readonly List _taintedActors = new List(); + private readonly List _perloopContact = new List(); + private readonly List _collisionEventPrim = new List(); public Dictionary geom_name_map = new Dictionary(); public Dictionary actor_name_map = new Dictionary(); private bool m_NINJA_physics_joints_enabled = false; //private Dictionary jointpart_name_map = new Dictionary(); - private Dictionary> joints_connecting_actor = new Dictionary>(); + private readonly Dictionary> joints_connecting_actor = new Dictionary>(); private d.ContactGeom[] contacts = new d.ContactGeom[80]; - private List requestedJointsToBeCreated = new List(); // lock only briefly. accessed by external code (to request new joints) and by OdeScene.Simulate() to move those joints into pending/active - private List pendingJoints = new List(); // can lock for longer. accessed only by OdeScene. - private List activeJoints = new List(); // can lock for longer. accessed only by OdeScene. - private List requestedJointsToBeDeleted = new List(); // lock only briefly. accessed by external code (to request deletion of joints) and by OdeScene.Simulate() to move those joints out of pending/active + private readonly List requestedJointsToBeCreated = new List(); // lock only briefly. accessed by external code (to request new joints) and by OdeScene.Simulate() to move those joints into pending/active + private readonly List pendingJoints = new List(); // can lock for longer. accessed only by OdeScene. + private readonly List activeJoints = new List(); // can lock for longer. accessed only by OdeScene. + private readonly List requestedJointsToBeDeleted = new List(); // lock only briefly. accessed by external code (to request deletion of joints) and by OdeScene.Simulate() to move those joints out of pending/active private Object externalJointRequestsLock = new Object(); - private Dictionary SOPName_to_activeJoint = new Dictionary(); - private Dictionary SOPName_to_pendingJoint = new Dictionary(); + private readonly Dictionary SOPName_to_activeJoint = new Dictionary(); + private readonly Dictionary SOPName_to_pendingJoint = new Dictionary(); private d.Contact contact; private d.Contact TerrainContact; @@ -240,8 +240,8 @@ namespace OpenSim.Region.Physics.OdePlugin //Ckrinke: Comment out until used. We declare it, initialize it, but do not use it //Ckrinke private int m_randomizeWater = 200; private int m_physicsiterations = 10; - private float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag - private PhysicsActor PANull = new NullPhysicsActor(); + private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag + private readonly PhysicsActor PANull = new NullPhysicsActor(); private float step_time = 0.0f; //Ckrinke: Comment out until used. We declare it, initialize it, but do not use it //Ckrinke private int ms = 0; @@ -1874,14 +1874,14 @@ namespace OpenSim.Region.Physics.OdePlugin /// /// Takes a space pointer and zeros out the array we're using to hold the spaces /// - /// - public void resetSpaceArrayItemToZero(IntPtr space) + /// + public void resetSpaceArrayItemToZero(IntPtr pSpace) { for (int x = 0; x < staticPrimspace.GetLength(0); x++) { for (int y = 0; y < staticPrimspace.GetLength(1); y++) { - if (staticPrimspace[x, y] == space) + if (staticPrimspace[x, y] == pSpace) staticPrimspace[x, y] = IntPtr.Zero; } } @@ -1926,8 +1926,8 @@ namespace OpenSim.Region.Physics.OdePlugin } else { - m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + currentspace.ToString() + - " Geom:" + geom.ToString()); + m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + currentspace + + " Geom:" + geom); } } else @@ -1943,7 +1943,7 @@ namespace OpenSim.Region.Physics.OdePlugin else { m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + - sGeomIsIn.ToString() + " Geom:" + geom.ToString()); + sGeomIsIn + " Geom:" + geom); } } } @@ -1966,7 +1966,7 @@ namespace OpenSim.Region.Physics.OdePlugin else { m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + - currentspace.ToString() + " Geom:" + geom.ToString()); + currentspace + " Geom:" + geom); } } } @@ -1986,7 +1986,7 @@ namespace OpenSim.Region.Physics.OdePlugin else { m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + - currentspace.ToString() + " Geom:" + geom.ToString()); + currentspace + " Geom:" + geom); } } else @@ -2002,7 +2002,7 @@ namespace OpenSim.Region.Physics.OdePlugin else { m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + - sGeomIsIn.ToString() + " Geom:" + geom.ToString()); + sGeomIsIn + " Geom:" + geom); } } } @@ -2127,7 +2127,7 @@ namespace OpenSim.Region.Physics.OdePlugin if (pbs.ProfileHollow != 0) iPropertiesNotSupportedDefault++; - if (((Int16)pbs.PathTwistBegin != 0) || ((Int16)pbs.PathTwist != 0)) + if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0)) iPropertiesNotSupportedDefault++; if ((pbs.ProfileBegin != 0) || pbs.ProfileEnd != 0) -- cgit v1.1