From 898904d83d371b69d001b669588f29c2befd6aa9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Nov 2011 18:27:41 +0000 Subject: 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() --- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/OdePlugin/OdeScene.cs') 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 private readonly Dictionary _collisionEventPrimChanges = new Dictionary(); private readonly HashSet _badCharacter = new HashSet(); + + /// + /// Maps a unique geometry id (a memory location) to a physics actor name. + /// + /// + /// Only actors participating in collisions have geometries. + /// public Dictionary geom_name_map = new Dictionary(); + + /// + /// Maps a unique geometry id (a memory location) to a physics actor. + /// + /// + /// Only actors participating in collisions have geometries. + /// public Dictionary actor_name_map = new Dictionary(); + private bool m_NINJA_physics_joints_enabled = false; //private Dictionary jointpart_name_map = new Dictionary(); private readonly Dictionary> joints_connecting_actor = new Dictionary>(); @@ -1699,8 +1714,11 @@ namespace OpenSim.Region.Physics.OdePlugin if (!_characters.Contains(chr)) { _characters.Add(chr); + geom_name_map[chr.Shell] = Name; + actor_name_map[chr.Shell] = chr; + if (chr.bad) - m_log.DebugFormat("[PHYSICS] Added BAD actor {0} to characters list", chr.m_uuid); + m_log.ErrorFormat("[PHYSICS] Added BAD actor {0} to characters list", chr.m_uuid); } } } @@ -1712,6 +1730,8 @@ namespace OpenSim.Region.Physics.OdePlugin if (_characters.Contains(chr)) { _characters.Remove(chr); + geom_name_map.Remove(chr.Shell); + actor_name_map.Remove(chr.Shell); } } } -- cgit v1.1