aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-21 18:27:41 +0000
committerJustin Clark-Casey (justincc)2011-11-21 18:27:41 +0000
commit898904d83d371b69d001b669588f29c2befd6aa9 (patch)
tree8a6c6722901d44c53370fd6475a370db8dc5b08b /OpenSim/Region/Physics/OdePlugin/OdeScene.cs
parentHave ODECharacter and ODEPrim both use PhysicsActor.Name instead of maintaini... (diff)
downloadopensim-SC_OLD-898904d83d371b69d001b669588f29c2befd6aa9.zip
opensim-SC_OLD-898904d83d371b69d001b669588f29c2befd6aa9.tar.gz
opensim-SC_OLD-898904d83d371b69d001b669588f29c2befd6aa9.tar.bz2
opensim-SC_OLD-898904d83d371b69d001b669588f29c2befd6aa9.tar.xz
When an ODECharacter is removed (e.g. when an avatar leaves a scene), remove the actor reference in OdeScene.actor_name_map rather than leaving it dangling.
This also largely centralizes adds/removes in OdeScene.AddCharacter()/RemoveCharacter()
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdeScene.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs22
1 files changed, 21 insertions, 1 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index fe2b2b2..9dee07b 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -238,8 +238,23 @@ namespace OpenSim.Region.Physics.OdePlugin
238 private readonly Dictionary<uint, PhysicsActor> _collisionEventPrimChanges = new Dictionary<uint, PhysicsActor>(); 238 private readonly Dictionary<uint, PhysicsActor> _collisionEventPrimChanges = new Dictionary<uint, PhysicsActor>();
239 239
240 private readonly HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>(); 240 private readonly HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>();
241
242 /// <summary>
243 /// Maps a unique geometry id (a memory location) to a physics actor name.
244 /// </summary>
245 /// <remarks>
246 /// Only actors participating in collisions have geometries.
247 /// </remarks>
241 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); 248 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
249
250 /// <summary>
251 /// Maps a unique geometry id (a memory location) to a physics actor.
252 /// </summary>
253 /// <remarks>
254 /// Only actors participating in collisions have geometries.
255 /// </remarks>
242 public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>(); 256 public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>();
257
243 private bool m_NINJA_physics_joints_enabled = false; 258 private bool m_NINJA_physics_joints_enabled = false;
244 //private Dictionary<String, IntPtr> jointpart_name_map = new Dictionary<String,IntPtr>(); 259 //private Dictionary<String, IntPtr> jointpart_name_map = new Dictionary<String,IntPtr>();
245 private readonly Dictionary<String, List<PhysicsJoint>> joints_connecting_actor = new Dictionary<String, List<PhysicsJoint>>(); 260 private readonly Dictionary<String, List<PhysicsJoint>> joints_connecting_actor = new Dictionary<String, List<PhysicsJoint>>();
@@ -1699,8 +1714,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1699 if (!_characters.Contains(chr)) 1714 if (!_characters.Contains(chr))
1700 { 1715 {
1701 _characters.Add(chr); 1716 _characters.Add(chr);
1717 geom_name_map[chr.Shell] = Name;
1718 actor_name_map[chr.Shell] = chr;
1719
1702 if (chr.bad) 1720 if (chr.bad)
1703 m_log.DebugFormat("[PHYSICS] Added BAD actor {0} to characters list", chr.m_uuid); 1721 m_log.ErrorFormat("[PHYSICS] Added BAD actor {0} to characters list", chr.m_uuid);
1704 } 1722 }
1705 } 1723 }
1706 } 1724 }
@@ -1712,6 +1730,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1712 if (_characters.Contains(chr)) 1730 if (_characters.Contains(chr))
1713 { 1731 {
1714 _characters.Remove(chr); 1732 _characters.Remove(chr);
1733 geom_name_map.Remove(chr.Shell);
1734 actor_name_map.Remove(chr.Shell);
1715 } 1735 }
1716 } 1736 }
1717 } 1737 }