Mercurial > hg > openttd
changeset 14072:7a6b0728bf33 draft
(svn r18615) -Fix: conditional orders were seen as 'valid' and as such aircraft with only conditional orders did not crash
author | rubidium <rubidium@openttd.org> |
---|---|
date | Wed, 23 Dec 2009 18:43:38 +0000 |
parents | 2c01d0796d1d |
children | 0d059932592a |
files | src/order_cmd.cpp |
diffstat | 1 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -1596,13 +1596,24 @@ * Check if a vehicle has any valid orders * * @return false if there are no valid orders + * @note Conditional orders are not considered valid destination orders * */ static bool CheckForValidOrders(const Vehicle *v) { const Order *order; - FOR_VEHICLE_ORDERS(v, order) if (!order->IsType(OT_DUMMY)) return true; + FOR_VEHICLE_ORDERS(v, order) { + switch (order->GetType()) { + case OT_GOTO_STATION: + case OT_GOTO_DEPOT: + case OT_GOTO_WAYPOINT: + return true; + + default: + break; + } + } return false; } @@ -1784,7 +1795,7 @@ const Order *order = v->GetOrder(v->cur_order_index); /* If no order, do nothing. */ - if (order == NULL || (v->type == VEH_AIRCRAFT && order->IsType(OT_DUMMY) && !CheckForValidOrders(v))) { + if (order == NULL || (v->type == VEH_AIRCRAFT && !CheckForValidOrders(v))) { if (v->type == VEH_AIRCRAFT) { /* Aircraft do something vastly different here, so handle separately */ extern void HandleMissingAircraftOrders(Aircraft *v);