From 73a28a56daf03e84f5a460317222b3e7e5d2e514 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Mon, 26 May 2008 00:38:04 +0000
Subject: * Refactor: Separate out RemoveScenePresence and add into InnerScene
to match existing AddScenePresence
---
OpenSim/Region/Environment/Scenes/InnerScene.cs | 37 ++++++++++++++++++++++++-
OpenSim/Region/Environment/Scenes/Scene.cs | 29 +++----------------
2 files changed, 40 insertions(+), 26 deletions(-)
(limited to 'OpenSim/Region/Environment')
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 0405bdf..a2fdf66 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -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)
+ ///
+ /// Add a presence to the scene
+ ///
+ ///
+ internal void AddScenePresence(ScenePresence presence)
{
bool child = presence.IsChildAgent;
@@ -563,6 +568,36 @@ namespace OpenSim.Region.Environment.Scenes
ScenePresences[presence.UUID] = presence;
}
}
+
+ ///
+ /// Remove a presence from the scene
+ ///
+ 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)
{
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 27431ed..a44e88e 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -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
{
--
cgit v1.1