mirror of https://github.com/OpenTTD/OpenTTD
(svn r17112) -Change [NoAI]: AIVehicleList_Station now also works for waypoints
parent
3dcc195dfa
commit
eff8cb8390
|
@ -31,6 +31,7 @@
|
||||||
* \li WAYPOINT_INVALID is now deprecated, use STATION_INVALID instead
|
* \li WAYPOINT_INVALID is now deprecated, use STATION_INVALID instead
|
||||||
* \li AIs can create subclasses of API classes and use API constants as part
|
* \li AIs can create subclasses of API classes and use API constants as part
|
||||||
* of their own constants
|
* of their own constants
|
||||||
|
* \li AIVehicleList_Station now also works for waypoints
|
||||||
*
|
*
|
||||||
* \b 0.7.3
|
* \b 0.7.3
|
||||||
*
|
*
|
||||||
|
|
|
@ -19,7 +19,7 @@ AIVehicleList::AIVehicleList()
|
||||||
|
|
||||||
AIVehicleList_Station::AIVehicleList_Station(StationID station_id)
|
AIVehicleList_Station::AIVehicleList_Station(StationID station_id)
|
||||||
{
|
{
|
||||||
if (!AIStation::IsValidStation(station_id)) return;
|
if (!AIBaseStation::IsValidBaseStation(station_id)) return;
|
||||||
|
|
||||||
const Vehicle *v;
|
const Vehicle *v;
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
|
@ -27,7 +27,7 @@ AIVehicleList_Station::AIVehicleList_Station(StationID station_id)
|
||||||
const Order *order;
|
const Order *order;
|
||||||
|
|
||||||
FOR_VEHICLE_ORDERS(v, order) {
|
FOR_VEHICLE_ORDERS(v, order) {
|
||||||
if (order->IsType(OT_GOTO_STATION) && order->GetDestination() == station_id) {
|
if ((order->IsType(OT_GOTO_STATION) || order->IsType(OT_GOTO_WAYPOINT)) && order->GetDestination() == station_id) {
|
||||||
this->AddItem(v->index);
|
this->AddItem(v->index);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,8 @@ public:
|
||||||
static const char *GetClassName() { return "AIVehicleList_Station"; }
|
static const char *GetClassName() { return "AIVehicleList_Station"; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param station_id The station to get the list of vehicles that have orders to him from.
|
* @param station_id The station to get the list of vehicles from, which have orders to it.
|
||||||
|
* @pre AIBaseStation::IsValidBaseStation(station_id)
|
||||||
*/
|
*/
|
||||||
AIVehicleList_Station(StationID station_id);
|
AIVehicleList_Station(StationID station_id);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue