Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change: Desert tiles are now half-desert if a neighboured tile is non… #7015

Merged
merged 1 commit into from Jan 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 11 additions & 10 deletions src/clear_cmd.cpp
Expand Up @@ -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)
Expand All @@ -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;
Expand Down