diff options
author | rubidium <rubidium@openttd.org> | 2010-08-06 19:04:21 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-08-06 19:04:21 +0000 |
commit | 90a35d2e5b3728a8cd7fe1717d6c940b525cca9e (patch) | |
tree | c069c37fe0b72cad7b5c053f49ff13ea7213f702 /src/ai/api/ai_order.hpp | |
parent | d54f2ba21f2711d3ce8fe9f19fd7ab6645107c5b (diff) | |
download | openttd-90a35d2e5b3728a8cd7fe1717d6c940b525cca9e.tar.xz |
(svn r20389) [NoAI] -Add: AIOrder::IsVoidOrder to find void "(Invalid Order)" orders.
[NoAI] -Change: AIOrder::GetOrderFlags returns AIOrder::AIOF_INVALID for void orders.
Diffstat (limited to 'src/ai/api/ai_order.hpp')
-rw-r--r-- | src/ai/api/ai_order.hpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/ai/api/ai_order.hpp b/src/ai/api/ai_order.hpp index 4bdd3f560..8f142f3a6 100644 --- a/src/ai/api/ai_order.hpp +++ b/src/ai/api/ai_order.hpp @@ -173,6 +173,18 @@ public: static bool IsConditionalOrder(VehicleID vehicle_id, OrderPosition order_position); /** + * Checks whether the given order is a void order. + * A void order is an order that used to be a goto station, depot or waypoint order but + * its destination got removed. In OpenTTD these orders as shown as "(Invalid Order)" + * in the order list of a vehicle. + * @param vehicle_id The vehicle to check. + * @param order_position The order index to check. + * @pre order_position != ORDER_CURRENT && IsValidVehicleOrder(vehicle_id, order_position). + * @return True if and only if the order is a void order. + */ + static bool IsVoidOrder(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). @@ -240,7 +252,7 @@ public: * @param vehicle_id The vehicle to get the destination for. * @param order_position The order to get the destination for. * @pre IsValidVehicleOrder(vehicle_id, order_position). - * @pre order_position == ORDER_CURRENT || !IsConditionalOrder(vehicle_id, order_position). + * @pre order_position == ORDER_CURRENT || (!IsConditionalOrder(vehicle_id, order_position) && !IsVoidOrder(vehicle_id, order_position)). * @note Giving ORDER_CURRENT as order_position will give the order that is * currently being executed by the vehicle. This is not necessarily the * current order as given by ResolveOrderPosition (the current index in the |