@@ -2350,25 +2350,25 @@ CommandCost CmdBuildAirport(TileIndex ti
for (AirportTileTableIterator iter(as->table[layout], tile); iter != INVALID_TILE; ++iter) {
AirportTileAnimationTrigger(st, iter, AAT_BUILT);
}
UpdateAirplanesOnNewStation(st);
Company::Get(st->owner)->infrastructure.airport++;
st->AfterStationTileSetChange(true, STATION_AIRPORT);
InvalidateWindowData(WC_STATION_VIEW, st->index, -1);
if (_settings_game.economy.station_noise_level) {
SetWindowDirty(WC_TOWN_VIEW, st->town->index);
SetWindowDirty(WC_TOWN_VIEW, nearest->index);
return cost;
/**
* Remove an airport
* @param tile TileIndex been queried
* @param flags operation to perform
* @return cost or failure of operation
*/
@@ -2398,24 +2398,28 @@ static CommandCost RemoveAirport(TileInd
OrderBackup::Reset(tile_cur, false);
CloseWindowById(WC_VEHICLE_DEPOT, tile_cur);
const AirportSpec *as = st->airport.GetSpec();
/* The noise level is the noise from the airport and reduce it to account for the distance to the town center.
* And as for construction, always remove it, even if the setting is not set, in order to avoid the
* need of recalculation */
AirportTileIterator it(st);
uint dist;
Town *nearest = AirportGetNearestTown(as, it, dist);
nearest->noise_reached -= GetAirportNoiseLevelForDistance(as, dist);
for (TileIndex tile_cur : st->airport) {
if (!st->TileBelongsToAirport(tile_cur)) continue;
CommandCost ret = EnsureNoVehicleOnGround(tile_cur);
if (ret.Failed()) return ret;
cost.AddCost(_price[PR_CLEAR_STATION_AIRPORT]);
if (flags & DC_EXEC) {
DeleteAnimatedTile(tile_cur);
@@ -2426,28 +2430,24 @@ static CommandCost RemoveAirport(TileInd
/* Clear the persistent storage. */
delete st->airport.psa;
st->rect.AfterRemoveRect(st, st->airport);
st->airport.Clear();
st->facilities &= ~FACIL_AIRPORT;
Company::Get(st->owner)->infrastructure.airport--;
st->AfterStationTileSetChange(false, STATION_AIRPORT);
DeleteNewGRFInspectWindow(GSF_AIRPORTS, st->index);
* Open/close an airport to incoming aircraft.
Status change: