diff options
author | tron <tron@openttd.org> | 2006-09-03 10:30:38 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-09-03 10:30:38 +0000 |
commit | 23168f630952490f6a548f1889e1a3b035b29f1d (patch) | |
tree | d1fcc0253686a550d7bd5beecb23ae1975b0e2f2 /order_cmd.c | |
parent | 1c21c645ae04601cd3711b37e6541d807cb727a7 (diff) | |
download | openttd-23168f630952490f6a548f1889e1a3b035b29f1d.tar.xz |
(svn r6355) -Fix: Go to hangar orders for aircraft could get spuriously removed when a road or rail depot got deleted (Darkvater and me)
This bug is probably ages old
Diffstat (limited to 'order_cmd.c')
-rw-r--r-- | order_cmd.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/order_cmd.c b/order_cmd.c index ee4981965..322448c5c 100644 --- a/order_cmd.c +++ b/order_cmd.c @@ -968,6 +968,10 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination) Order *order; bool need_invalidate; + /* Aircraft have StationIDs for depot orders and never use DepotIDs + * This fact is handled specially below + */ + /* Go through all vehicles */ FOR_ALL_VEHICLES(v) { if (v->orders == NULL) continue; @@ -977,7 +981,8 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination) v->last_station_visited = INVALID_STATION; /* Check the current order */ - if (v->current_order.type == type && v->current_order.dest == destination) { + if ((v->type == VEH_Aircraft && v->current_order.type == OT_GOTO_DEPOT ? OT_GOTO_STATION : v->current_order.type) == type && + v->current_order.dest == destination) { /* Mark the order as DUMMY */ v->current_order.type = OT_DUMMY; v->current_order.flags = 0; @@ -987,7 +992,8 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination) /* Clear the order from the order-list */ need_invalidate = false; FOR_VEHICLE_ORDERS(v, order) { - if (order->type == type && order->dest == destination) { + if ((v->type == VEH_Aircraft && order->type == OT_GOTO_DEPOT ? OT_GOTO_STATION : order->type) == type && + order->dest == destination) { /* Mark the order as DUMMY */ order->type = OT_DUMMY; order->flags = 0; |