Minor ScenePresence related refactoring

ThreadPoolClientBranch
Justin Clarke Casey 2008-02-08 19:53:18 +00:00
parent a50a26f812
commit 9d95f9bcf4
2 changed files with 30 additions and 18 deletions

View File

@ -1407,12 +1407,28 @@ namespace OpenSim.Region.Environment.Scenes
lock (m_scenePresences) lock (m_scenePresences)
{ {
m_scenePresences.Remove(agentID); if (m_scenePresences.Remove(agentID))
{
//m_log.Info(String.Format("[SCENE] Removed scene presence {0}", agentID));
}
else
{
m_log.Warn(
String.Format("[SCENE] Tried to remove non-existent scene prescence with agent ID {0} from scene ScenePresences list", agentID));
}
} }
lock (Entities) lock (Entities)
{ {
Entities.Remove(agentID); if (Entities.Remove(agentID))
{
//m_log.Info(String.Format("[SCENE] Removed scene presence {0} from entities list", agentID));
}
else
{
m_log.Warn(
String.Format("[SCENE] Tried to remove non-existent scene prescence with agent ID {0} from scene Entities list", agentID));
}
} }
try try
@ -1425,7 +1441,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("Scene.cs:RemoveClient exception: " + e.ToString()); m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString());
} }
// Remove client agent from profile, so new logins will work // Remove client agent from profile, so new logins will work

View File

@ -316,21 +316,17 @@ namespace OpenSim.Region.Environment.Scenes
List<ScenePresence> avatars = new List<ScenePresence>(); List<ScenePresence> avatars = new List<ScenePresence>();
ForEachCurrentScene(delegate(Scene scene) ForEachCurrentScene(delegate(Scene scene)
{ {
List<EntityBase> EntitieList = scene.GetEntities(); List<ScenePresence> scenePrescences = scene.GetScenePresences();
foreach (EntityBase entity in EntitieList) foreach (ScenePresence scenePrescence in scenePrescences)
{ {
if (entity is ScenePresence) if (!scenePrescence.IsChildAgent)
{ {
ScenePresence scenePrescence = entity as ScenePresence; avatars.Add(scenePrescence);
if (!scenePrescence.IsChildAgent) }
{ }
avatars.Add(scenePrescence); });
}
}
}
});
return avatars; return avatars;
} }
@ -423,4 +419,4 @@ namespace OpenSim.Region.Environment.Scenes
m_localScenes.ForEach(action); m_localScenes.ForEach(action);
} }
} }
} }