From 133fce98e79eced53bb68adc73749adf176cfccd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 22 Aug 2016 20:28:15 +0100 Subject: change ODEs topcolliders code ( still bad), plus a few memory leaks --- OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/PhysicsModules/Ode/OdeScene.cs') diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index 8f9bccb..7021a05 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs @@ -3452,6 +3452,11 @@ namespace OpenSim.Region.PhysicsModule.ODE } } + private int compareByCollisionsDesc(OdePrim A, OdePrim B) + { + return -A.CollisionScore.CompareTo(B.CollisionScore); + } + public override Dictionary GetTopColliders() { Dictionary topColliders; @@ -3459,7 +3464,7 @@ namespace OpenSim.Region.PhysicsModule.ODE lock (_prims) { List orderedPrims = new List(_prims); - orderedPrims.OrderByDescending(p => p.CollisionScore); + orderedPrims.Sort(compareByCollisionsDesc); topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore); foreach (OdePrim p in _prims) -- cgit v1.1