diff options
author | Justin Clark-Casey (justincc) | 2011-12-14 18:03:25 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-12-14 18:03:25 +0000 |
commit | a110a7bd6aceffd9d69efde7270870b6d33a65bc (patch) | |
tree | 08253510a33f2b45a816ea1d0d2b854e99bcb45b /OpenSim/Region | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-a110a7bd6aceffd9d69efde7270870b6d33a65bc.zip opensim-SC-a110a7bd6aceffd9d69efde7270870b6d33a65bc.tar.gz opensim-SC-a110a7bd6aceffd9d69efde7270870b6d33a65bc.tar.bz2 opensim-SC-a110a7bd6aceffd9d69efde7270870b6d33a65bc.tar.xz |
Eliminate _taintedPrimsH and _taintedPrimsL (and _taintedPrimLock) in favour of just a _taintedPrims HashSet.
There's no point maintaining a list because any pending taint operations are all carried out in the same call anyway.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 59 |
1 files changed, 14 insertions, 45 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index c1a3e61..6ceb106 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -205,27 +205,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
205 | private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>(); | 205 | private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>(); |
206 | 206 | ||
207 | /// <summary> | 207 | /// <summary> |
208 | /// Used to lock on manipulation of _taintedPrimL and _taintedPrimH | 208 | /// Prims that the simulator has created/deleted/updated and so need updating in ODE. |
209 | /// </summary> | 209 | /// </summary> |
210 | private readonly Object _taintedPrimLock = new Object(); | 210 | private readonly HashSet<OdePrim> _taintedPrims = new HashSet<OdePrim>(); |
211 | |||
212 | /// <summary> | ||
213 | /// List of tainted prims. | ||
214 | /// </summary> | ||
215 | /// <remarks> | ||
216 | /// A tainted prim is one that has taints to process before performing any other operations. The list is | ||
217 | /// cleared after processing. | ||
218 | /// </remarks> | ||
219 | private readonly List<OdePrim> _taintedPrimL = new List<OdePrim>(); | ||
220 | |||
221 | /// <summary> | ||
222 | /// HashSet of tainted prims. | ||
223 | /// </summary> | ||
224 | /// <remarks> | ||
225 | /// A tainted prim is one that has taints to process before performing any other operations. The hashset is | ||
226 | /// cleared after processing. | ||
227 | /// </remarks> | ||
228 | private readonly HashSet<OdePrim> _taintedPrimH = new HashSet<OdePrim>(); | ||
229 | 211 | ||
230 | /// <summary> | 212 | /// <summary> |
231 | /// Record a character that has taints to be processed. | 213 | /// Record a character that has taints to be processed. |
@@ -767,7 +749,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
767 | } | 749 | } |
768 | catch (AccessViolationException) | 750 | catch (AccessViolationException) |
769 | { | 751 | { |
770 | m_log.Warn("[ODE SCENE]: Unable to collide test a space"); | 752 | m_log.Error("[ODE SCENE]: Unable to collide test a space"); |
771 | return; | 753 | return; |
772 | } | 754 | } |
773 | //Colliding a space or a geom with a space or a geom. so drill down | 755 | //Colliding a space or a geom with a space or a geom. so drill down |
@@ -829,7 +811,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
829 | } | 811 | } |
830 | catch (Exception e) | 812 | catch (Exception e) |
831 | { | 813 | { |
832 | m_log.WarnFormat("[ODE SCENE]: Unable to collide test an object: {0}", e.Message); | 814 | m_log.ErrorFormat("[ODE SCENE]: Unable to collide test an object: {0}", e.Message); |
833 | return; | 815 | return; |
834 | } | 816 | } |
835 | 817 | ||
@@ -1554,7 +1536,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1554 | } | 1536 | } |
1555 | catch (AccessViolationException) | 1537 | catch (AccessViolationException) |
1556 | { | 1538 | { |
1557 | m_log.WarnFormat("[ODE SCENE]: Unable to space collide {0}", Name); | 1539 | m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", Name); |
1558 | } | 1540 | } |
1559 | 1541 | ||
1560 | //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); | 1542 | //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); |
@@ -1585,13 +1567,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1585 | removeprims = new List<OdePrim>(); | 1567 | removeprims = new List<OdePrim>(); |
1586 | } | 1568 | } |
1587 | removeprims.Add(chr); | 1569 | removeprims.Add(chr); |
1588 | m_log.Debug("[ODE SCENE]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed. Removed it from the active prim list. This needs to be fixed!"); | 1570 | m_log.Error( |
1571 | "[ODE SCENE]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed. Removed it from the active prim list. This needs to be fixed!"); | ||
1589 | } | 1572 | } |
1590 | } | 1573 | } |
1591 | } | 1574 | } |
1592 | catch (AccessViolationException) | 1575 | catch (AccessViolationException) |
1593 | { | 1576 | { |
1594 | m_log.Warn("[ODE SCENE]: Unable to space collide"); | 1577 | m_log.Error("[ODE SCENE]: Unable to space collide"); |
1595 | } | 1578 | } |
1596 | } | 1579 | } |
1597 | } | 1580 | } |
@@ -2621,17 +2604,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2621 | if (actor is OdePrim) | 2604 | if (actor is OdePrim) |
2622 | { | 2605 | { |
2623 | OdePrim taintedprim = ((OdePrim)actor); | 2606 | OdePrim taintedprim = ((OdePrim)actor); |
2624 | lock (_taintedPrimLock) | 2607 | lock (_taintedPrims) |
2625 | { | 2608 | _taintedPrims.Add(taintedprim); |
2626 | if (!(_taintedPrimH.Contains(taintedprim))) | ||
2627 | { | ||
2628 | #if SPAM | ||
2629 | Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | ||
2630 | #endif | ||
2631 | _taintedPrimH.Add(taintedprim); // HashSet for searching | ||
2632 | _taintedPrimL.Add(taintedprim); // List for ordered readout | ||
2633 | } | ||
2634 | } | ||
2635 | } | 2609 | } |
2636 | else if (actor is OdeCharacter) | 2610 | else if (actor is OdeCharacter) |
2637 | { | 2611 | { |
@@ -2750,9 +2724,9 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
2750 | } | 2724 | } |
2751 | } | 2725 | } |
2752 | 2726 | ||
2753 | lock (_taintedPrimLock) | 2727 | lock (_taintedPrims) |
2754 | { | 2728 | { |
2755 | foreach (OdePrim prim in _taintedPrimL) | 2729 | foreach (OdePrim prim in _taintedPrims) |
2756 | { | 2730 | { |
2757 | if (prim.m_taintremove) | 2731 | if (prim.m_taintremove) |
2758 | { | 2732 | { |
@@ -2777,12 +2751,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
2777 | if (SupportsNINJAJoints) | 2751 | if (SupportsNINJAJoints) |
2778 | SimulatePendingNINJAJoints(); | 2752 | SimulatePendingNINJAJoints(); |
2779 | 2753 | ||
2780 | if (_taintedPrimL.Count > 0) | 2754 | _taintedPrims.Clear(); |
2781 | { | ||
2782 | //Console.WriteLine("Simulate calls Clear of _taintedPrim list"); | ||
2783 | _taintedPrimH.Clear(); | ||
2784 | _taintedPrimL.Clear(); | ||
2785 | } | ||
2786 | } | 2755 | } |
2787 | 2756 | ||
2788 | // Move characters | 2757 | // Move characters |
@@ -2854,7 +2823,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
2854 | foreach (OdeCharacter actor in _characters) | 2823 | foreach (OdeCharacter actor in _characters) |
2855 | { | 2824 | { |
2856 | if (actor.bad) | 2825 | if (actor.bad) |
2857 | m_log.WarnFormat("[ODE SCENE]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid); | 2826 | m_log.ErrorFormat("[ODE SCENE]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid); |
2858 | 2827 | ||
2859 | actor.UpdatePositionAndVelocity(defects); | 2828 | actor.UpdatePositionAndVelocity(defects); |
2860 | } | 2829 | } |