* Refactor: remove code duplication between add ScenePresence methods in InnerScene

0.6.0-stable
Justin Clarke Casey 2008-05-26 00:47:36 +00:00
parent 73a28a56da
commit a28ca7b78b
2 changed files with 4 additions and 41 deletions

View File

@ -488,50 +488,14 @@ 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;
}
}
lock (ScenePresences)
{
if (ScenePresences.ContainsKey(client.AgentId))
{
ScenePresences[client.AgentId] = newAvatar;
}
else
{
ScenePresences.Add(client.AgentId, newAvatar);
}
}
AddScenePresence(newAvatar);
return newAvatar;
}
@ -540,7 +504,7 @@ namespace OpenSim.Region.Environment.Scenes
/// Add a presence to the scene
/// </summary>
/// <param name="presence"></param>
internal void AddScenePresence(ScenePresence presence)
protected internal void AddScenePresence(ScenePresence presence)
{
bool child = presence.IsChildAgent;
@ -572,7 +536,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary>
/// Remove a presence from the scene
/// </summary>
internal void RemoveScenePresence(LLUUID agentID)
protected internal void RemoveScenePresence(LLUUID agentID)
{
lock (Entities)
{

View File

@ -1826,7 +1826,6 @@ namespace OpenSim.Region.Environment.Scenes
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
{
AvatarAppearance appearance = null;
GetAvatarAppearance(client, out appearance);