mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-13 02:52:37 +00:00
Change: Desert tiles are now half-desert if a neighboured tile is non-desert or sea/coast. (patch by frosch123) #4754 (#7015)
This commit is contained in:
parent
e934f09f02
commit
ad5a9daed5
@ -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
|
* @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 ||
|
for (DiagDirection dir = DIAGDIR_BEGIN; dir < DIAGDIR_END; dir++) {
|
||||||
GetTropicZone(tile + TileDiffXY( -1, 0)) == TROPICZONE_DESERT ||
|
TileIndex t = tile + TileOffsByDiagDir(dir);
|
||||||
GetTropicZone(tile + TileDiffXY( 0, 1)) == TROPICZONE_DESERT ||
|
if (!IsValidTile(t)) continue;
|
||||||
GetTropicZone(tile + TileDiffXY( 0, -1)) == TROPICZONE_DESERT;
|
if (GetTropicZone(t) != TROPICZONE_DESERT) return true;
|
||||||
|
if (HasTileWaterClass(t) && GetWaterClass(t) == WATER_CLASS_SEA) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TileLoopClearDesert(TileIndex tile)
|
static void TileLoopClearDesert(TileIndex tile)
|
||||||
@ -229,9 +232,7 @@ static void TileLoopClearDesert(TileIndex tile)
|
|||||||
/* Expected desert level - 0 if it shouldn't be desert */
|
/* Expected desert level - 0 if it shouldn't be desert */
|
||||||
uint expected = 0;
|
uint expected = 0;
|
||||||
if (GetTropicZone(tile) == TROPICZONE_DESERT) {
|
if (GetTropicZone(tile) == TROPICZONE_DESERT) {
|
||||||
expected = 3;
|
expected = NeighbourIsNormal(tile) ? 1 : 3;
|
||||||
} else if (NeighbourIsDesert(tile)) {
|
|
||||||
expected = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current == expected) return;
|
if (current == expected) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user