Generate the initial maptile asynchronously

Signed-off-by: Melanie <melanie@t-data.com>
bulletsim
Oren Hurvitz 2011-07-22 11:33:00 +03:00 committed by root
parent d8228f4374
commit 02e54c57c4
2 changed files with 18 additions and 16 deletions

View File

@ -1110,14 +1110,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
if (data == null) if (data == null)
return; return;
UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID;
m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE"); m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE");
m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random(); UUID terrainImageID = UUID.Random();
AssetBase asset = new AssetBase( AssetBase asset = new AssetBase(
m_scene.RegionInfo.RegionSettings.TerrainImageID, terrainImageID,
"terrainImage_" + m_scene.RegionInfo.RegionID.ToString(), "terrainImage_" + m_scene.RegionInfo.RegionID.ToString(),
(sbyte)AssetType.Texture, (sbyte)AssetType.Texture,
m_scene.RegionInfo.RegionID.ToString()); m_scene.RegionInfo.RegionID.ToString());
@ -1129,6 +1127,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
// Store the new one // Store the new one
m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID); m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID);
m_scene.AssetService.Store(asset); m_scene.AssetService.Store(asset);
// Switch to the new one
UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID;
m_scene.RegionInfo.RegionSettings.TerrainImageID = terrainImageID;
m_scene.RegionInfo.RegionSettings.Save(); m_scene.RegionInfo.RegionSettings.Save();
// Delete the old one // Delete the old one

View File

@ -1672,20 +1672,20 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGridService.SetScene(this); m_sceneGridService.SetScene(this);
// If we generate maptiles internally at all, the maptile generator GridRegion region = new GridRegion(RegionInfo);
// will register the region. If not, do it here string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
if (error != String.Empty)
{
throw new Exception(error);
}
// Generate the maptile asynchronously, because sometimes it can be very slow and we
// don't want this to delay starting the region.
if (m_generateMaptiles) if (m_generateMaptiles)
{ {
RegenerateMaptile(null, null); Util.FireAndForget(delegate {
} RegenerateMaptile(null, null);
else });
{
GridRegion region = new GridRegion(RegionInfo);
string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
if (error != String.Empty)
{
throw new Exception(error);
}
} }
} }