summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-04-07 22:15:31 +0000
committerrubidium <rubidium@openttd.org>2008-04-07 22:15:31 +0000
commitb0ca38e20a154572e4dca3dd95c7deddea02c3e1 (patch)
treee28cc2e7b0cb047b4b460c002128eacc2f7172b6 /src
parentd31dee27175475d0c6a77c4f5da7cfab36eefd63 (diff)
downloadopenttd-b0ca38e20a154572e4dca3dd95c7deddea02c3e1.tar.xz
(svn r12622) -Fix: infinite loop in case your compiler decides that enums are unsigned by default. Patch by Dominik.
Diffstat (limited to 'src')
-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);