(svn r7057) -Codechange: Remove hardcoded lists of road vehicles for each cargo type in favour of just checking the cargo type of each vehicle.

This commit is contained in:
2006-11-03 23:06:54 +00:00
parent ac2b6f39b1
commit 8cfe4d6a67
5 changed files with 10 additions and 28 deletions

View File

@@ -163,8 +163,8 @@ static EngineID AiChooseRoadVehToBuild(CargoID cargo, int32 money, TileIndex til
{
EngineID best_veh_index = INVALID_ENGINE;
int32 best_veh_cost = 0;
EngineID i = _cargoc.ai_roadveh_start[cargo];
EngineID end = i + _cargoc.ai_roadveh_count[cargo];
EngineID i = ROAD_ENGINES_INDEX;
EngineID end = i + NUM_ROAD_ENGINES;
for (; i != end; i++) {
const Engine* e = GetEngine(i);
@@ -174,6 +174,9 @@ static EngineID AiChooseRoadVehToBuild(CargoID cargo, int32 money, TileIndex til
continue;
}
/* Skip vehicles which can't take our cargo type */
if (RoadVehInfo(i)->cargo_type != cargo) continue;
ret = DoCommand(tile, i, 0, 0, CMD_BUILD_ROAD_VEH);
if (!CmdFailed(ret) && ret <= money && ret >= best_veh_cost) {
best_veh_cost = ret;