Check for terrain size=256x256 on "terrain load <file>". This fixes

(the rest of) Mantis#1813.
0.6.0-stable
Homer Horwitz 2008-10-15 21:20:07 +00:00
parent ceb5830142
commit 641de2f404
1 changed files with 13 additions and 0 deletions

View File

@ -172,6 +172,13 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
try try
{ {
ITerrainChannel channel = loader.Value.LoadFile(filename); ITerrainChannel channel = loader.Value.LoadFile(filename);
if (channel.Width != Constants.RegionSize || channel.Height != Constants.RegionSize)
{
// TerrainChannel expects a RegionSize x RegionSize map, currently
throw new ArgumentException(String.Format("wrong size, use a file with size {0} x {1}",
Constants.RegionSize, Constants.RegionSize));
}
m_log.DebugFormat("[TERRAIN]: Loaded terrain, wd/ht: {0}/{1}", channel.Width, channel.Height);
m_scene.Heightmap = channel; m_scene.Heightmap = channel;
m_channel = channel; m_channel = channel;
UpdateRevertMap(); UpdateRevertMap();
@ -189,6 +196,12 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
throw new TerrainException( throw new TerrainException(
String.Format("unable to load heightmap: file {0} not found (or permissions do not allow access", filename)); String.Format("unable to load heightmap: file {0} not found (or permissions do not allow access", filename));
} }
catch (ArgumentException e)
{
m_log.ErrorFormat("[TERRAIN]: Unable to load heightmap: {0}", e.Message);
throw new TerrainException(
String.Format("Unable to load heightmap: {0}", e.Message));
}
} }
CheckForTerrainUpdates(); CheckForTerrainUpdates();
m_log.Info("[TERRAIN]: File (" + filename + ") loaded successfully"); m_log.Info("[TERRAIN]: File (" + filename + ") loaded successfully");