summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2011-03-05 13:59:23 +0000
committersmatz <smatz@openttd.org>2011-03-05 13:59:23 +0000
commit469c448eb0a596e37f2d365cf16ce16ebc3a58a7 (patch)
tree0576462ab8513046bc3cb5296d95fe814891e33e /src
parentb8d3c42de2cc4c0f441d40a10688f4ddd3db4b7f (diff)
downloadopenttd-469c448eb0a596e37f2d365cf16ce16ebc3a58a7.tar.xz
(svn r22200) -Fix (r21642): removing a station order could stop when removing first automatic order
Diffstat (limited to 'src')
-rw-r--r--src/order_cmd.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index f8a553024..4441a782b 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -1638,6 +1638,7 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination)
int id = -1;
FOR_VEHICLE_ORDERS(v, order) {
id++;
+restart:
OrderType ot = order->GetType();
if (ot == OT_GOTO_DEPOT && (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0) continue;
@@ -1647,9 +1648,10 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination)
* dummy orders. They should just vanish. Also check the actual order
* type as ot is currently OT_GOTO_STATION. */
if (order->IsType(OT_AUTOMATIC)) {
+ order = order->next; // DeleteOrder() invalidates current order
DeleteOrder(v, id);
- id--;
- continue;
+ if (order != NULL) goto restart;
+ break;
}
order->MakeDummy();