diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 90a8fcff9c..a81d758b79 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -659,12 +659,12 @@ namespace OpenSim.Region.Framework.Scenes protected internal void AddPhysicalPrim(int number) { - m_physicalPrim += number; + Interlocked.Add(ref m_physicalPrim, number); } protected internal void RemovePhysicalPrim(int number) { - m_physicalPrim -= number; + Interlocked.Add(ref m_physicalPrim, -number); } protected internal void AddToScriptLPS(int number) @@ -674,7 +674,7 @@ namespace OpenSim.Region.Framework.Scenes protected internal void AddActiveScripts(int number) { - m_activeScripts += number; + Interlocked.Add(ref m_activeScripts, number); } protected internal void HandleUndo(IClientAPI remoteClient, UUID primId) diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSMotors.cs b/OpenSim/Region/PhysicsModules/BulletS/BSMotors.cs index a0a0b828bd..bd289e133c 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSMotors.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSMotors.cs @@ -100,7 +100,7 @@ namespace OpenSim.Region.PhysicsModule.BulletS } public virtual bool ErrorIsZero(Vector3 err) { - return (err == Vector3.Zero || err.ApproxEquals(Vector3.Zero, ErrorZeroThreshold)); + return err.ApproxZero(ErrorZeroThreshold); } public BSVMotor(string useName) diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs index 2fa98b579e..47373caa18 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs @@ -129,26 +129,24 @@ namespace OpenSim.Region.PhysicsModules.SharedBase public void AddCollider(uint localID, ContactPoint contact) { - if (!m_objCollisionList.ContainsKey(localID)) - { - m_objCollisionList.Add(localID, contact); - } - else + if (m_objCollisionList.ContainsKey(localID)) { float lastVel = m_objCollisionList[localID].RelativeSpeed; if (m_objCollisionList[localID].PenetrationDepth < contact.PenetrationDepth) { - if(Math.Abs(lastVel) > Math.Abs(contact.RelativeSpeed)) + if (Math.Abs(lastVel) > Math.Abs(contact.RelativeSpeed)) contact.RelativeSpeed = lastVel; m_objCollisionList[localID] = contact; } - else if(Math.Abs(lastVel) < Math.Abs(contact.RelativeSpeed)) + else if (Math.Abs(lastVel) < Math.Abs(contact.RelativeSpeed)) { ContactPoint tmp = m_objCollisionList[localID]; tmp.RelativeSpeed = contact.RelativeSpeed; m_objCollisionList[localID] = tmp; } } + else + m_objCollisionList.Add(localID, contact); } /// diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs index 8e6970ad65..3fbcbeda9c 100644 --- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs +++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs @@ -152,7 +152,7 @@ namespace OpenSim.Server.Handlers.Grid /// /// Get GridInfo in json format: Used by the OSSL osGetGrid* - /// Adding the SRV_HomeIRI to the kvp returned for use in scripts + /// Adding the SRV_HomeURI to the kvp returned for use in scripts /// /// /// json string diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index cc869584b1..446fb45207 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -198,26 +198,31 @@ namespace OpenSim.Server.Handlers.Login if (request.Type == OSDType.Map) { OSDMap map = (OSDMap)request; - - if (map.ContainsKey("first") && map.ContainsKey("last") && map.ContainsKey("passwd")) + if (map.TryGetValue("first", out OSD ofirst) && + map.TryGetValue("last", out OSD olast) && + map.TryGetValue("passwd", out OSD opass)) { - string startLocation = string.Empty; + string first = ofirst.AsString(); + string last = olast.AsString(); + string passwd = opass.AsString(); - if (map.ContainsKey("start")) - startLocation = map["start"].AsString(); + string startLocation = string.Empty; + OSD otmp; + if (map.TryGetValue("start", out otmp)) + startLocation = otmp.AsString(); UUID scopeID = UUID.Zero; - if (map.ContainsKey("scope_id")) - scopeID = new UUID(map["scope_id"].AsString()); + if (map.TryGetValue("scope_id", out otmp)) + scopeID = new UUID(otmp.AsString()); - m_log.Info("[LOGIN]: LLSD Login Requested for: '" + map["first"].AsString() + "' '" + map["last"].AsString() + "' / " + startLocation); + m_log.Info("[LOGIN]: LLSD Login Requested for: '" + first + "' '" + last + "' / " + startLocation); LoginResponse reply = null; - reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, - map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient); + reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, + map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), + map["id0"].AsString(), remoteClient); return reply.ToOSDMap(); - } } diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 444dd0aa5a..6dd042030a 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -146,11 +146,9 @@ namespace OpenSim.Server.Handlers.Simulation source.RawServerURI = null; } - OSDMap resp = new OSDMap(2); - string reason = string.Empty; - - bool result = CreateAgent(source, gatekeeper, destination, aCircuit, data.flags, data.fromLogin, ctx, out reason); + bool result = CreateAgent(source, gatekeeper, destination, aCircuit, data.flags, data.fromLogin, ctx, out string reason); + OSDMap resp = new OSDMap(3); resp["reason"] = OSD.FromString(reason); resp["success"] = OSD.FromBoolean(result); // Let's also send out the IP address of the caller back to the caller (HG 1.5)