summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-04-15 22:16:47 +0000
committerDarkvater <darkvater@openttd.org>2006-04-15 22:16:47 +0000
commit7456c6e6edc6b213ddec14caf3e397a721f41ebb (patch)
treefb11dc207e1fe1de10fcbbe0fbfded5cb42f3496
parent12770adba6ebe0f1340b372005d484edff243d03 (diff)
downloadopenttd-7456c6e6edc6b213ddec14caf3e397a721f41ebb.tar.xz
(svn r4440) - Fix: Yoyo-effect of rail in desert/snow introduced by r4379. When a special groundtype below the track is encountered in the tileloop, always return even if groundtype hasn't changed.
-rw-r--r--rail_cmd.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/rail_cmd.c b/rail_cmd.c
index e599cb4ae..c5d210cff 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -1737,26 +1737,31 @@ static void TileLoop_Track(TileIndex tile)
{
RailGroundType old_ground = GetRailGroundType(tile);
RailGroundType new_ground = old_ground;
+ bool quick_return = false;
switch (_opt.landscape) {
case LT_HILLY:
- if (GetTileZ(tile) > _opt.snow_line) new_ground = RAIL_GROUND_ICE_DESERT;
+ if (GetTileZ(tile) > _opt.snow_line) {
+ new_ground = RAIL_GROUND_ICE_DESERT;
+ quick_return = true;
+ }
break;
case LT_DESERT:
- if (GetTropicZone(tile) == TROPICZONE_DESERT) new_ground = RAIL_GROUND_ICE_DESERT;
- break;
-
- default:
+ if (GetTropicZone(tile) == TROPICZONE_DESERT) {
+ new_ground = RAIL_GROUND_ICE_DESERT;
+ quick_return = true;
+ }
break;
}
if (new_ground != old_ground) {
SetRailGroundType(tile, new_ground);
MarkTileDirtyByTile(tile);
- return;
}
+ if (quick_return) return;
+
// Don't continue tile loop for depots
if (GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT) return;