summaryrefslogtreecommitdiff
path: root/ai/trolly
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-11-03 23:06:54 +0000
committerpeter1138 <peter1138@openttd.org>2006-11-03 23:06:54 +0000
commit8cfe4d6a67ddbde35169adbe2ea0b1c87730ac82 (patch)
treebbeb158718e6311e12e482d43ddb9114a924372a /ai/trolly
parentac2b6f39b1f9a1e104fe6859d1a5b7c6afd010f8 (diff)
downloadopenttd-8cfe4d6a67ddbde35169adbe2ea0b1c87730ac82.tar.xz
(svn r7057) -Codechange: Remove hardcoded lists of road vehicles for each cargo type in favour of just checking the cargo type of each vehicle.
Diffstat (limited to 'ai/trolly')
-rw-r--r--ai/trolly/build.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ai/trolly/build.c b/ai/trolly/build.c
index ff2158395..059500dc4 100644
--- a/ai/trolly/build.c
+++ b/ai/trolly/build.c
@@ -232,8 +232,8 @@ EngineID AiNew_PickVehicle(Player *p)
// Not supported yet
return INVALID_ENGINE;
} else {
- EngineID start = _cargoc.ai_roadveh_start[p->ainew.cargo];
- EngineID end = start + _cargoc.ai_roadveh_count[p->ainew.cargo];
+ EngineID start = ROAD_ENGINES_INDEX;
+ EngineID end = ROAD_ENGINES_INDEX + NUM_ROAD_ENGINES;
EngineID i;
// Let's check it backwards.. we simply want to best engine available..
@@ -241,6 +241,9 @@ EngineID AiNew_PickVehicle(Player *p)
const Engine* e = GetEngine(i);
int32 ret;
+ /* Skip vehicles which can't take our cargo type */
+ if (RoadVehInfo(i)->cargo_type != p->ainew.cargo) continue;
+
// Is it availiable?
// Also, check if the reliability of the vehicle is above the AI_VEHICLE_MIN_RELIABILTY
if (!HASBIT(e->player_avail, _current_player) || e->reliability * 100 < AI_VEHICLE_MIN_RELIABILTY << 16) continue;