From db3ee34b4468aa3448b64e339258760885c5d716 Mon Sep 17 00:00:00 2001 From: Yexo Date: Wed, 21 Jan 2009 02:31:55 +0000 Subject: (svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map. --- src/newgrf_industries.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/newgrf_industries.cpp') 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; } -- cgit v1.2.3-54-g00ecf