Add "generate map" console command to allow manual regeneration and storage of maptiles

Primarily for test purposes though could be useful if one prefers to manually update the map tile
0.7.6-extended
Justin Clark-Casey (justincc) 2014-01-23 23:44:21 +00:00
parent 27abe040bd
commit 099975dec2
2 changed files with 19 additions and 1 deletions

View File

@ -127,8 +127,11 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
try try
{ {
using (Bitmap mapbmp = CreateMapTile()) using (Bitmap mapbmp = CreateMapTile())
{
if (mapbmp != null)
return OpenJPEG.EncodeFromImage(mapbmp, true); return OpenJPEG.EncodeFromImage(mapbmp, true);
} }
}
catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke
{ {
m_log.Error("Failed generating terrain map: " + e); m_log.Error("Failed generating terrain map: " + e);

View File

@ -114,6 +114,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
"export-map [<path>]", "export-map [<path>]",
"Save an image of the world map", HandleExportWorldMapConsoleCommand); "Save an image of the world map", HandleExportWorldMapConsoleCommand);
m_scene.AddCommand(
"Regions", this, "generate map",
"generate map",
"Generates and stores a new maptile.", HandleGenerateMapConsoleCommand);
AddHandlers(); AddHandlers();
} }
} }
@ -1255,6 +1260,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
m_scene.RegionInfo.RegionName, exportPath); m_scene.RegionInfo.RegionName, exportPath);
} }
public void HandleGenerateMapConsoleCommand(string module, string[] cmdparams)
{
Scene consoleScene = m_scene.ConsoleScene();
if (consoleScene != null && consoleScene != m_scene)
return;
GenerateMaptile();
}
public OSD HandleRemoteMapItemRequest(string path, OSD request, string endpoint) public OSD HandleRemoteMapItemRequest(string path, OSD request, string endpoint)
{ {
uint xstart = 0; uint xstart = 0;