|
@@ -2204,49 +2204,49 @@ CommandCost CmdBuildAirport(TileIndex ti
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
const AirportTileTable *it = as->table[layout];
|
|
|
do {
|
|
|
cost.AddCost(_price[PR_BUILD_STATION_AIRPORT]);
|
|
|
} while ((++it)->ti.x != -0x80);
|
|
|
|
|
|
if (flags & DC_EXEC) {
|
|
|
/* Always add the noise, so there will be no need to recalculate when option toggles */
|
|
|
nearest->noise_reached += newnoise_level;
|
|
|
|
|
|
st->AddFacility(FACIL_AIRPORT, tile);
|
|
|
st->airport.type = airport_type;
|
|
|
st->airport.layout = layout;
|
|
|
st->airport.flags = 0;
|
|
|
st->airport.rotation = rotation;
|
|
|
|
|
|
st->rect.BeforeAddRect(tile, w, h, StationRect::ADD_TRY);
|
|
|
|
|
|
it = as->table[layout];
|
|
|
do {
|
|
|
TileIndex cur_tile = tile + ToTileIndexDiff(it->ti);
|
|
|
MakeAirport(cur_tile, st->owner, st->index, it->gfx);
|
|
|
MakeAirport(cur_tile, st->owner, st->index, it->gfx, WATER_CLASS_INVALID);
|
|
|
SetStationTileRandomBits(cur_tile, GB(Random(), 0, 4));
|
|
|
st->airport.Add(cur_tile);
|
|
|
|
|
|
if (AirportTileSpec::Get(GetTranslatedAirportTileID(it->gfx))->animation_info != 0xFFFF) AddAnimatedTile(cur_tile);
|
|
|
} while ((++it)->ti.x != -0x80);
|
|
|
|
|
|
/* Only call the animation trigger after all tiles have been built */
|
|
|
it = as->table[layout];
|
|
|
do {
|
|
|
TileIndex cur_tile = tile + ToTileIndexDiff(it->ti);
|
|
|
AirportTileAnimationTrigger(st, cur_tile, AAT_BUILT);
|
|
|
} while ((++it)->ti.x != -0x80);
|
|
|
|
|
|
/* if airport was demolished while planes were en-route to it, the
|
|
|
* positions can no longer be the same (v->u.air.pos), since different
|
|
|
* airports have different indexes. So update all planes en-route to this
|
|
|
* airport. Only update if
|
|
|
* 1. airport is upgraded
|
|
|
* 2. airport is added to existing station (unfortunately unavoideable)
|
|
|
*/
|
|
|
if (airport_upgrade) UpdateAirplanesOnNewStation(st);
|
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
UpdateStationAcceptance(st, false);
|