summaryrefslogtreecommitdiff
path: root/src/road_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/road_cmd.cpp')
-rw-r--r--src/road_cmd.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 13c27f825..09d7afc93 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -875,13 +875,14 @@ static CommandCost ClearTile_Road(TileIndex tile, byte flags)
/* Must iterate over the roadtypes in a reverse manner because
* tram tracks must be removed before the road bits. */
- for (RoadType rt = ROADTYPE_HWAY; rt >= ROADTYPE_ROAD; rt--) {
+ RoadType rt = ROADTYPE_HWAY;
+ do {
if (HasBit(rts, rt)) {
CommandCost tmp_ret = RemoveRoad(tile, flags, GetCrossingRoadBits(tile), rt, false);
if (CmdFailed(tmp_ret)) return tmp_ret;
ret.AddCost(tmp_ret);
}
- }
+ } while (rt-- != ROADTYPE_ROAD);
if (flags & DC_EXEC) {
DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);