diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 70 |
1 files changed, 31 insertions, 39 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index cd5ac6c..1a3e3bb 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1460,12 +1460,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1460 | /// <param name="stats">Stats on the Simulator's performance</param> | 1460 | /// <param name="stats">Stats on the Simulator's performance</param> |
1461 | private void SendSimStatsPackets(SimStats stats) | 1461 | private void SendSimStatsPackets(SimStats stats) |
1462 | { | 1462 | { |
1463 | ForEachRootScenePresence( | 1463 | ForEachRootClient(delegate(IClientAPI client) |
1464 | delegate(ScenePresence agent) | 1464 | { |
1465 | { | 1465 | client.SendSimStats(stats); |
1466 | agent.ControllingClient.SendSimStats(stats); | 1466 | }); |
1467 | } | ||
1468 | ); | ||
1469 | } | 1467 | } |
1470 | 1468 | ||
1471 | /// <summary> | 1469 | /// <summary> |
@@ -4387,35 +4385,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
4387 | return m_sceneGraph.GetScenePresence(localID); | 4385 | return m_sceneGraph.GetScenePresence(localID); |
4388 | } | 4386 | } |
4389 | 4387 | ||
4388 | /// <summary> | ||
4389 | /// Returns true if scene presence is a child (no avatar in this scene) | ||
4390 | /// </summary> | ||
4391 | /// <param name="avatarID"></param> | ||
4392 | /// <returns></returns> | ||
4390 | public override bool PresenceChildStatus(UUID avatarID) | 4393 | public override bool PresenceChildStatus(UUID avatarID) |
4391 | { | 4394 | { |
4392 | ScenePresence cp = GetScenePresence(avatarID); | 4395 | ScenePresence sp; |
4393 | 4396 | return TryGetScenePresence(avatarID, out sp) && sp.IsChildAgent; | |
4394 | // FIXME: This is really crap - some logout code is relying on a NullReferenceException to halt its processing | ||
4395 | // This needs to be fixed properly by cleaning up the logout code. | ||
4396 | //if (cp != null) | ||
4397 | // return cp.IsChildAgent; | ||
4398 | |||
4399 | //return false; | ||
4400 | |||
4401 | return cp.IsChildAgent; | ||
4402 | } | 4397 | } |
4403 | 4398 | ||
4404 | /// <summary> | 4399 | /// <summary> |
4405 | /// Performs action on all ROOT (not child) scene presences. | 4400 | /// Performs action on all avatars in the scene (root scene presences) |
4406 | /// This is just a shortcut function since frequently actions only appy to root SPs | 4401 | /// Avatars may be an NPC or a 'real' client. |
4407 | /// </summary> | 4402 | /// </summary> |
4408 | /// <param name="action"></param> | 4403 | /// <param name="action"></param> |
4409 | public void ForEachRootScenePresence(Action<ScenePresence> action) | 4404 | public void ForEachRootScenePresence(Action<ScenePresence> action) |
4410 | { | 4405 | { |
4411 | if(m_sceneGraph != null) | 4406 | if(m_sceneGraph != null) |
4412 | { | 4407 | { |
4413 | m_sceneGraph.ForEachRootScenePresence(action); | 4408 | m_sceneGraph.ForEachAvatar(action); |
4414 | } | 4409 | } |
4415 | } | 4410 | } |
4416 | 4411 | ||
4417 | /// <summary> | 4412 | /// <summary> |
4418 | /// Performs action on all scene presences. | 4413 | /// Performs action on all scene presences (root and child) |
4419 | /// </summary> | 4414 | /// </summary> |
4420 | /// <param name="action"></param> | 4415 | /// <param name="action"></param> |
4421 | public void ForEachScenePresence(Action<ScenePresence> action) | 4416 | public void ForEachScenePresence(Action<ScenePresence> action) |
@@ -4427,25 +4422,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4427 | } | 4422 | } |
4428 | 4423 | ||
4429 | /// <summary> | 4424 | /// <summary> |
4430 | /// Perform the given action for each object | ||
4431 | /// </summary> | ||
4432 | /// <param name="action"></param> | ||
4433 | // public void ForEachObject(Action<SceneObjectGroup> action) | ||
4434 | // { | ||
4435 | // List<SceneObjectGroup> presenceList; | ||
4436 | // | ||
4437 | // lock (m_sceneObjects) | ||
4438 | // { | ||
4439 | // presenceList = new List<SceneObjectGroup>(m_sceneObjects.Values); | ||
4440 | // } | ||
4441 | // | ||
4442 | // foreach (SceneObjectGroup presence in presenceList) | ||
4443 | // { | ||
4444 | // action(presence); | ||
4445 | // } | ||
4446 | // } | ||
4447 | |||
4448 | /// <summary> | ||
4449 | /// Get a group via its UUID | 4425 | /// Get a group via its UUID |
4450 | /// </summary> | 4426 | /// </summary> |
4451 | /// <param name="fullID"></param> | 4427 | /// <param name="fullID"></param> |
@@ -4517,6 +4493,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
4517 | return m_sceneGraph.TryGetAvatarByName(avatarName, out avatar); | 4493 | return m_sceneGraph.TryGetAvatarByName(avatarName, out avatar); |
4518 | } | 4494 | } |
4519 | 4495 | ||
4496 | /// <summary> | ||
4497 | /// Perform an action on all clients with an avatar in this scene (root only) | ||
4498 | /// </summary> | ||
4499 | /// <param name="action"></param> | ||
4500 | public void ForEachRootClient(Action<IClientAPI> action) | ||
4501 | { | ||
4502 | ForEachRootScenePresence(delegate(ScenePresence presence) | ||
4503 | { | ||
4504 | action(presence.ControllingClient); | ||
4505 | }); | ||
4506 | } | ||
4507 | |||
4508 | /// <summary> | ||
4509 | /// Perform an action on all clients connected to the region (root and child) | ||
4510 | /// </summary> | ||
4511 | /// <param name="action"></param> | ||
4520 | public void ForEachClient(Action<IClientAPI> action) | 4512 | public void ForEachClient(Action<IClientAPI> action) |
4521 | { | 4513 | { |
4522 | m_clientManager.ForEachSync(action); | 4514 | m_clientManager.ForEachSync(action); |