Added new ForEachRootScenePresence to Scene since almost every delegate passed to ForEachScenePresence checks for !IsChildAgent first. It consolidates child and root handling for coming refactors.

This commit is contained in:
Dan Lake
2011-10-27 00:42:21 -07:00
parent 40bee97015
commit b98613091c
14 changed files with 78 additions and 87 deletions

View File

@@ -279,12 +279,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
HashSet<UUID> receiverIDs = new HashSet<UUID>();
((Scene)c.Scene).ForEachScenePresence(
((Scene)c.Scene).ForEachRootScenePresence(
delegate(ScenePresence presence)
{
// ignore chat from child agents
if (presence.IsChildAgent) return;
{
IClientAPI client = presence.ControllingClient;
// don't forward SayOwner chat from objects to

View File

@@ -140,10 +140,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
// This is a bit crude. It seems the client will be null before it actually stops the thread
// The thread will kill itself eventually :/
// Is there another way to make sure *all* clients get this 'inter region' message?
m_scene.ForEachScenePresence(
m_scene.ForEachRootScenePresence(
delegate(ScenePresence p)
{
if (p.UUID != godID && !p.IsChildAgent)
if (p.UUID != godID)
{
// Possibly this should really be p.Close() though that method doesn't send a close
// to the client

View File

@@ -658,17 +658,15 @@ namespace OpenSim.Region.CoreModules.World.Estate
if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false))
return;
Scene.ForEachScenePresence(delegate(ScenePresence sp)
Scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{
if (sp.UUID != senderID)
{
ScenePresence p = Scene.GetScenePresence(sp.UUID);
// make sure they are still there, we could be working down a long list
// Also make sure they are actually in the region
if (p != null && !p.IsChildAgent)
{
ScenePresence p;
if(Scene.TryGetScenePresence(sp.UUID, out p))
Scene.TeleportClientHome(p.UUID, p.ControllingClient);
}
}
});
}
@@ -929,10 +927,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
public void sendRegionInfoPacketToAll()
{
Scene.ForEachScenePresence(delegate(ScenePresence sp)
Scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{
if (!sp.IsChildAgent)
HandleRegionInfoRequest(sp.ControllingClient);
HandleRegionInfoRequest(sp.ControllingClient);
});
}

View File

@@ -476,11 +476,8 @@ namespace OpenSim.Region.CoreModules.World.Land
public void SendLandUpdateToAvatarsOverMe(bool snap_selection)
{
m_scene.ForEachScenePresence(delegate(ScenePresence avatar)
m_scene.ForEachRootScenePresence(delegate(ScenePresence avatar)
{
if (avatar.IsChildAgent)
return;
ILandObject over = null;
try
{

View File

@@ -70,11 +70,8 @@ namespace OpenSim.Region.CoreModules.World.Sound
SceneObjectGroup grp = part.ParentGroup;
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{
if (sp.IsChildAgent)
return;
double dis = Util.GetDistanceTo(sp.AbsolutePosition, position);
if (dis > 100.0) // Max audio distance
return;
@@ -122,11 +119,8 @@ namespace OpenSim.Region.CoreModules.World.Sound
}
}
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{
if (sp.IsChildAgent)
return;
double dis = Util.GetDistanceTo(sp.AbsolutePosition, position);
if (dis > 100.0) // Max audio distance
return;

View File

@@ -488,12 +488,9 @@ namespace OpenSim.Region.CoreModules
private void SunUpdateToAllClients()
{
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{
if (!sp.IsChildAgent)
{
SunToClient(sp.ControllingClient);
}
});
}

View File

@@ -435,10 +435,9 @@ namespace OpenSim.Region.CoreModules
m_frameLastUpdateClientArray = m_frame;
}
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{
if (!sp.IsChildAgent)
sp.ControllingClient.SendWindData(windSpeeds);
sp.ControllingClient.SendWindData(windSpeeds);
});
}
}

View File

@@ -401,10 +401,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
}
else
{
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{
// Don't send a green dot for yourself
if (!sp.IsChildAgent && sp.UUID != remoteClient.AgentId)
if (sp.UUID != remoteClient.AgentId)
{
mapitem = new mapItemReply();
mapitem.x = (uint)(xstart + sp.AbsolutePosition.X);