summaryrefslogtreecommitdiff
path: root/ai/default
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
commit7f6953fb5818247da311ba12319775ac7d8dfd11 (patch)
treeddef2d9dfa2b71dce7b6ad74c62ce56a0e86ab9e /ai/default
parent7692556c6204fd3707456f5f63a4f055c39878dc (diff)
downloadopenttd-7f6953fb5818247da311ba12319775ac7d8dfd11.tar.xz
(svn r3614) turn 2 do-while-loop with 2 induction variables each into canocical for loops
Diffstat (limited to 'ai/default')
-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;
}