From 859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Fri, 19 Mar 2010 05:51:16 -0700 Subject: Cleaned up access to scenepresences in scenegraph. GetScenePresences and GetAvatars have been removed to consolidate locking and iteration within SceneGraph. All callers which used these to then iterate over presences have been refactored to instead pass their delegates to Scene.ForEachScenePresence(Action). --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0e21487..88bdf31 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1321,11 +1321,11 @@ namespace OpenSim.Region.Framework.Scenes if (volume < 0) volume = 0; - List avatarts = m_parentGroup.Scene.GetAvatars(); - foreach (ScenePresence p in avatarts) + m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) { - p.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); - } + if(!sp.IsChildAgent) + sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); + }); } /// @@ -2609,12 +2609,13 @@ namespace OpenSim.Region.Framework.Scenes } } - List avatarts = m_parentGroup.Scene.GetAvatars(); - foreach (ScenePresence p in avatarts) + m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) { - if (!(Util.GetDistanceTo(p.AbsolutePosition, AbsolutePosition) >= 100)) - p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); - } + if (sp.IsChildAgent) + return; + if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100)) + sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); + }); } public void RemFlag(PrimFlags flag) -- cgit v1.1 From 62e0b53ca4697a852ee1e36e86da6a32e93bd55e Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Fri, 19 Mar 2010 05:58:34 -0700 Subject: Renamed TryGetAvatar to TryGetScenePresence on SceneManager, SceneBase, Scene and SceneGraph. This was the only change in this patch to keep it isolated from other recent changes to the same set of files. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 88bdf31..46eadee 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -680,7 +680,7 @@ namespace OpenSim.Region.Framework.Scenes if (m_parentGroup != null) // TODO can there be a SOP without a SOG? { ScenePresence avatar; - if (m_parentGroup.Scene.TryGetAvatar(m_sitTargetAvatar, out avatar)) + if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar)) { avatar.ParentPosition = GetWorldPosition(); } -- cgit v1.1