diff options
author | Andy <andy@teamrubber.com> | 2019-01-09 17:48:08 +0000 |
---|---|---|
committer | Ingo von Borstel <github@planetmaker.de> | 2019-01-09 18:48:08 +0100 |
commit | ad5a9daed52c7793a465b58b5407a5e58688e842 (patch) | |
tree | c19a0e98f64d0c69d5d229a2d4196a5ee6f12d8a /src | |
parent | e934f09f02a022c7ef3d54879ce6c07454c098a6 (diff) | |
download | openttd-ad5a9daed52c7793a465b58b5407a5e58688e842.tar.xz |
Change: Desert tiles are now half-desert if a neighboured tile is non-desert or sea/coast. (patch by frosch123) #4754 (#7015)
Diffstat (limited to 'src')
-rw-r--r-- | src/clear_cmd.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp index f9eb88df5..c4aeb3a52 100644 --- a/src/clear_cmd.cpp +++ b/src/clear_cmd.cpp @@ -208,16 +208,19 @@ static void TileLoopClearAlps(TileIndex tile) } /** - * Tests if at least one surrounding tile is desert + * Tests if at least one surrounding tile is non-desert * @param tile tile to check - * @return does this tile have at least one desert tile around? + * @return does this tile have at least one non-desert tile around? */ -static inline bool NeighbourIsDesert(TileIndex tile) +static inline bool NeighbourIsNormal(TileIndex tile) { - return GetTropicZone(tile + TileDiffXY( 1, 0)) == TROPICZONE_DESERT || - GetTropicZone(tile + TileDiffXY( -1, 0)) == TROPICZONE_DESERT || - GetTropicZone(tile + TileDiffXY( 0, 1)) == TROPICZONE_DESERT || - GetTropicZone(tile + TileDiffXY( 0, -1)) == TROPICZONE_DESERT; + for (DiagDirection dir = DIAGDIR_BEGIN; dir < DIAGDIR_END; dir++) { + TileIndex t = tile + TileOffsByDiagDir(dir); + if (!IsValidTile(t)) continue; + if (GetTropicZone(t) != TROPICZONE_DESERT) return true; + if (HasTileWaterClass(t) && GetWaterClass(t) == WATER_CLASS_SEA) return true; + } + return false; } static void TileLoopClearDesert(TileIndex tile) @@ -229,9 +232,7 @@ static void TileLoopClearDesert(TileIndex tile) /* Expected desert level - 0 if it shouldn't be desert */ uint expected = 0; if (GetTropicZone(tile) == TROPICZONE_DESERT) { - expected = 3; - } else if (NeighbourIsDesert(tile)) { - expected = 1; + expected = NeighbourIsNormal(tile) ? 1 : 3; } if (current == expected) return; |