From a28ca7b78b518d033437404caeff0f852dcc1094 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Mon, 26 May 2008 00:47:36 +0000
Subject: * Refactor: remove code duplication between add ScenePresence methods
in InnerScene
---
OpenSim/Region/Environment/Scenes/InnerScene.cs | 44 +++----------------------
1 file changed, 4 insertions(+), 40 deletions(-)
(limited to 'OpenSim/Region/Environment/Scenes/InnerScene.cs')
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index a2fdf66..45ce70a 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -488,51 +488,15 @@ namespace OpenSim.Region.Environment.Scenes
}
- public ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child, AvatarAppearance appearance)
+ protected internal ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child, AvatarAppearance appearance)
{
ScenePresence newAvatar = null;
newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance);
newAvatar.IsChildAgent = child;
- if (child)
- {
- m_numChildAgents++;
- m_log.Info("[SCENE]: " + m_regInfo.RegionName + ": Creating new child agent.");
- }
- else
- {
- m_numRootAgents++;
- m_log.Info("[SCENE]: " + m_regInfo.RegionName + ": Creating new root agent.");
- m_log.Info("[SCENE]: " + m_regInfo.RegionName + ": Adding Physical agent.");
-
- newAvatar.AddToPhysicalScene();
- }
-
- lock (Entities)
- {
- if (!Entities.ContainsKey(client.AgentId))
- {
- Entities.Add(client.AgentId, newAvatar);
- }
- else
- {
- Entities[client.AgentId] = newAvatar;
- }
- }
+ AddScenePresence(newAvatar);
- lock (ScenePresences)
- {
- if (ScenePresences.ContainsKey(client.AgentId))
- {
- ScenePresences[client.AgentId] = newAvatar;
- }
- else
- {
- ScenePresences.Add(client.AgentId, newAvatar);
- }
- }
-
return newAvatar;
}
@@ -540,7 +504,7 @@ namespace OpenSim.Region.Environment.Scenes
/// Add a presence to the scene
///
///
- internal void AddScenePresence(ScenePresence presence)
+ protected internal void AddScenePresence(ScenePresence presence)
{
bool child = presence.IsChildAgent;
@@ -572,7 +536,7 @@ namespace OpenSim.Region.Environment.Scenes
///
/// Remove a presence from the scene
///
- internal void RemoveScenePresence(LLUUID agentID)
+ protected internal void RemoveScenePresence(LLUUID agentID)
{
lock (Entities)
{
--
cgit v1.1