mirror of https://github.com/OpenTTD/OpenTTD
(svn r6267) Simplify the control flow in the rail tile loop by eliminating a bool flag and replacing it by a simple goto
parent
a80a17007a
commit
f3c8020902
13
rail_cmd.c
13
rail_cmd.c
|
@ -1758,31 +1758,23 @@ static void TileLoop_Track(TileIndex tile)
|
||||||
{
|
{
|
||||||
RailGroundType old_ground = GetRailGroundType(tile);
|
RailGroundType old_ground = GetRailGroundType(tile);
|
||||||
RailGroundType new_ground = old_ground;
|
RailGroundType new_ground = old_ground;
|
||||||
bool quick_return = false;
|
|
||||||
|
|
||||||
switch (_opt.landscape) {
|
switch (_opt.landscape) {
|
||||||
case LT_HILLY:
|
case LT_HILLY:
|
||||||
if (GetTileZ(tile) > _opt.snow_line) {
|
if (GetTileZ(tile) > _opt.snow_line) {
|
||||||
new_ground = RAIL_GROUND_ICE_DESERT;
|
new_ground = RAIL_GROUND_ICE_DESERT;
|
||||||
quick_return = true;
|
goto set_ground;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LT_DESERT:
|
case LT_DESERT:
|
||||||
if (GetTropicZone(tile) == TROPICZONE_DESERT) {
|
if (GetTropicZone(tile) == TROPICZONE_DESERT) {
|
||||||
new_ground = RAIL_GROUND_ICE_DESERT;
|
new_ground = RAIL_GROUND_ICE_DESERT;
|
||||||
quick_return = true;
|
goto set_ground;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_ground != old_ground) {
|
|
||||||
SetRailGroundType(tile, new_ground);
|
|
||||||
MarkTileDirtyByTile(tile);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (quick_return) return;
|
|
||||||
|
|
||||||
if (!IsPlainRailTile(tile)) return;
|
if (!IsPlainRailTile(tile)) return;
|
||||||
|
|
||||||
new_ground = RAIL_GROUND_GRASS;
|
new_ground = RAIL_GROUND_GRASS;
|
||||||
|
@ -1866,6 +1858,7 @@ static void TileLoop_Track(TileIndex tile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_ground:
|
||||||
if (old_ground != new_ground) {
|
if (old_ground != new_ground) {
|
||||||
SetRailGroundType(tile, new_ground);
|
SetRailGroundType(tile, new_ground);
|
||||||
MarkTileDirtyByTile(tile);
|
MarkTileDirtyByTile(tile);
|
||||||
|
|
Loading…
Reference in New Issue