From 7c95bfcbee14e4cb589fe7719ac2e18a34468ce5 Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 6 Dec 2008 10:55:18 -0600 Subject: *Fix a bug that GetHeight causes crash. --HG-- branch : trunk --- src/game/Map.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 6c693bfe177..6e12597f4dd 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1137,6 +1137,10 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps) const int lx_int = (int)lx; int ly_int = (int)ly; + // In some very rare case this will happen. Need find a better way. + if(lx_int == MAP_RESOLUTION) --lx_int; + if(ly_int == MAP_RESOLUTION) --ly_int; + float zi[4]; // Probe 4 nearest points (except border cases) zi[0] = gmap->Z[lx_int][ly_int]; -- cgit v1.2.3