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

Function FinaliseAirportsArray

src/newgrf.cpp:1188–1209  ·  view source on GitHub ↗

* Add all new airports to the airport array. Airport properties can be set at any * time in the GRF file, so we can only add a airport spec to the airport array * after the file has finished loading. */

Source from the content-addressed store, hash-verified

1186 * after the file has finished loading.
1187 */
1188static void FinaliseAirportsArray()
1189{
1190 for (auto &file : _grf_files) {
1191 for (auto &as : file.airportspec) {
1192 if (as != nullptr && as->enabled) {
1193 _airport_mngr.SetEntitySpec(std::move(*as));
1194 }
1195 }
1196
1197 for (auto &ats : file.airtspec) {
1198 if (ats != nullptr && ats->enabled) {
1199 _airporttile_mngr.SetEntitySpec(std::move(*ats));
1200 }
1201 }
1202
1203 /* Won't be used again */
1204 file.airportspec.clear();
1205 file.airportspec.shrink_to_fit();
1206 file.airtspec.clear();
1207 file.airtspec.shrink_to_fit();
1208 }
1209}
1210
1211/** Helper class to invoke a GrfActionHandler. */
1212struct InvokeGrfActionHandler {

Callers 1

AfterLoadGRFsFunction · 0.85

Calls 2

SetEntitySpecMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected