summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-02-06 13:57:17 +0000
committerfrosch <frosch@openttd.org>2011-02-06 13:57:17 +0000
commita8859bbff95d3d2bd92edd456bc954d7da14000e (patch)
tree75d8c0bd8a977e0afd8015e618254ab0721af4ae
parentafad7920ef3b18e1d6f72e3d269a5f973b6a8cd1 (diff)
downloadopenttd-a8859bbff95d3d2bd92edd456bc954d7da14000e.tar.xz
(svn r21994) -Fix: Make computations of closest-land/water-distances handle waterish tiles more correctly.
-rw-r--r--src/map.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 34730028e..c44ed6893 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -13,6 +13,7 @@
#include "debug.h"
#include "core/alloc_func.hpp"
#include "tile_map.h"
+#include "water_map.h"
#if defined(_MSC_VER)
/* Why the hell is that not in all MSVC headers?? */
@@ -339,7 +340,7 @@ bool CircularTileSearch(TileIndex *tile, uint radius, uint w, uint h, TestTileOn
*/
uint GetClosestWaterDistance(TileIndex tile, bool water)
{
- if (IsTileType(tile, MP_WATER) == water) return 0;
+ if (HasTileWaterGround(tile) == water) return 0;
uint max_dist = water ? 0x7F : 0x200;
@@ -368,7 +369,7 @@ uint GetClosestWaterDistance(TileIndex tile, bool water)
/* MP_VOID tiles are not checked (interval is [min; max) for IsInsideMM())*/
if (IsInsideMM(x, min_xy, max_x) && IsInsideMM(y, min_xy, max_y)) {
TileIndex t = TileXY(x, y);
- if (IsTileType(t, MP_WATER) == water) return dist;
+ if (HasTileWaterGround(t) == water) return dist;
}
x += dx;
y += dy;