src/ai/api/ai_vehiclelist.cpp
author rubidium
Sun, 03 Feb 2008 20:17:54 +0000
branchnoai
changeset 9724 b39bc69bb2f2
parent 9723 eee46cb39750
child 9740 a98f20bce404
permissions -rw-r--r--
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
#include "ai_vehiclelist.hpp"
#include "../../player_func.h"
#include "../../station.h"
#include "../../vehicle_base.h"

AIVehicleList::AIVehicleList()
{
	Vehicle *v;
	FOR_ALL_VEHICLES(v) {
		if (v->owner == _current_player && v->IsPrimaryVehicle()) this->AddItem(v->index);
	}
}

AIStationVehicleList::AIStationVehicleList(StationID station)
{
	Vehicle *v;

	FOR_ALL_VEHICLES(v) {
		if (v->owner == _current_player && v->IsPrimaryVehicle()) {
			const Order *order;

			FOR_VEHICLE_ORDERS(v, order) {
				if (order->type == OT_GOTO_STATION && order->dest == station) {
					this->AddItem(v->index);
					break;
				}
			}
		}
	}
}