summaryrefslogtreecommitdiff
path: root/station_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2004-12-18 12:40:34 +0000
committertron <tron@openttd.org>2004-12-18 12:40:34 +0000
commit11d477044c1e1c85e959ac659ac6c7b254020a60 (patch)
tree91b74179860d67a6e0124d708639b0e97d56c8ab /station_cmd.c
parent91d23f426e105dc73c0f8999c0e953a64fb42ef6 (diff)
downloadopenttd-11d477044c1e1c85e959ac659ac6c7b254020a60.tar.xz
(svn r1150) Fixes:
- Don't crash when building or destroying airport without depots (bugs were latent before r1149) - Delete all hangar windows when destroying an airport, not just the first one (before r1149 none where deleted)
Diffstat (limited to 'station_cmd.c')
-rw-r--r--station_cmd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/station_cmd.c b/station_cmd.c
index 9c2f6cf8f..a45235642 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -1651,8 +1651,12 @@ END_TILE_LOOP(tile_cur, w,h,tile)
}
if (flags & DC_EXEC) {
- if (st->airport_type <= AT_INTERNATIONAL)
- DeleteWindowById(WC_VEHICLE_DEPOT, tile + GetAirport(st->airport_type)->airport_depots[0]);
+ const AirportFTAClass *afc = GetAirport(st->airport_type);
+ uint i;
+
+ for (i = 0; i < afc->nof_depots; ++i)
+ DeleteWindowById(WC_VEHICLE_DEPOT,
+ tile + GetAirport(st->airport_type)->airport_depots[i]);
st->airport_tile = 0;
st->facilities &= ~FACIL_AIRPORT;