* Refactor: Separate out RemoveScenePresence and add into InnerScene to match existing AddScenePresence

0.6.0-stable
Justin Clarke Casey 2008-05-26 00:38:04 +00:00
parent 5d77625e9a
commit 73a28a56da
2 changed files with 40 additions and 26 deletions

View File

@ -520,6 +520,7 @@ namespace OpenSim.Region.Environment.Scenes
Entities[client.AgentId] = newAvatar;
}
}
lock (ScenePresences)
{
if (ScenePresences.ContainsKey(client.AgentId))
@ -535,7 +536,11 @@ namespace OpenSim.Region.Environment.Scenes
return newAvatar;
}
public void AddScenePresence(ScenePresence presence)
/// <summary>
/// Add a presence to the scene
/// </summary>
/// <param name="presence"></param>
internal void AddScenePresence(ScenePresence presence)
{
bool child = presence.IsChildAgent;
@ -563,6 +568,36 @@ namespace OpenSim.Region.Environment.Scenes
ScenePresences[presence.UUID] = presence;
}
}
/// <summary>
/// Remove a presence from the scene
/// </summary>
internal void RemoveScenePresence(LLUUID agentID)
{
lock (Entities)
{
if (Entities.Remove(agentID))
{
//m_log.InfoFormat("[SCENE] Removed scene presence {0} from entities list", agentID);
}
else
{
m_log.WarnFormat("[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", agentID);
}
}
lock (ScenePresences)
{
if (ScenePresences.Remove(agentID))
{
//m_log.InfoFormat("[SCENE] Removed scene presence {0}", agentID);
}
else
{
m_log.WarnFormat("[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
}
}
}
public void SwapRootChildAgent(bool direction_RC_CR_T_F)
{

View File

@ -558,18 +558,19 @@ namespace OpenSim.Region.Environment.Scenes
m_scripts_enabled = !ScriptEngine;
m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine");
}
if (m_physics_enabled != !PhysicsEngine)
{
m_physics_enabled = !PhysicsEngine;
}
}
public int GetInaccurateNeighborCount()
{
lock (m_neighbours)
return m_neighbours.Count;
}
// This is the method that shuts down the scene.
public override void Close()
{
@ -1910,29 +1911,7 @@ namespace OpenSim.Region.Environment.Scenes
agentTransactions.RemoveAgentAssetTransactions(agentID);
}
lock (m_scenePresences)
{
if (m_scenePresences.Remove(agentID))
{
//m_log.InfoFormat("[SCENE] Removed scene presence {0}", agentID);
}
else
{
m_log.WarnFormat("[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
}
}
lock (Entities)
{
if (Entities.Remove(agentID))
{
//m_log.InfoFormat("[SCENE] Removed scene presence {0} from entities list", agentID);
}
else
{
m_log.WarnFormat("[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", agentID);
}
}
m_innerScene.RemoveScenePresence(agentID);
try
{