00001 /* $Id: ai_stationlist.cpp 15299 2009-01-31 20:16:06Z smatz $ */ 00002 00005 #include "ai_stationlist.hpp" 00006 #include "ai_vehicle.hpp" 00007 #include "../../company_func.h" 00008 #include "../../station_base.h" 00009 #include "../../vehicle_base.h" 00010 00011 AIStationList::AIStationList(AIStation::StationType station_type) 00012 { 00013 Station *st; 00014 FOR_ALL_STATIONS(st) { 00015 if (st->owner == _current_company && (st->facilities & station_type) != 0) this->AddItem(st->index); 00016 } 00017 } 00018 00019 AIStationList_Vehicle::AIStationList_Vehicle(VehicleID vehicle_id) 00020 { 00021 if (!AIVehicle::IsValidVehicle(vehicle_id)) return; 00022 00023 Vehicle *v = ::GetVehicle(vehicle_id); 00024 00025 for (Order *o = v->GetFirstOrder(); o != NULL; o = o->next) { 00026 if (o->IsType(OT_GOTO_STATION)) this->AddItem(o->GetDestination()); 00027 } 00028 }