rubidium@9820: /* $Id$ */ rubidium@9820: truebrain@9833: /** @file ai_vehiclelist.cpp Implementation of AIVehicleList and friends. */ rubidium@9820: truelight@9614: #include "ai_vehiclelist.hpp" truebrain@9740: #include "ai_station.hpp" rubidium@9724: #include "../../player_func.h" rubidium@9723: #include "../../vehicle_base.h" truelight@9614: truelight@9614: AIVehicleList::AIVehicleList() truelight@9614: { truelight@9614: Vehicle *v; truelight@9614: FOR_ALL_VEHICLES(v) { truelight@9633: if (v->owner == _current_player && v->IsPrimaryVehicle()) this->AddItem(v->index); truelight@9614: } truelight@9614: } truelight@9647: truebrain@9745: AIVehicleList_Station::AIVehicleList_Station(StationID station_id) truelight@9647: { truebrain@9740: if (!AIStation::IsValidStation(station_id)) return; truebrain@9740: truelight@9647: Vehicle *v; truelight@9647: truelight@9647: FOR_ALL_VEHICLES(v) { truelight@9647: if (v->owner == _current_player && v->IsPrimaryVehicle()) { truelight@9647: const Order *order; truelight@9647: truelight@9647: FOR_VEHICLE_ORDERS(v, order) { rubidium@9869: if (order->IsType(OT_GOTO_STATION) && order->GetDestination() == station_id) { truelight@9647: this->AddItem(v->index); truelight@9647: break; truelight@9647: } truelight@9647: } truelight@9647: } truelight@9647: } truelight@9647: }