diff options
author | skidd13 <skidd13@openttd.org> | 2007-12-03 09:19:19 +0000 |
---|---|---|
committer | skidd13 <skidd13@openttd.org> | 2007-12-03 09:19:19 +0000 |
commit | 5d74f2ced4206725724d92fd8a5a22f9e1ce8b14 (patch) | |
tree | ffda3073f527cfcef5eb31264655b305398d87ab /src/ai/default/default.cpp | |
parent | 2b372e7e7b7aa04a45dd218681a3f1ed76d812ce (diff) | |
download | openttd-5d74f2ced4206725724d92fd8a5a22f9e1ce8b14.tar.xz |
(svn r11564) -Codechange: Increase the usage of the for_each_bit macro and rename it fitting to the naming style
Diffstat (limited to 'src/ai/default/default.cpp')
-rw-r--r-- | src/ai/default/default.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp index e0aa1ae00..d1979ed82 100644 --- a/src/ai/default/default.cpp +++ b/src/ai/default/default.cpp @@ -1653,13 +1653,11 @@ clear_town_stuff:; k = 0; // Build the rail - for (i = 0; i != 6; i++, j >>= 1) { - if (j & 1) { - k = i; - ret = DoCommand(c, railtype, i, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_SINGLE_RAIL); - if (CmdFailed(ret)) return CMD_ERROR; - total_cost.AddCost(ret); - } + FOR_EACH_SET_BIT(i, j) { + k = i; + ret = DoCommand(c, railtype, i, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_SINGLE_RAIL); + if (CmdFailed(ret)) return CMD_ERROR; + total_cost.AddCost(ret); } /* signals too? */ @@ -2854,7 +2852,6 @@ static bool AiCheckRoadFinished(Player *p) TileIndex tile; DiagDirection dir = p->ai.cur_dir_a; uint32 bits; - int i; are.dest = p->ai.cur_tile_b; tile = TILE_MASK(p->ai.cur_tile_a + TileOffsByDiagDir(dir)); @@ -2865,7 +2862,8 @@ static bool AiCheckRoadFinished(Player *p) are.best_dist = (uint)-1; - for_each_bit(i, bits) { + uint i; + FOR_EACH_SET_BIT(i, bits) { FollowTrack(tile, 0x3000 | TRANSPORT_ROAD, ROADTYPES_ROAD, (DiagDirection)_dir_by_track[i], (TPFEnumProc*)AiEnumFollowRoad, NULL, &are); } |