summaryrefslogtreecommitdiff
path: root/ai_new.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2004-12-05 12:43:04 +0000
committertron <tron@openttd.org>2004-12-05 12:43:04 +0000
commit7c2448ecea6ec47f9df4928ad3f42668936835ee (patch)
treef4ed902f473744cc8497d09b3f372d3da1524f4f /ai_new.c
parent1de8e294d892a70edbd1f4f3d3a6a141711f6648 (diff)
downloadopenttd-7c2448ecea6ec47f9df4928ad3f42668936835ee.tar.xz
(svn r955) Replace uint16 for orders with struct Order
This adds no functionality, but is a stepping stone for future improvement (like 16bit order indices) and is easier to read. This changes preserves binary compatibility wrt savegames.
Diffstat (limited to 'ai_new.c')
-rw-r--r--ai_new.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/ai_new.c b/ai_new.c
index a2d694d66..5b31ef902 100644
--- a/ai_new.c
+++ b/ai_new.c
@@ -497,17 +497,18 @@ static void AiNew_State_LocateRoute(Player *p) {
static bool AiNew_CheckVehicleStation(Player *p, Station *st) {
int count = 0;
Vehicle *v;
- uint16 *sched;
- uint16 ord;
// Also check if we don't have already a lot of busses to this city...
FOR_ALL_VEHICLES(v) {
if (v->owner == _current_player) {
- sched = v->schedule_ptr;
- while (sched != NULL && (ord=*sched++) != 0) {
- if ((ord & OT_MASK) == OT_GOTO_STATION && DEREF_STATION(ord >> 8) == st) {
- // This vehicle has this city in his list
- count++;
+ const Order *sched = v->schedule_ptr;
+ if (sched != NULL) {
+ for (; sched->type != OT_NOTHING; ++sched) {
+ if (sched->type == OT_GOTO_STATION &&
+ DEREF_STATION(sched->station) == st) {
+ // This vehicle has this city in his list
+ count++;
+ }
}
}
}