aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-21 17:04:54 +0000
committerJustin Clark-Casey (justincc)2011-11-21 17:04:54 +0000
commit4485007fce3578079d200d15e5988355772fa592 (patch)
tree3e4e0c92f54abeb4f5e4608ca0424ed0f9c0e07e
parentMove DeleteScriptsOnStartup switch from [Startup] to [XEngine] in OpenSim.ini... (diff)
downloadopensim-SC-4485007fce3578079d200d15e5988355772fa592.zip
opensim-SC-4485007fce3578079d200d15e5988355772fa592.tar.gz
opensim-SC-4485007fce3578079d200d15e5988355772fa592.tar.bz2
opensim-SC-4485007fce3578079d200d15e5988355772fa592.tar.xz
Instead of generating a new list for bad characters on every physics pass, keep reusing the same list.
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs15
1 files changed, 12 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 43d852b..fe2b2b2 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -188,11 +188,20 @@ namespace OpenSim.Region.Physics.OdePlugin
188 private d.NearCallback nearCallback; 188 private d.NearCallback nearCallback;
189 public d.TriCallback triCallback; 189 public d.TriCallback triCallback;
190 public d.TriArrayCallback triArrayCallback; 190 public d.TriArrayCallback triArrayCallback;
191
191 private readonly HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>(); 192 private readonly HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>();
192 private readonly HashSet<OdePrim> _prims = new HashSet<OdePrim>(); 193 private readonly HashSet<OdePrim> _prims = new HashSet<OdePrim>();
193 private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>(); 194 private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>();
194 195
195 /// <summary> 196 /// <summary>
197 /// Defects list to remove characters that no longer have finite positions due to some other bug.
198 /// </summary>
199 /// <remarks>
200 /// Used repeatedly in Simulate() but initialized once here.
201 /// </remarks>
202 private readonly List<OdeCharacter> defects = new List<OdeCharacter>();
203
204 /// <summary>
196 /// Used to lock on manipulation of _taintedPrimL and _taintedPrimH 205 /// Used to lock on manipulation of _taintedPrimL and _taintedPrimH
197 /// </summary> 206 /// </summary>
198 private readonly Object _taintedPrimLock = new Object(); 207 private readonly Object _taintedPrimLock = new Object();
@@ -2773,18 +2782,18 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
2773 // Move characters 2782 // Move characters
2774 lock (_characters) 2783 lock (_characters)
2775 { 2784 {
2776 List<OdeCharacter> defects = new List<OdeCharacter>();
2777 foreach (OdeCharacter actor in _characters) 2785 foreach (OdeCharacter actor in _characters)
2778 { 2786 {
2779 if (actor != null) 2787 if (actor != null)
2780 actor.Move(defects); 2788 actor.Move(defects);
2781 } 2789 }
2790
2782 if (0 != defects.Count) 2791 if (0 != defects.Count)
2783 { 2792 {
2784 foreach (OdeCharacter defect in defects) 2793 foreach (OdeCharacter defect in defects)
2785 {
2786 RemoveCharacter(defect); 2794 RemoveCharacter(defect);
2787 } 2795
2796 defects.Clear();
2788 } 2797 }
2789 } 2798 }
2790 2799