(svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.

This commit is contained in:
Yexo
2009-01-21 02:31:55 +00:00
parent 5e7669b539
commit db3ee34b44
31 changed files with 417 additions and 171 deletions

View File

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