From 94dc7d07ebc22ce0e0d9b77e91538ddc90799bee Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Thu, 3 Nov 2011 17:06:08 -0700 Subject: Renamed ForEachRootScenePresence to ForEachAvatar. Cleaned up calls to the 3 iteration functions so more of them are using the correct iteration for the action they are performing. The 3 iterators that seem to fit all actions within OpenSim at this time are: ForEachAvatar: Perform an action on all avatars (root presences) ForEachClient: Perform an action on all clients (root or child clients) ForEachRootClient: Perform an action on all clients that have an avatar There are still a dozen places or so calling the old ForEachScenePresence that will take a little more refactoring to eliminate. --- .../CoreModules/LightShare/LightShareModule.cs | 49 +++++++--------------- 1 file changed, 15 insertions(+), 34 deletions(-) (limited to 'OpenSim/Region/CoreModules/LightShare') diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs index 2de8d7a..cabbd31 100644 --- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs +++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs @@ -145,57 +145,38 @@ namespace OpenSim.Region.CoreModules.World.LightShare param.Add(mBlock); return param; } - public void SendProfileToClient(ScenePresence presence) + + public void SendProfileToClient(IClientAPI client) { - IClientAPI client = presence.ControllingClient; - if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) - { - if (presence.IsChildAgent == false) - { - List param = compileWindlightSettings(m_scene.RegionInfo.WindlightSettings); - client.SendGenericMessage("Windlight", param); - } - } - else - { - //We probably don't want to spam chat with this.. probably - //m_log.Debug("[WINDLIGHT]: Module disabled"); - } + SendProfileToClient(client, m_scene.RegionInfo.WindlightSettings); } - public void SendProfileToClient(ScenePresence presence, RegionLightShareData wl) + + public void SendProfileToClient(IClientAPI client, RegionLightShareData wl) { - IClientAPI client = presence.ControllingClient; if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) { - if (presence.IsChildAgent == false) - { - List param = compileWindlightSettings(wl); - client.SendGenericMessage("Windlight", param); - } - } - else - { - //We probably don't want to spam chat with this.. probably - //m_log.Debug("[WINDLIGHT]: Module disabled"); + List param = compileWindlightSettings(wl); + client.SendGenericMessage("Windlight", param); } } + private void EventManager_OnMakeRootAgent(ScenePresence presence) { m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client"); - SendProfileToClient(presence); + SendProfileToClient(presence.ControllingClient); } + private void EventManager_OnSendNewWindlightProfileTargeted(RegionLightShareData wl, UUID pUUID) { - ScenePresence Sc; - if (m_scene.TryGetScenePresence(pUUID,out Sc)) - { - SendProfileToClient(Sc,wl); - } + IClientAPI client; + m_scene.TryGetClient(pUUID, out client); + SendProfileToClient(client, wl); } + private void EventManager_OnSaveNewWindlightProfile() { if (m_scene.RegionInfo.WindlightSettings.valid) - m_scene.ForEachScenePresence(SendProfileToClient); + m_scene.ForEachRootClient(SendProfileToClient); } public void PostInitialise() -- cgit v1.1