summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2019-03-20 22:46:02 +0100
committerCharles Pigott <charlespigott@googlemail.com>2019-03-21 19:15:59 +0000
commit2cf7ac2863028181bfdb5e3d63dc1f37bf604e72 (patch)
tree8606a13ced9272624691aa673c87c3133163de3c /src
parent1585c12bb9b0306739320e70513195d11206da2c (diff)
downloadopenttd-2cf7ac2863028181bfdb5e3d63dc1f37bf604e72.tar.xz
Fix #7391, 9b99b95: Don't invalidate go to depot orders of non-aircraft when invalidating hangar orders that happen to share IDs.
This was caused because hangars are referred to by station ID, which is not unique with respect to depot IDs.
Diffstat (limited to 'src')
-rw-r--r--src/order_backup.cpp1
-rw-r--r--src/order_cmd.cpp3
2 files changed, 3 insertions, 1 deletions
diff --git a/src/order_backup.cpp b/src/order_backup.cpp
index 1d490e726..38c4c8e67 100644
--- a/src/order_backup.cpp
+++ b/src/order_backup.cpp
@@ -263,6 +263,7 @@ CommandCost CmdClearOrderBackup(TileIndex tile, DoCommandFlag flags, uint32 p1,
for (Order *order = ob->orders; order != NULL; order = order->next) {
OrderType ot = order->GetType();
if (ot == OT_GOTO_DEPOT && (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0) continue;
+ if (ot == OT_GOTO_DEPOT && hangar && !IsHangarTile(ob->tile)) continue; // Not an aircraft? Can't have a hangar order.
if (ot == OT_IMPLICIT || (IsHangarTile(ob->tile) && ot == OT_GOTO_DEPOT && !hangar)) ot = OT_GOTO_STATION;
if (ot == type && order->GetDestination() == destination) {
/* Remove the order backup! If a station/depot gets removed, we can't/shouldn't restore those broken orders. */
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 007cfa5ec..dae6e58ad 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -1851,7 +1851,7 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination, bool
order = &v->current_order;
if ((v->type == VEH_AIRCRAFT && order->IsType(OT_GOTO_DEPOT) && !hangar ? OT_GOTO_STATION : order->GetType()) == type &&
- v->current_order.GetDestination() == destination) {
+ (!hangar || v->type == VEH_AIRCRAFT) && v->current_order.GetDestination() == destination) {
order->MakeDummy();
SetWindowDirty(WC_VEHICLE_VIEW, v->index);
}
@@ -1864,6 +1864,7 @@ restart:
OrderType ot = order->GetType();
if (ot == OT_GOTO_DEPOT && (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0) continue;
+ if (ot == OT_GOTO_DEPOT && hangar && v->type != VEH_AIRCRAFT) continue; // Not an aircraft? Can't have a hangar order.
if (ot == OT_IMPLICIT || (v->type == VEH_AIRCRAFT && ot == OT_GOTO_DEPOT && !hangar)) ot = OT_GOTO_STATION;
if (ot == type && order->GetDestination() == destination) {
/* We want to clear implicit orders, but we don't want to make them