diff options
author | Dan Lake | 2010-03-19 05:51:16 -0700 |
---|---|---|
committer | John Hurliman | 2010-03-19 15:16:35 -0700 |
commit | 859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046 (patch) | |
tree | dcce6c74d201b52c1a04ec9ec2cb90ce068fc020 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |
parent | Inconsistent locking of ScenePresence array in SceneGraph. Fixed by eliminati... (diff) | |
download | opensim-SC_OLD-859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046.zip opensim-SC_OLD-859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046.tar.gz opensim-SC_OLD-859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046.tar.bz2 opensim-SC_OLD-859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046.tar.xz |
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<ScenePresence>).
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b040ca77..3ccbb3a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -5092,7 +5092,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5092 | public LSL_Integer llGetRegionAgentCount() | 5092 | public LSL_Integer llGetRegionAgentCount() |
5093 | { | 5093 | { |
5094 | m_host.AddScriptLPS(1); | 5094 | m_host.AddScriptLPS(1); |
5095 | return new LSL_Integer(World.GetAvatars().Count); | 5095 | return new LSL_Integer(World.GetRootAgentCount()); |
5096 | } | 5096 | } |
5097 | 5097 | ||
5098 | public LSL_Vector llGetRegionCorner() | 5098 | public LSL_Vector llGetRegionCorner() |
@@ -8771,17 +8771,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8771 | landObject.SetMediaUrl(url); | 8771 | landObject.SetMediaUrl(url); |
8772 | 8772 | ||
8773 | // now send to all (non-child) agents | 8773 | // now send to all (non-child) agents |
8774 | List<ScenePresence> agents = World.GetAvatars(); | 8774 | World.ForEachScenePresence(delegate(ScenePresence sp) |
8775 | foreach (ScenePresence agent in agents) | ||
8776 | { | 8775 | { |
8777 | agent.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, | 8776 | if (!sp.IsChildAgent) |
8778 | landData.MediaID, | 8777 | { |
8779 | landData.MediaAutoScale, | 8778 | sp.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, |
8780 | mediaType, | 8779 | landData.MediaID, |
8781 | description, | 8780 | landData.MediaAutoScale, |
8782 | width, height, | 8781 | mediaType, |
8783 | loop); | 8782 | description, |
8784 | } | 8783 | width, height, |
8784 | loop); | ||
8785 | } | ||
8786 | }); | ||
8785 | } | 8787 | } |
8786 | else if (!presence.IsChildAgent) | 8788 | else if (!presence.IsChildAgent) |
8787 | { | 8789 | { |
@@ -8802,13 +8804,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8802 | if (presence == null) | 8804 | if (presence == null) |
8803 | { | 8805 | { |
8804 | // send to all (non-child) agents | 8806 | // send to all (non-child) agents |
8805 | List<ScenePresence> agents = World.GetAvatars(); | 8807 | World.ForEachScenePresence(delegate(ScenePresence sp) |
8806 | foreach (ScenePresence agent in agents) | ||
8807 | { | 8808 | { |
8808 | agent.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this? | 8809 | if (!sp.IsChildAgent) |
8809 | (ParcelMediaCommandEnum)commandToSend, | 8810 | { |
8810 | time); | 8811 | sp.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this? |
8811 | } | 8812 | (ParcelMediaCommandEnum)commandToSend, |
8813 | time); | ||
8814 | } | ||
8815 | }); | ||
8812 | } | 8816 | } |
8813 | else if (!presence.IsChildAgent) | 8817 | else if (!presence.IsChildAgent) |
8814 | { | 8818 | { |