aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-06-01 00:26:11 +0100
committerJustin Clark-Casey (justincc)2012-06-01 00:26:11 +0100
commit878b67b333320070f643dfdd11e0a9c6ff453543 (patch)
tree40b1a6e59821ccd91e3c14be543b02bbfd35cbb8 /OpenSim
parentAdd an optional mechanism for physics modules to collect and return arbitrary... (diff)
downloadopensim-SC_OLD-878b67b333320070f643dfdd11e0a9c6ff453543.zip
opensim-SC_OLD-878b67b333320070f643dfdd11e0a9c6ff453543.tar.gz
opensim-SC_OLD-878b67b333320070f643dfdd11e0a9c6ff453543.tar.bz2
opensim-SC_OLD-878b67b333320070f643dfdd11e0a9c6ff453543.tar.xz
Fix OdeScene.GetTopColliders() to return the top 25 colliders rather than the first 25 that had non-zero collision scores.
Also zeros collisions scores on all prims after report collection, not just the top 25. As before, this collision scores are only reset after a report is requested, which may give unrealistic numbers on the first request. So to see more realistic scores, ignore the first report and then refresh the request after a couple of seconds or so.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs32
1 files changed, 13 insertions, 19 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index fa65945..25b3266 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -30,20 +30,21 @@
30 30
31using System; 31using System;
32using System.Collections.Generic; 32using System.Collections.Generic;
33using System.Diagnostics;
34using System.IO;
35using System.Linq;
33using System.Reflection; 36using System.Reflection;
34using System.Runtime.InteropServices; 37using System.Runtime.InteropServices;
35using System.Threading; 38using System.Threading;
36using System.IO;
37using System.Diagnostics;
38using log4net; 39using log4net;
39using Nini.Config; 40using Nini.Config;
40using Ode.NET; 41using Ode.NET;
42using OpenMetaverse;
41#if USE_DRAWSTUFF 43#if USE_DRAWSTUFF
42using Drawstuff.NET; 44using Drawstuff.NET;
43#endif 45#endif
44using OpenSim.Framework; 46using OpenSim.Framework;
45using OpenSim.Region.Physics.Manager; 47using OpenSim.Region.Physics.Manager;
46using OpenMetaverse;
47 48
48namespace OpenSim.Region.Physics.OdePlugin 49namespace OpenSim.Region.Physics.OdePlugin
49{ 50{
@@ -3868,26 +3869,19 @@ namespace OpenSim.Region.Physics.OdePlugin
3868 3869
3869 public override Dictionary<uint, float> GetTopColliders() 3870 public override Dictionary<uint, float> GetTopColliders()
3870 { 3871 {
3871 Dictionary<uint, float> returncolliders = new Dictionary<uint, float>(); 3872 Dictionary<uint, float> topColliders;
3872 int cnt = 0; 3873
3873 lock (_prims) 3874 lock (_prims)
3874 { 3875 {
3875 foreach (OdePrim prm in _prims) 3876 List<OdePrim> orderedPrims = new List<OdePrim>(_prims);
3876 { 3877 orderedPrims.OrderByDescending(p => p.CollisionScore).Take(25);
3877 if (prm.CollisionScore > 0) 3878 topColliders = orderedPrims.ToDictionary(p => p.LocalID, p => p.CollisionScore);
3878 { 3879
3879 returncolliders.Add(prm.LocalID, prm.CollisionScore); 3880 foreach (OdePrim p in _prims)
3880 cnt++; 3881 p.CollisionScore = 0;
3881 prm.CollisionScore = 0f;
3882 if (cnt > 25)
3883 {
3884 break;
3885 }
3886 }
3887 }
3888 } 3882 }
3889 3883
3890 return returncolliders; 3884 return topColliders;
3891 } 3885 }
3892 3886
3893 public override bool SupportsRayCast() 3887 public override bool SupportsRayCast()