diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index bb7ae7f484..0a5bfd2a5e 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;
}
///