diff src/station_cmd.cpp @ 6394:d1cf5ac55918 draft

(svn r9524) -Fix(FS#640,r8755): Implemented a "dummy" State Machine for stations who got their airport removed while there were still aircraft within the State Machine (and thus caused asserts)
author celestar <celestar@openttd.org>
date Thu, 29 Mar 2007 13:52:34 +0000 (2007-03-29)
parents 4e4f7827e7ed
children b0b11d9fe257
line wrap: on
line diff
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1600,6 +1600,13 @@
 
 	int32 cost = w * h * _price.remove_airport;
 
+	Vehicle *v;
+	FOR_ALL_VEHICLES(v) {
+		if (!(v->type == VEH_AIRCRAFT && IsNormalAircraft(v))) continue;
+
+		if (v->u.air.targetairport == st->index && v->u.air.state != FLYING) return CMD_ERROR;
+	}
+
 	BEGIN_TILE_LOOP(tile_cur, w, h, tile) {
 		if (!EnsureNoVehicle(tile_cur)) return CMD_ERROR;