summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-09-16 16:07:18 +0000
committersmatz <smatz@openttd.org>2008-09-16 16:07:18 +0000
commitcb16b68474c7d5becadfc950cbddc2008f567b47 (patch)
treef1c3418506ec0d5afba0b85d95ae8a50fbd9e7c5
parente6afe2ea0c33c2b73bd78a97e7dd5f40d1f18f9b (diff)
downloadopenttd-cb16b68474c7d5becadfc950cbddc2008f567b47.tar.xz
(svn r14344) -Fix: when a new airport is built in the same tick as the old station is deleted, aircraft may go crazy (and crash the game)
-rw-r--r--src/station.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/station.cpp b/src/station.cpp
index b74ef3783..17af0e5ec 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -32,6 +32,7 @@
#include "command_func.h"
#include "order_func.h"
#include "news_func.h"
+#include "aircraft.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -74,6 +75,13 @@ Station::~Station()
loading_vehicles.front()->LeaveStation();
}
+ Vehicle *v;
+ FOR_ALL_VEHICLES(v) {
+ if (v->type == VEH_AIRCRAFT && IsNormalAircraft(v) && v->u.air.targetairport == this->index) {
+ v->u.air.targetairport = INVALID_STATION;
+ }
+ }
+
MarkDirty();
InvalidateWindowData(WC_STATION_LIST, this->owner, 0);