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.
varregion
Justin Clark-Casey (justincc) 2013-08-23 00:49:13 +01:00
parent a9f9b0da9d
commit 065c5839b5
1 changed files with 6 additions and 28 deletions

View File

@ -561,39 +561,15 @@ namespace OpenSim.Region.Framework.Scenes
protected internal ScenePresence CreateAndAddChildScenePresence( protected internal ScenePresence CreateAndAddChildScenePresence(
IClientAPI client, AvatarAppearance appearance, PresenceType type) IClientAPI client, AvatarAppearance appearance, PresenceType type)
{ {
ScenePresence newAvatar = null;
// ScenePresence always defaults to child agent // ScenePresence always defaults to child agent
newAvatar = new ScenePresence(client, m_parentScene, appearance, type); ScenePresence presence = new ScenePresence(client, m_parentScene, appearance, type);
AddScenePresence(newAvatar);
return newAvatar;
}
/// <summary>
/// Add a presence to the scene
/// </summary>
/// <param name="presence"></param>
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);
}
Entities[presence.UUID] = presence; Entities[presence.UUID] = presence;
lock (m_presenceLock) lock (m_presenceLock)
{ {
m_numChildAgents++;
Dictionary<UUID, ScenePresence> newmap = new Dictionary<UUID, ScenePresence>(m_scenePresenceMap); Dictionary<UUID, ScenePresence> newmap = new Dictionary<UUID, ScenePresence>(m_scenePresenceMap);
List<ScenePresence> newlist = new List<ScenePresence>(m_scenePresenceArray); List<ScenePresence> newlist = new List<ScenePresence>(m_scenePresenceArray);
@ -604,7 +580,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
// Remember the old presene reference from the dictionary // Remember the old presence reference from the dictionary
ScenePresence oldref = newmap[presence.UUID]; ScenePresence oldref = newmap[presence.UUID];
// Replace the presence reference in the dictionary with the new value // Replace the presence reference in the dictionary with the new value
newmap[presence.UUID] = presence; newmap[presence.UUID] = presence;
@ -616,6 +592,8 @@ namespace OpenSim.Region.Framework.Scenes
m_scenePresenceMap = newmap; m_scenePresenceMap = newmap;
m_scenePresenceArray = newlist; m_scenePresenceArray = newlist;
} }
return presence;
} }
/// <summary> /// <summary>