diff options
author | rubidium <rubidium@openttd.org> | 2008-04-07 22:15:31 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-04-07 22:15:31 +0000 |
commit | b0ca38e20a154572e4dca3dd95c7deddea02c3e1 (patch) | |
tree | e28cc2e7b0cb047b4b460c002128eacc2f7172b6 | |
parent | d31dee27175475d0c6a77c4f5da7cfab36eefd63 (diff) | |
download | openttd-b0ca38e20a154572e4dca3dd95c7deddea02c3e1.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.cpp | 5 |
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); |