From c9eb051936ee8e3a6885c8e4614a7d381cb34314 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 6 Mar 2008 23:14:24 +0000 Subject: * Fix for exception in landmanager crash. --- OpenSim/Region/Environment/LandManagement/Land.cs | 17 +++++++++++++++-- .../Region/Environment/Modules/Terrain/TerrainModule.cs | 2 -- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs index 4c6168d..1eadccb 100644 --- a/OpenSim/Region/Environment/LandManagement/Land.cs +++ b/OpenSim/Region/Environment/LandManagement/Land.cs @@ -439,12 +439,25 @@ namespace OpenSim.Region.Environment.LandManagement } } } + int tx = min_x * 4; + if (tx > 255) + tx = 255; + int ty = min_y * 4; + if (ty > 255) + ty = 255; landData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), - (float)m_scene.Heightmap[(min_x * 4), (min_y * 4)]); + (float)m_scene.Heightmap[tx, ty]); + + tx = max_x * 4; + if (tx > 255) + tx = 255; + ty = max_y * 4; + if (ty > 255) + ty = 255; landData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), - (float)m_scene.Heightmap[(max_x * 4), (max_y * 4)]); + (float)m_scene.Heightmap[tx, ty]); landData.area = tempArea; } diff --git a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs index 7ab1e2b..ed3d28a 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs @@ -269,8 +269,6 @@ namespace OpenSim.Region.Environment.Modules.Terrain m_tainted = false; m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised()); m_scene.SaveTerrain(); - - //m_scene.CreateTerrainTexture(true); } } -- cgit v1.1