summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-03-06 01:58:55 +0000
committeryexo <yexo@openttd.org>2010-03-06 01:58:55 +0000
commit1eb52326cf810d9ea4380cd97ac84daaf4f358d8 (patch)
tree6cc4e7d4729107bbadee7be748c0b786410101c6 /src/station_cmd.cpp
parent46d5ef925beed4acb7d7e3d7b966bceb28db7e21 (diff)
downloadopenttd-1eb52326cf810d9ea4380cd97ac84daaf4f358d8.tar.xz
(svn r19331) -Fix: when deleting an airport the size from the AirportSpec was used instead of the stored airport size
-Fix (r19319): detecting if a plane was landed at an airport failed -Fix: reset the airporttile mapping when restarting a game
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 45fa5ce06..17d110401 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2229,10 +2229,6 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
tile = st->airport.tile;
- const AirportSpec *as = st->GetAirportSpec();
- int w = as->size_x;
- int h = as->size_y;
-
CommandCost cost(EXPENSES_CONSTRUCTION);
const Aircraft *a;
@@ -2244,7 +2240,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
TILE_AREA_LOOP(tile_cur, st->airport) {
if (!st->TileBelongsToAirport(tile_cur)) continue;
- CommandCost ret = EnsureNoVehicleOnGround(tile);
+ CommandCost ret = EnsureNoVehicleOnGround(tile_cur);
ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
@@ -2257,6 +2253,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
}
if (flags & DC_EXEC) {
+ const AirportSpec *as = st->GetAirportSpec();
for (uint i = 0; i < as->nof_depots; ++i) {
DeleteWindowById(
WC_VEHICLE_DEPOT, st->GetHangarTile(i)
@@ -2269,7 +2266,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
Town *nearest = AirportGetNearestTown(as, tile);
nearest->noise_reached -= GetAirportNoiseLevelForTown(as, nearest->xy, tile);
- st->rect.AfterRemoveRect(st, tile, w, h);
+ st->rect.AfterRemoveRect(st, tile, st->airport.w, st->airport.h);
st->airport.Clear();
st->facilities &= ~FACIL_AIRPORT;