summaryrefslogtreecommitdiff
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
commit5967f5b37993acaffd50e9736bd73ebf4ff10afa (patch)
treee28cc2e7b0cb047b4b460c002128eacc2f7172b6
parent337c92090ba7b00ad5842eed8ac74351b0e2c1ca (diff)
downloadopenttd-5967f5b37993acaffd50e9736bd73ebf4ff10afa.tar.xz
(svn r12622) -Fix: infinite loop in case your compiler decides that enums are unsigned by default. Patch by Dominik.
-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);