diff options
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.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 51 |
1 files changed, 22 insertions, 29 deletions
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 | |||
258 | httpListener = httpServer; | 258 | httpListener = httpServer; |
259 | m_dumpAssetsToFile = dumpAssetsToFile; | 259 | m_dumpAssetsToFile = dumpAssetsToFile; |
260 | 260 | ||
261 | // This function was moved to terrain for some kind of map hack by babble | ||
262 | RegisterRegionWithComms(); | ||
263 | } | 261 | } |
264 | 262 | ||
265 | #endregion | 263 | #endregion |
@@ -291,6 +289,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
291 | } | 289 | } |
292 | return true; | 290 | return true; |
293 | } | 291 | } |
292 | |||
294 | public virtual void Restart(float seconds) | 293 | public virtual void Restart(float seconds) |
295 | { | 294 | { |
296 | if (seconds < 15) | 295 | if (seconds < 15) |
@@ -312,6 +311,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
312 | 311 | ||
313 | 312 | ||
314 | } | 313 | } |
314 | |||
315 | public void restartTimer_Elapsed(object sender, ElapsedEventArgs e) | 315 | public void restartTimer_Elapsed(object sender, ElapsedEventArgs e) |
316 | { | 316 | { |
317 | m_RestartTimerCounter++; | 317 | m_RestartTimerCounter++; |
@@ -328,6 +328,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
328 | } | 328 | } |
329 | 329 | ||
330 | } | 330 | } |
331 | |||
331 | public void restartNOW() | 332 | public void restartNOW() |
332 | { | 333 | { |
333 | MainLog.Instance.Error("REGION", "Closing"); | 334 | MainLog.Instance.Error("REGION", "Closing"); |
@@ -335,6 +336,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
335 | MainLog.Instance.Error("REGION", "Firing Region Restart Message"); | 336 | MainLog.Instance.Error("REGION", "Firing Region Restart Message"); |
336 | base.Restart(0); | 337 | base.Restart(0); |
337 | } | 338 | } |
339 | |||
338 | public void restart_Notify_Wait_Elapsed(object sender, ElapsedEventArgs e) | 340 | public void restart_Notify_Wait_Elapsed(object sender, ElapsedEventArgs e) |
339 | { | 341 | { |
340 | m_restartWaitTimer.Stop(); | 342 | m_restartWaitTimer.Stop(); |
@@ -363,6 +365,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
363 | // Reset list to nothing. | 365 | // Reset list to nothing. |
364 | m_regionRestartNotifyList = new List<RegionInfo>(); | 366 | m_regionRestartNotifyList = new List<RegionInfo>(); |
365 | } | 367 | } |
368 | |||
366 | public override void Close() | 369 | public override void Close() |
367 | { | 370 | { |
368 | ForEachScenePresence(delegate(ScenePresence avatar) | 371 | ForEachScenePresence(delegate(ScenePresence avatar) |
@@ -534,7 +537,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
534 | { | 537 | { |
535 | if (Terrain.Tainted() && !Terrain.StillEditing()) | 538 | if (Terrain.Tainted() && !Terrain.StillEditing()) |
536 | { | 539 | { |
537 | CreateTerrainTexture(); | 540 | CreateTerrainTexture(true); |
538 | 541 | ||
539 | lock (Terrain.heightmap) | 542 | lock (Terrain.heightmap) |
540 | { | 543 | { |
@@ -683,12 +686,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
683 | Terrain.SetHeights2D(map); | 686 | Terrain.SetHeights2D(map); |
684 | } | 687 | } |
685 | 688 | ||
686 | CreateTerrainTextureInitial(); | 689 | CreateTerrainTexture(false); |
687 | //CommsManager.GridService.RegisterRegion(RegionInfo); //hack to update the terrain texture in grid mode so it shows on world map | 690 | //CommsManager.GridService.RegisterRegion(RegionInfo); //hack to update the terrain texture in grid mode so it shows on world map |
688 | 691 | ||
689 | // These two 'commands' *must be* next to each other or sim rebooting fails. | ||
690 | m_sceneGridService.RegisterRegion(RegionInfo); | ||
691 | m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo); | ||
692 | } | 692 | } |
693 | catch (Exception e) | 693 | catch (Exception e) |
694 | { | 694 | { |
@@ -696,10 +696,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
696 | } | 696 | } |
697 | } | 697 | } |
698 | 698 | ||
699 | public void RegisterRegionWithGrid() | ||
700 | { | ||
701 | RegisterCommsEvents(); | ||
702 | // These two 'commands' *must be* next to each other or sim rebooting fails. | ||
703 | m_sceneGridService.RegisterRegion(RegionInfo); | ||
704 | m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo); | ||
705 | } | ||
706 | |||
699 | /// <summary> | 707 | /// <summary> |
700 | /// | 708 | /// |
701 | /// </summary> | 709 | /// </summary> |
702 | public void CreateTerrainTexture() | 710 | public void CreateTerrainTexture(bool temporary) |
703 | { | 711 | { |
704 | //create a texture asset of the terrain | 712 | //create a texture asset of the terrain |
705 | byte[] data = Terrain.ExportJpegImage("defaultstripe.png"); | 713 | byte[] data = Terrain.ExportJpegImage("defaultstripe.png"); |
@@ -710,24 +718,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
710 | asset.Name = "terrainImage"; | 718 | asset.Name = "terrainImage"; |
711 | asset.Description = RegionInfo.RegionName; | 719 | asset.Description = RegionInfo.RegionName; |
712 | asset.Type = 0; | 720 | asset.Type = 0; |
713 | asset.Temporary = true; | 721 | asset.Temporary = temporary; |
714 | AssetCache.AddAsset(asset); | 722 | AssetCache.AddAsset(asset); |
715 | } | 723 | } |
716 | 724 | ||
717 | public void CreateTerrainTextureInitial() | 725 | |
718 | { | ||
719 | //create a texture asset of the terrain | ||
720 | byte[] data = Terrain.ExportJpegImage("defaultstripe.png"); | ||
721 | m_regInfo.EstateSettings.terrainImageID = LLUUID.Random(); | ||
722 | AssetBase asset = new AssetBase(); | ||
723 | asset.FullID = m_regInfo.EstateSettings.terrainImageID; | ||
724 | asset.Data = data; | ||
725 | asset.Name = "terrainImage"; | ||
726 | asset.Description = RegionInfo.RegionName; | ||
727 | asset.Type = 0; | ||
728 | asset.Temporary = false; | ||
729 | AssetCache.AddAsset(asset); | ||
730 | } | ||
731 | #endregion | 726 | #endregion |
732 | 727 | ||
733 | #region Primitives Methods | 728 | #region Primitives Methods |
@@ -1117,7 +1112,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1117 | /// <summary> | 1112 | /// <summary> |
1118 | /// | 1113 | /// |
1119 | /// </summary> | 1114 | /// </summary> |
1120 | public void RegisterRegionWithComms() | 1115 | public void RegisterCommsEvents() |
1121 | { | 1116 | { |
1122 | // Don't register here. babblefro moved registration to *after *the map | 1117 | // Don't register here. babblefro moved registration to *after *the map |
1123 | // functions on line 675 so that a proper map will generate and get sent to grid services | 1118 | // 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 | |||
1129 | m_sceneGridService.OnCloseAgentConnection += CloseConnection; | 1124 | m_sceneGridService.OnCloseAgentConnection += CloseConnection; |
1130 | m_sceneGridService.OnRegionUp += OtherRegionUp; | 1125 | m_sceneGridService.OnRegionUp += OtherRegionUp; |
1131 | 1126 | ||
1132 | m_sceneGridService.KillObject = SendKillObject; | 1127 | m_sceneGridService.KillObject = SendKillObject; |
1133 | |||
1134 | // Tell Other regions that I'm here. | ||
1135 | |||
1136 | } | 1128 | } |
1129 | |||
1137 | public void UnRegisterReginWithComms() | 1130 | public void UnRegisterReginWithComms() |
1138 | { | 1131 | { |
1139 | m_sceneGridService.OnRegionUp -= OtherRegionUp; | 1132 | m_sceneGridService.OnRegionUp -= OtherRegionUp; |