src/ai/api/ai_stationlist.cpp
author truelight
Wed, 18 Jul 2007 09:20:50 +0000
branchnoai
changeset 9670 820b77e19bb3
parent 9645 25126afa0c25
child 9723 eee46cb39750
permissions -rw-r--r--
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
[NoAI] -Add: added GetCoverageRadius / GetAirportCoverageRadius
[NoAI] -Fix: AiportAvailable was bugged, returned always true for AT_SMALL
[NoAI] -Change: improved WrightAI to work from 1950 (based on above functions)
/* $Id$ */

#include "ai_stationlist.hpp"
#include "ai_vehicle.hpp"
#include "../../player.h"
#include "../../station.h"
#include "../../order.h"
#include "../../vehicle.h"

AIStationList::AIStationList(AIStation::StationType type)
{
	Station *st;
	FOR_ALL_STATIONS(st) {
		if (st->owner == _current_player && (type == AIStation::STATION_ANY || (st->facilities & type) != 0)) this->AddItem(st->index);
	}
}

AIVehicleStationList::AIVehicleStationList(VehicleID vehicle_id)
{
	if (!AIVehicle::IsValidVehicle(vehicle_id)) return;

	Vehicle *v = ::GetVehicle(vehicle_id);

	for (Order *o = v->orders; o != NULL; o = o->next) {
		if (o->type == OT_GOTO_STATION) this->AddItem(o->dest);
	}
}