summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-05-31 09:33:12 +0000
committersmatz <smatz@openttd.org>2009-05-31 09:33:12 +0000
commitab5a51d462e99d40dd2584b5fea60c0f1b9dffb1 (patch)
treeee834ace4c432255609f72f20e31dccee2e2ba29 /src
parent0eaec8edca83ee01ae164e75582630470a222924 (diff)
downloadopenttd-ab5a51d462e99d40dd2584b5fea60c0f1b9dffb1.tar.xz
(svn r16475) -Codechange: move code invalidating Vehicle::last_station_visited to more logical place
Diffstat (limited to 'src')
-rw-r--r--src/order_cmd.cpp5
-rw-r--r--src/station.cpp8
2 files changed, 8 insertions, 5 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 06f7029cc..6b0d56757 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -1458,11 +1458,6 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination)
FOR_ALL_VEHICLES(v) {
Order *order;
- /* Forget about this station if this station is removed */
- if (v->last_station_visited == destination && type == OT_GOTO_STATION) {
- v->last_station_visited = INVALID_STATION;
- }
-
order = &v->current_order;
if ((v->type == VEH_AIRCRAFT && order->IsType(OT_GOTO_DEPOT) ? OT_GOTO_STATION : order->GetType()) == type &&
v->current_order.GetDestination() == destination) {
diff --git a/src/station.cpp b/src/station.cpp
index 279bfbee8..783b631c3 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -75,6 +75,14 @@ Station::~Station()
if (a->targetairport == this->index) a->targetairport = INVALID_STATION;
}
+ Vehicle *v;
+ FOR_ALL_VEHICLES(v) {
+ /* Forget about this station if this station is removed */
+ if (v->last_station_visited == destination && type == OT_GOTO_STATION) {
+ v->last_station_visited = INVALID_STATION;
+ }
+ }
+
MarkDirty();
InvalidateWindowData(WC_STATION_LIST, this->owner, 0);