summaryrefslogtreecommitdiff
path: root/src/newgrf_industries.cpp
diff options
context:
space:
mode:
authorYexo <yexo@openttd.org>2009-01-21 02:31:55 +0000
committerYexo <yexo@openttd.org>2009-01-21 02:31:55 +0000
commitdb3ee34b4468aa3448b64e339258760885c5d716 (patch)
tree272533ac91b7bc3ab16c3ee1a997e142f3170a2a /src/newgrf_industries.cpp
parent5e7669b539002cb9ec9e608f4601a827b5e9da57 (diff)
downloadopenttd-db3ee34b4468aa3448b64e339258760885c5d716.tar.xz
(svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.
Diffstat (limited to 'src/newgrf_industries.cpp')
-rw-r--r--src/newgrf_industries.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index da74f58d3..d65570c93 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -59,6 +59,7 @@ static uint GetClosestWaterDistance(TileIndex tile, bool water)
uint max_x = MapMaxX();
uint max_y = MapMaxY();
+ uint min_xy = _settings_game.construction.freeform_edges ? 1 : 0;
/* go in a 'spiral' with increasing manhattan distance in each iteration */
for (uint dist = 1; dist < max_dist; dist++) {
@@ -75,8 +76,8 @@ static uint GetClosestWaterDistance(TileIndex tile, bool water)
/* each side of this square has length 'dist' */
for (uint a = 0; a < dist; a++) {
- /* MP_VOID tiles are not checked (interval is [0; max) for IsInsideMM())*/
- if (IsInsideMM(x, 0, max_x) && IsInsideMM(y, 0, max_y)) {
+ /* 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;
}