*Fix a bug that GetHeight causes crash.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-06 10:55:18 -06:00
parent 8ffc1a6e4c
commit 7c95bfcbee

View File

@@ -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];