src/ai/api/ai_vehiclelist.cpp
author truebrain
Wed, 26 Mar 2008 15:17:40 +0000
branchnoai
changeset 9823 0b7f816cf46f
parent 9820 8c116d4c6033
child 9833 89a64246458f
permissions -rw-r--r--
(svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
/* $Id$ */

/** @file ai_vehiclelist.cpp List of vehicles */

#include "ai_vehiclelist.hpp"
#include "ai_station.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);
	}
}

AIVehicleList_Station::AIVehicleList_Station(StationID station_id)
{
	if (!AIStation::IsValidStation(station_id)) return;

	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_id) {
					this->AddItem(v->index);
					break;
				}
			}
		}
	}
}