summaryrefslogtreecommitdiff
path: root/ai
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-02-18 14:52:42 +0000
committertron <tron@openttd.org>2006-02-18 14:52:42 +0000
commitb13ac1486c3dd11683f3f269e836c12fd9599794 (patch)
treeddef2d9dfa2b71dce7b6ad74c62ce56a0e86ab9e /ai
parent49c7eb934be0dc92d640ea3a32c02dddcc83369a (diff)
downloadopenttd-b13ac1486c3dd11683f3f269e836c12fd9599794.tar.xz
(svn r3614) turn 2 do-while-loop with 2 induction variables each into canocical for loops
Diffstat (limited to 'ai')
-rw-r--r--ai/default/default.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/ai/default/default.c b/ai/default/default.c
index edf0c7a2f..dd0700fd1 100644
--- a/ai/default/default.c
+++ b/ai/default/default.c
@@ -159,9 +159,10 @@ static EngineID AiChooseRoadVehToBuild(byte cargo, int32 money, TileIndex tile)
EngineID i = _cargoc.ai_roadveh_start[cargo];
EngineID end = i + _cargoc.ai_roadveh_count[cargo];
- const Engine* e = GetEngine(i);
- do {
+ for (; i != end; i++) {
+ const Engine* e = GetEngine(i);
+
if (!HASBIT(e->player_avail, _current_player) || e->reliability < 0x8A3D)
continue;
@@ -170,7 +171,7 @@ static EngineID AiChooseRoadVehToBuild(byte cargo, int32 money, TileIndex tile)
best_veh_cost = ret;
best_veh_index = i;
}
- } while (++e, ++i != end);
+ }
return best_veh_index;
}
@@ -183,9 +184,10 @@ static EngineID AiChooseAircraftToBuild(int32 money, byte flag)
EngineID i = AIRCRAFT_ENGINES_INDEX;
EngineID end = i + NUM_AIRCRAFT_ENGINES;
- const Engine* e = GetEngine(i);
- do {
+ for (; i != end; i++) {
+ const Engine* e = GetEngine(i);
+
if (!HASBIT(e->player_avail, _current_player) || e->reliability < 0x8A3D)
continue;
@@ -200,7 +202,7 @@ static EngineID AiChooseAircraftToBuild(int32 money, byte flag)
best_veh_cost = ret;
best_veh_index = i;
}
- } while (++e, ++i != end);
+ }
return best_veh_index;
}