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

Method Get

src/newgrf_airport.cpp:59–71  ·  view source on GitHub ↗

* Retrieve airport spec for the given airport. If an override is available * it is returned. * @param type index of airport * @return A pointer to the corresponding AirportSpec */ static */

Source from the content-addressed store, hash-verified

57 * @return A pointer to the corresponding AirportSpec
58 */
59/* static */ const AirportSpec *AirportSpec::Get(uint8_t type)
60{
61 assert(type < lengthof(AirportSpec::specs));
62 const AirportSpec *as = &AirportSpec::specs[type];
63 if (type >= NEW_AIRPORT_OFFSET && !as->enabled) {
64 if (_airport_mngr.GetGRFID(type) == 0) return as;
65 uint8_t subst_id = _airport_mngr.GetSubstituteID(type);
66 if (subst_id == AT_INVALID) return as;
67 as = &AirportSpec::specs[subst_id];
68 }
69 if (as->grf_prop.override_id != AT_INVALID) return &AirportSpec::specs[as->grf_prop.override_id];
70 return as;
71}
72
73/**
74 * Retrieve airport spec for the given airport. Even if an override is

Callers

nothing calls this directly

Calls 2

GetSubstituteIDMethod · 0.80
GetGRFIDMethod · 0.45

Tested by

no test coverage detected