From 641de2f40408ed8d1cbfed2d58b30e56d0f400ce Mon Sep 17 00:00:00 2001 From: Homer Horwitz Date: Wed, 15 Oct 2008 21:20:07 +0000 Subject: Check for terrain size=256x256 on "terrain load ". This fixes (the rest of) Mantis#1813. --- .../Environment/Modules/World/Terrain/TerrainModule.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'OpenSim/Region/Environment/Modules/World/Terrain') diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs index 3b8debb..c49b0b9 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs @@ -172,6 +172,13 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain try { 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_channel = channel; UpdateRevertMap(); @@ -189,6 +196,12 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain throw new TerrainException( 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(); m_log.Info("[TERRAIN]: File (" + filename + ") loaded successfully"); -- cgit v1.1