From ac77c50ba9efb7755bd36e832a9a93fb25946a5f Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 28 Nov 2007 12:36:09 +0000 Subject: Moved the m_sceneGridService.RegisterRegion(RegionInfo); call out of LoadWorldMap and into its own public method (which is called during region creation). We shouldn't have things like that in methods like LoadWorldMap as some regions might not being having a worldmap loaded via the LoadWorldMap method (like in custom applications). Deleted the CreateTerrainTextureInitial Method which was a 99% duplicate of CreateTerrainTexture, with just a bool field setting difference. That bool is now passed to CreateTerrainTexture as a param. --- OpenSim/Region/Environment/Scenes/Scene.cs | 51 +++++++++++++----------------- 1 file changed, 22 insertions(+), 29 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index ef08486..68af360 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -258,8 +258,6 @@ namespace OpenSim.Region.Environment.Scenes httpListener = httpServer; m_dumpAssetsToFile = dumpAssetsToFile; - // This function was moved to terrain for some kind of map hack by babble - RegisterRegionWithComms(); } #endregion @@ -291,6 +289,7 @@ namespace OpenSim.Region.Environment.Scenes } return true; } + public virtual void Restart(float seconds) { if (seconds < 15) @@ -312,6 +311,7 @@ namespace OpenSim.Region.Environment.Scenes } + public void restartTimer_Elapsed(object sender, ElapsedEventArgs e) { m_RestartTimerCounter++; @@ -328,6 +328,7 @@ namespace OpenSim.Region.Environment.Scenes } } + public void restartNOW() { MainLog.Instance.Error("REGION", "Closing"); @@ -335,6 +336,7 @@ namespace OpenSim.Region.Environment.Scenes MainLog.Instance.Error("REGION", "Firing Region Restart Message"); base.Restart(0); } + public void restart_Notify_Wait_Elapsed(object sender, ElapsedEventArgs e) { m_restartWaitTimer.Stop(); @@ -363,6 +365,7 @@ namespace OpenSim.Region.Environment.Scenes // Reset list to nothing. m_regionRestartNotifyList = new List(); } + public override void Close() { ForEachScenePresence(delegate(ScenePresence avatar) @@ -534,7 +537,7 @@ namespace OpenSim.Region.Environment.Scenes { if (Terrain.Tainted() && !Terrain.StillEditing()) { - CreateTerrainTexture(); + CreateTerrainTexture(true); lock (Terrain.heightmap) { @@ -683,12 +686,9 @@ namespace OpenSim.Region.Environment.Scenes Terrain.SetHeights2D(map); } - CreateTerrainTextureInitial(); + CreateTerrainTexture(false); //CommsManager.GridService.RegisterRegion(RegionInfo); //hack to update the terrain texture in grid mode so it shows on world map - - // These two 'commands' *must be* next to each other or sim rebooting fails. - m_sceneGridService.RegisterRegion(RegionInfo); - m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo); + } catch (Exception e) { @@ -696,10 +696,18 @@ namespace OpenSim.Region.Environment.Scenes } } + public void RegisterRegionWithGrid() + { + RegisterCommsEvents(); + // These two 'commands' *must be* next to each other or sim rebooting fails. + m_sceneGridService.RegisterRegion(RegionInfo); + m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo); + } + /// /// /// - public void CreateTerrainTexture() + public void CreateTerrainTexture(bool temporary) { //create a texture asset of the terrain byte[] data = Terrain.ExportJpegImage("defaultstripe.png"); @@ -710,24 +718,11 @@ namespace OpenSim.Region.Environment.Scenes asset.Name = "terrainImage"; asset.Description = RegionInfo.RegionName; asset.Type = 0; - asset.Temporary = true; + asset.Temporary = temporary; AssetCache.AddAsset(asset); } - public void CreateTerrainTextureInitial() - { - //create a texture asset of the terrain - byte[] data = Terrain.ExportJpegImage("defaultstripe.png"); - m_regInfo.EstateSettings.terrainImageID = LLUUID.Random(); - AssetBase asset = new AssetBase(); - asset.FullID = m_regInfo.EstateSettings.terrainImageID; - asset.Data = data; - asset.Name = "terrainImage"; - asset.Description = RegionInfo.RegionName; - asset.Type = 0; - asset.Temporary = false; - AssetCache.AddAsset(asset); - } + #endregion #region Primitives Methods @@ -1117,7 +1112,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void RegisterRegionWithComms() + public void RegisterCommsEvents() { // Don't register here. babblefro moved registration to *after *the map // functions on line 675 so that a proper map will generate and get sent to grid services @@ -1129,11 +1124,9 @@ namespace OpenSim.Region.Environment.Scenes m_sceneGridService.OnCloseAgentConnection += CloseConnection; m_sceneGridService.OnRegionUp += OtherRegionUp; - m_sceneGridService.KillObject = SendKillObject; - - // Tell Other regions that I'm here. - + m_sceneGridService.KillObject = SendKillObject; } + public void UnRegisterReginWithComms() { m_sceneGridService.OnRegionUp -= OtherRegionUp; -- cgit v1.1