MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetNoiseLevelIncrease

Method GetNoiseLevelIncrease

src/script/api/script_airport.cpp:131–147  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

129
130
131/* static */ SQInteger ScriptAirport::GetNoiseLevelIncrease(TileIndex tile, AirportType type)
132{
133 if (!::IsValidTile(tile)) return -1;
134 if (!IsAirportInformationAvailable(type)) return -1;
135
136 const AirportSpec *as = ::AirportSpec::Get(type);
137 if (!as->IsWithinMapBounds(0, tile)) return -1;
138
139 if (_settings_game.economy.station_noise_level) {
140 uint dist;
141 const auto &layout = as->layouts[0];
142 AirportGetNearestTown(as, layout.rotation, tile, AirportTileTableIterator(layout.tiles, tile), dist);
143 return GetAirportNoiseLevelForDistance(as, dist);
144 }
145
146 return 1;
147}
148
149/* static */ TownID ScriptAirport::GetNearestTown(TileIndex tile, AirportType type)
150{

Callers

nothing calls this directly

Calls 5

IsValidTileFunction · 0.85
AirportGetNearestTownFunction · 0.85
IsWithinMapBoundsMethod · 0.80

Tested by

no test coverage detected