diff options
author | yexo <yexo@openttd.org> | 2009-04-26 16:14:53 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2009-04-26 16:14:53 +0000 |
commit | 9101de49d8fbc0b1f5e067ca2cd8c5906f30e84a (patch) | |
tree | b441111de37f81dab27a535c5c3fe41360ba5fc6 /src/ai/api/ai_order.hpp | |
parent | 779640b53a212091e929a2d7603474ab7b2710f8 (diff) | |
download | openttd-9101de49d8fbc0b1f5e067ca2cd8c5906f30e84a.tar.xz |
(svn r16165) -Add [FS#2801] [NoAI]: several functions to AIOrder to check the what kind of order an order is.
-Fix: AIOrder::GetOrderDestination and AIOrder::GetOrderFlags didn't work on ORDER_CURRENT when the vehicle was loading/leaving in a station.
Diffstat (limited to 'src/ai/api/ai_order.hpp')
-rw-r--r-- | src/ai/api/ai_order.hpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/ai/api/ai_order.hpp b/src/ai/api/ai_order.hpp index 342ca4ada..14f20c258 100644 --- a/src/ai/api/ai_order.hpp +++ b/src/ai/api/ai_order.hpp @@ -119,6 +119,33 @@ public: static bool IsValidVehicleOrder(VehicleID vehicle_id, OrderPosition order_position); /** + * Checks whether the given order is a goto-station order. + * @param vehicle_id The vehicle to check. + * @param order_position The order index to check. + * @pre IsValidVehicleOrder(vehicle_id, order_position). + * @return True if and only if the order is a goto-station order. + */ + static bool IsGotoStationOrder(VehicleID vehicle_id, OrderPosition order_position); + + /** + * Checks whether the given order is a goto-depot order. + * @param vehicle_id The vehicle to check. + * @param order_position The order index to check. + * @pre IsValidVehicleOrder(vehicle_id, order_position). + * @return True if and only if the order is a goto-depot order. + */ + static bool IsGotoDepotOrder(VehicleID vehicle_id, OrderPosition order_position); + + /** + * Checks whether the given order is a goto-waypoint order. + * @param vehicle_id The vehicle to check. + * @param order_position The order index to check. + * @pre IsValidVehicleOrder(vehicle_id, order_position). + * @return True if and only if the order is a goto-waypoint order. + */ + static bool IsGotoWaypointOrder(VehicleID vehicle_id, OrderPosition order_position); + + /** * Checks whether the given order is a conditional order. * @param vehicle_id The vehicle to check. * @param order_position The order index to check. @@ -128,6 +155,17 @@ public: static bool IsConditionalOrder(VehicleID vehicle_id, OrderPosition order_position); /** + * Checks whether the current order is part of the orderlist. + * @param vehicle_id The vehicle to check. + * @pre AIVehicle::IsValidVehicle(vehicle_id). + * @return True if and only if the current order is part of the order list. + * @note If the order is a non-'non-stop' order, and the vehicle is currently + * (un)loading at a station that is not the final destination, this function + * will still return true. + */ + static bool IsCurrentOrderPartOfOrderList(VehicleID vehicle_id); + + /** * Resolves the given order index to the correct index for the given vehicle. * If the order index was ORDER_CURRENT it will be resolved to the index of * the current order (as shown in the order list). If the order with the |