From eb5039f81ec0dfcfc5e7b2dcbc1d8ea97f72c793 Mon Sep 17 00:00:00 2001 From: yexo Date: Sat, 8 Aug 2009 16:36:06 +0000 Subject: [PATCH] (svn r17112) -Change [NoAI]: AIVehicleList_Station now also works for waypoints --- src/ai/api/ai_changelog.hpp | 1 + src/ai/api/ai_vehiclelist.cpp | 4 ++-- src/ai/api/ai_vehiclelist.hpp | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ai/api/ai_changelog.hpp b/src/ai/api/ai_changelog.hpp index 01e0f7a242..5750ab0aca 100644 --- a/src/ai/api/ai_changelog.hpp +++ b/src/ai/api/ai_changelog.hpp @@ -31,6 +31,7 @@ * \li WAYPOINT_INVALID is now deprecated, use STATION_INVALID instead * \li AIs can create subclasses of API classes and use API constants as part * of their own constants + * \li AIVehicleList_Station now also works for waypoints * * \b 0.7.3 * diff --git a/src/ai/api/ai_vehiclelist.cpp b/src/ai/api/ai_vehiclelist.cpp index 52ca83dae7..011a48a7f7 100644 --- a/src/ai/api/ai_vehiclelist.cpp +++ b/src/ai/api/ai_vehiclelist.cpp @@ -19,7 +19,7 @@ AIVehicleList::AIVehicleList() AIVehicleList_Station::AIVehicleList_Station(StationID station_id) { - if (!AIStation::IsValidStation(station_id)) return; + if (!AIBaseStation::IsValidBaseStation(station_id)) return; const Vehicle *v; FOR_ALL_VEHICLES(v) { @@ -27,7 +27,7 @@ AIVehicleList_Station::AIVehicleList_Station(StationID station_id) const Order *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); break; } diff --git a/src/ai/api/ai_vehiclelist.hpp b/src/ai/api/ai_vehiclelist.hpp index 93332580be..1d441cd4ef 100644 --- a/src/ai/api/ai_vehiclelist.hpp +++ b/src/ai/api/ai_vehiclelist.hpp @@ -27,7 +27,8 @@ public: 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); };