From a28ca7b78b518d033437404caeff0f852dcc1094 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 26 May 2008 00:47:36 +0000 Subject: [PATCH] * Refactor: remove code duplication between add ScenePresence methods in InnerScene --- .../Region/Environment/Scenes/InnerScene.cs | 44 ++----------------- OpenSim/Region/Environment/Scenes/Scene.cs | 1 - 2 files changed, 4 insertions(+), 41 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index a2fdf66ca6..45ce70a901 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) { diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index a44e88e176..1beea2be91 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1826,7 +1826,6 @@ namespace OpenSim.Region.Environment.Scenes protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child) { - AvatarAppearance appearance = null; GetAvatarAppearance(client, out appearance);