aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormegamage <none@none>2008-12-06 10:55:18 -0600
committermegamage <none@none>2008-12-06 10:55:18 -0600
commit7c95bfcbee14e4cb589fe7719ac2e18a34468ce5 (patch)
tree79f8f3960ed9bb2482425cf4527cd7511b1a0442
parent8ffc1a6e4ce588cdf9b54e26616c4a92729f7ffd (diff)
*Fix a bug that GetHeight causes crash.
--HG-- branch : trunk
-rw-r--r--src/game/Map.cpp4
1 files changed, 4 insertions, 0 deletions
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];