1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-02-03 18:08:14 +01:00

Fix: Off by one and redundant logic in snowy road checks

This commit is contained in:
Richard Wheeler
2026-02-01 14:20:27 +00:00
parent 58f3255f01
commit 2347a56d7c

View File

@@ -2006,8 +2006,8 @@ static void TileLoop_Road(TileIndex tile)
{
switch (_settings_game.game_creation.landscape) {
case LandscapeType::Arctic: {
/* Roads on flat or elevated foundations use the snow level of the height they are elevated to. All others use the snow level of their minimum height. */
int tile_z = (std::get<Slope>(GetFoundationSlope(tile)) == SLOPE_FLAT || std::get<Slope>(GetFoundationSlope(tile)) & SLOPE_ELEVATED) ? GetTileMaxZ(tile) : GetTileZ(tile);
/* Roads use the snow level of their maximum height minus one, unless flat. */
int tile_z = (std::get<Slope>(GetFoundationSlope(tile)) == SLOPE_FLAT) ? GetTileMaxZ(tile) : GetTileMaxZ(tile) - 1;
if (IsOnSnowOrDesert(tile) != (tile_z > GetSnowLine())) {
ToggleSnowOrDesert(tile);
MarkTileDirtyByTile(tile);