src/ai/api/ai_vehiclelist.cpp
author truelight
Sun, 19 Aug 2007 13:31:04 +0000
branchnoai
changeset 9698 1d50fe99b7e9
parent 9647 c17046b1b8a2
child 9723 eee46cb39750
permissions -rw-r--r--
(svn r10939) [NoAI] -Add: added AITileList valuator Water
[NoAI] -Add: added AITile::IsWater
#include "ai_vehiclelist.hpp"
#include "../../player.h"
#include "../../station.h"
#include "../../vehicle.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;
				}
			}
		}
	}
}