summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-08-31 11:42:16 +0000
committertron <tron@openttd.org>2006-08-31 11:42:16 +0000
commitf3c80209028f3380d735bc3212e1daba0ae6c2e7 (patch)
tree31e02715df18b15d5588766fb21ea9af127f53e4
parenta80a17007ab2dbc731cb906aa9db18f1e4a26431 (diff)
downloadopenttd-f3c80209028f3380d735bc3212e1daba0ae6c2e7.tar.xz
(svn r6267) Simplify the control flow in the rail tile loop by eliminating a bool flag and replacing it by a simple goto
-rw-r--r--rail_cmd.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/rail_cmd.c b/rail_cmd.c
index 630375083..ac547d6af 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -1758,31 +1758,23 @@ 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;
- quick_return = true;
+ goto set_ground;
}
break;
case LT_DESERT:
if (GetTropicZone(tile) == TROPICZONE_DESERT) {
new_ground = RAIL_GROUND_ICE_DESERT;
- quick_return = true;
+ goto set_ground;
}
break;
}
- if (new_ground != old_ground) {
- SetRailGroundType(tile, new_ground);
- MarkTileDirtyByTile(tile);
- }
-
- if (quick_return) return;
-
if (!IsPlainRailTile(tile)) return;
new_ground = RAIL_GROUND_GRASS;
@@ -1866,6 +1858,7 @@ static void TileLoop_Track(TileIndex tile)
}
}
+set_ground:
if (old_ground != new_ground) {
SetRailGroundType(tile, new_ground);
MarkTileDirtyByTile(tile);