From 6460e587c470361173291337ad222f48c13a10ce Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 18 Jul 2012 21:29:12 +0100 Subject: Pass entire scene object in OnLoginsEnabled event rather than just the region name. This saves listeners from having to re-retrieve the scene from their own lists, which won't work anyway if multiple regions with the same name have been allowed --- .../MapImage/MapImageServiceModule.cs | 13 ++---------- OpenSim/Region/Framework/Scenes/EventManager.cs | 7 +++---- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- .../RegionReadyModule/RegionReadyModule.cs | 24 ++++++++++++++-------- 4 files changed, 22 insertions(+), 24 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs index 322a9f8..9033460 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs @@ -164,20 +164,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage #endregion ISharedRegionModule - void OnLoginsEnabled(string regionName) + void OnLoginsEnabled(IScene scene) { - Scene scene = null; - foreach (Scene s in m_scenes.Values) - if (s.RegionInfo.RegionName == regionName) - { - scene = s; - break; - } - if (scene != null) - UploadMapTile(scene); + UploadMapTile(scene); } - /// /// /// diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index f92ed8e..e2380b7 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -496,14 +496,13 @@ namespace OpenSim.Region.Framework.Scenes public delegate void RegionHeartbeatEnd(Scene scene); public event RegionHeartbeatEnd OnRegionHeartbeatEnd; - public delegate void LoginsEnabled(string regionName); - /// /// This should only fire in all circumstances if the RegionReady module is active. /// /// /// TODO: Fire this even when the RegionReady module is not active. /// + public delegate void LoginsEnabled(IScene scene); public event LoginsEnabled OnLoginsEnabled; public delegate void PrimsLoaded(Scene s); @@ -2477,7 +2476,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerLoginsEnabled (string regionName) + public void TriggerLoginsEnabled(Scene scene) { LoginsEnabled handler = OnLoginsEnabled; @@ -2487,7 +2486,7 @@ namespace OpenSim.Region.Framework.Scenes { try { - d(regionName); + d(scene); } catch (Exception e) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index de2b192..8a28ee4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1493,7 +1493,7 @@ namespace OpenSim.Region.Framework.Scenes { // need to be able to tell these have changed in RegionReady LoginLock = false; - EventManager.TriggerLoginsEnabled(RegionInfo.RegionName); + EventManager.TriggerLoginsEnabled(this); } // For RegionReady lockouts diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index aeab61c..29515de 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady private bool m_disable_logins; private string m_uri = string.Empty; - Scene m_scene = null; + Scene m_scene; #region INonSharedRegionModule interface @@ -192,7 +192,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady m_scene.RegionInfo.RegionName, c.Message, m_channelNotify); m_scene.EventManager.TriggerOnChatBroadcast(this, c); - m_scene.EventManager.TriggerLoginsEnabled(m_scene.RegionInfo.RegionName); + m_scene.EventManager.TriggerLoginsEnabled(m_scene); m_scene.SceneGridService.InformNeighborsThatRegionisUp(m_scene.RequestModuleInterface(), m_scene.RegionInfo); } } @@ -200,20 +200,28 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady void OnOarFileLoaded(Guid requestId, string message) { m_oarFileLoading = true; + if (message==String.Empty) { m_lastOarLoadedOk = true; - } else { + } + else + { m_log.WarnFormat("[RegionReady]: Oar file load errors: {0}", message); m_lastOarLoadedOk = false; } } - // This will be triggerd by Scene if we have no scripts - // m_ScriptsRezzing will be false if there were none - // else it will be true and we should wait on the - // empty compile queue - void OnLoginsEnabled(string regionName) + /// + /// This will be triggered by Scene directly if it contains no scripts on startup. + /// + /// + /// m_ScriptsRezzing will be false if there were none + /// else it will be true and we should wait on the + /// empty compile queue + /// + /// + void OnLoginsEnabled(IScene scene) { if (m_scene.StartDisabled == false) { -- cgit v1.1