From 5c35aa560ee11e2b92cc71145c7145a8b45a137e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Aug 2013 00:49:13 +0100 Subject: Refactor: merge SceneGraph.AddScenePresence() into CreateAndAddChildScenePresence() since the former was only ever called from the latter This allows us to remove dead code relating to adding root agents directly to the scenegraph, which never happens. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 34 +++++---------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index bb7ae7f..0a5bfd2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -561,39 +561,15 @@ namespace OpenSim.Region.Framework.Scenes protected internal ScenePresence CreateAndAddChildScenePresence( IClientAPI client, AvatarAppearance appearance, PresenceType type) { - ScenePresence newAvatar = null; - // ScenePresence always defaults to child agent - newAvatar = new ScenePresence(client, m_parentScene, appearance, type); - - AddScenePresence(newAvatar); - - return newAvatar; - } - - /// - /// Add a presence to the scene - /// - /// - protected internal void AddScenePresence(ScenePresence presence) - { - // Always a child when added to the scene - bool child = presence.IsChildAgent; - - if (child) - { - m_numChildAgents++; - } - else - { - m_numRootAgents++; - presence.AddToPhysicalScene(false); - } + ScenePresence presence = new ScenePresence(client, m_parentScene, appearance, type); Entities[presence.UUID] = presence; lock (m_presenceLock) { + m_numChildAgents++; + Dictionary newmap = new Dictionary(m_scenePresenceMap); List newlist = new List(m_scenePresenceArray); @@ -604,7 +580,7 @@ namespace OpenSim.Region.Framework.Scenes } else { - // Remember the old presene reference from the dictionary + // Remember the old presence reference from the dictionary ScenePresence oldref = newmap[presence.UUID]; // Replace the presence reference in the dictionary with the new value newmap[presence.UUID] = presence; @@ -616,6 +592,8 @@ namespace OpenSim.Region.Framework.Scenes m_scenePresenceMap = newmap; m_scenePresenceArray = newlist; } + + return presence; } /// -- cgit v1.1