src/ai/api/ai_vehiclelist.cpp
author truelight
Sat, 14 Jul 2007 21:15:49 +0000
branchnoai
changeset 9657 f2c6e332d8bc
parent 9647 c17046b1b8a2
child 9723 eee46cb39750
permissions -rw-r--r--
(svn r10564) [NoAI] -Add: added a AITileList valuator that checks for a NxM buildable spot with the entry from the AITileList as top-left tile
#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;
				}
			}
		}
	}
}