truelight@9638: /* $Id$ */ truelight@9638: truebrain@9833: /** @file ai_stationlist.cpp Implementation of AIStationList and friends. */ rubidium@9820: truelight@9636: #include "ai_stationlist.hpp" truelight@9645: #include "ai_vehicle.hpp" truebrain@10339: #include "../../openttd.h" rubidium@9724: #include "../../player_func.h" rubidium@9837: #include "../../station_base.h" rubidium@9723: #include "../../vehicle_base.h" truelight@9636: truebrain@9778: AIStationList::AIStationList(AIStation::StationType station_type) truelight@9636: { truelight@9636: Station *st; truelight@9636: FOR_ALL_STATIONS(st) { truebrain@9778: if (st->owner == _current_player && (station_type == AIStation::STATION_ANY || (st->facilities & station_type) != 0)) this->AddItem(st->index); truelight@9636: } truelight@9636: } truelight@9645: truebrain@9746: AIStationList_Vehicle::AIStationList_Vehicle(VehicleID vehicle_id) truelight@9645: { truelight@9645: if (!AIVehicle::IsValidVehicle(vehicle_id)) return; truelight@9645: truelight@9645: Vehicle *v = ::GetVehicle(vehicle_id); truelight@9645: truelight@9645: for (Order *o = v->orders; o != NULL; o = o->next) { rubidium@9869: if (o->IsType(OT_GOTO_STATION)) this->AddItem(o->GetDestination()); truelight@9645: } truelight@9645: }