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

Method GetVariable

src/newgrf_airport.cpp:161–183  ·  view source on GitHub ↗

virtual */

Source from the content-addressed store, hash-verified

159}
160
161/* virtual */ uint32_t AirportScopeResolver::GetVariable(uint8_t variable, [[maybe_unused]] uint32_t parameter, bool &available) const
162{
163 switch (variable) {
164 case 0x40: return this->layout;
165
166 case 0x7A: return GetBadgeVariableResult(*this->ro.grffile, this->spec->badges, parameter);
167 }
168
169 if (this->st == nullptr) {
170 available = false;
171 return UINT_MAX;
172 }
173
174 switch (variable) {
175 /* Get a variable from the persistent storage */
176 case 0x7C: return (this->st->airport.psa != nullptr) ? this->st->airport.psa->GetValue(parameter) : 0;
177
178 case 0xF0: return this->st->facilities.base();
179 case 0xFA: return ClampTo<uint16_t>(this->st->build_date - CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR);
180 }
181
182 return this->st->GetNewGRFVariable(this->ro, variable, parameter, available);
183}
184
185GrfSpecFeature AirportResolverObject::GetFeature() const
186{

Callers

nothing calls this directly

Calls 4

GetBadgeVariableResultFunction · 0.85
GetNewGRFVariableMethod · 0.80
GetValueMethod · 0.45
baseMethod · 0.45

Tested by

no test coverage detected