diff options
author | Oren Hurvitz | 2011-07-22 11:33:00 +0300 |
---|---|---|
committer | root | 2011-07-22 09:52:21 +0100 |
commit | 02e54c57c4901167779f07ed3e89fb1d24ffc22a (patch) | |
tree | e06988193f858b7a088d048131a1f7cf9ccc8885 | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC_OLD-02e54c57c4901167779f07ed3e89fb1d24ffc22a.zip opensim-SC_OLD-02e54c57c4901167779f07ed3e89fb1d24ffc22a.tar.gz opensim-SC_OLD-02e54c57c4901167779f07ed3e89fb1d24ffc22a.tar.bz2 opensim-SC_OLD-02e54c57c4901167779f07ed3e89fb1d24ffc22a.tar.xz |
Generate the initial maptile asynchronously
Signed-off-by: Melanie <melanie@t-data.com>
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 22 |
2 files changed, 17 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 6e142bb..fac2dab 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1110,14 +1110,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1110 | if (data == null) | 1110 | if (data == null) |
1111 | return; | 1111 | return; |
1112 | 1112 | ||
1113 | UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID; | ||
1114 | |||
1115 | m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE"); | 1113 | m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE"); |
1116 | 1114 | ||
1117 | m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random(); | 1115 | UUID terrainImageID = UUID.Random(); |
1118 | 1116 | ||
1119 | AssetBase asset = new AssetBase( | 1117 | AssetBase asset = new AssetBase( |
1120 | m_scene.RegionInfo.RegionSettings.TerrainImageID, | 1118 | terrainImageID, |
1121 | "terrainImage_" + m_scene.RegionInfo.RegionID.ToString(), | 1119 | "terrainImage_" + m_scene.RegionInfo.RegionID.ToString(), |
1122 | (sbyte)AssetType.Texture, | 1120 | (sbyte)AssetType.Texture, |
1123 | m_scene.RegionInfo.RegionID.ToString()); | 1121 | m_scene.RegionInfo.RegionID.ToString()); |
@@ -1129,6 +1127,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1129 | // Store the new one | 1127 | // Store the new one |
1130 | m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID); | 1128 | m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID); |
1131 | m_scene.AssetService.Store(asset); | 1129 | m_scene.AssetService.Store(asset); |
1130 | |||
1131 | // Switch to the new one | ||
1132 | UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID; | ||
1133 | m_scene.RegionInfo.RegionSettings.TerrainImageID = terrainImageID; | ||
1132 | m_scene.RegionInfo.RegionSettings.Save(); | 1134 | m_scene.RegionInfo.RegionSettings.Save(); |
1133 | 1135 | ||
1134 | // Delete the old one | 1136 | // Delete the old one |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6e66632..32a2887 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1672,20 +1672,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1672 | 1672 | ||
1673 | m_sceneGridService.SetScene(this); | 1673 | m_sceneGridService.SetScene(this); |
1674 | 1674 | ||
1675 | // If we generate maptiles internally at all, the maptile generator | 1675 | GridRegion region = new GridRegion(RegionInfo); |
1676 | // will register the region. If not, do it here | 1676 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); |
1677 | if (m_generateMaptiles) | 1677 | if (error != String.Empty) |
1678 | { | 1678 | { |
1679 | RegenerateMaptile(null, null); | 1679 | throw new Exception(error); |
1680 | } | 1680 | } |
1681 | else | 1681 | |
1682 | // Generate the maptile asynchronously, because sometimes it can be very slow and we | ||
1683 | // don't want this to delay starting the region. | ||
1684 | if (m_generateMaptiles) | ||
1682 | { | 1685 | { |
1683 | GridRegion region = new GridRegion(RegionInfo); | 1686 | Util.FireAndForget(delegate { |
1684 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); | 1687 | RegenerateMaptile(null, null); |
1685 | if (error != String.Empty) | 1688 | }); |
1686 | { | ||
1687 | throw new Exception(error); | ||
1688 | } | ||
1689 | } | 1689 | } |
1690 | } | 1690 | } |
1691 | 1691 | ||