virtual */
| 269 | } |
| 270 | |
| 271 | /* virtual */ uint32_t StationScopeResolver::GetVariable(uint8_t variable, [[maybe_unused]] uint32_t parameter, bool &available) const |
| 272 | { |
| 273 | if (this->st == nullptr) { |
| 274 | /* Station does not exist, so we're in a purchase list or the land slope check callback. */ |
| 275 | switch (variable) { |
| 276 | case 0x40: |
| 277 | case 0x41: |
| 278 | case 0x46: |
| 279 | case 0x47: |
| 280 | case 0x49: return 0x2110000; // Platforms, tracks & position |
| 281 | case 0x42: return 0; // Rail type (XXX Get current type from GUI?) |
| 282 | case 0x43: return GetCompanyInfo(_current_company); // Station owner |
| 283 | case 0x44: return 2; // PBS status |
| 284 | case 0x67: // Land info of nearby tile |
| 285 | if (this->axis != INVALID_AXIS && this->tile != INVALID_TILE) { |
| 286 | TileIndex tile = this->tile; |
| 287 | if (parameter != 0) tile = GetNearbyTile(parameter, tile, true, this->axis); // only perform if it is required |
| 288 | |
| 289 | Slope tileh = GetTileSlope(tile); |
| 290 | bool swap = (this->axis == AXIS_Y && HasBit(tileh, CORNER_W) != HasBit(tileh, CORNER_E)); |
| 291 | |
| 292 | return GetNearbyTileInformation(tile, this->ro.grffile->grf_version >= 8) ^ (swap ? SLOPE_EW : 0); |
| 293 | } |
| 294 | break; |
| 295 | |
| 296 | case 0x7A: return GetBadgeVariableResult(*this->ro.grffile, this->statspec->badges, parameter); |
| 297 | |
| 298 | case 0xFA: return ClampTo<uint16_t>(TimerGameCalendar::date - CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR); // Build date, clamped to a 16 bit value |
| 299 | } |
| 300 | |
| 301 | available = false; |
| 302 | return UINT_MAX; |
| 303 | } |
| 304 | |
| 305 | switch (variable) { |
| 306 | /* Calculated station variables */ |
| 307 | case 0x40: |
| 308 | if (!this->cache.v40.has_value()) this->cache.v40 = GetPlatformInfoHelper(this->tile, false, false, false); |
| 309 | return *this->cache.v40; |
| 310 | |
| 311 | case 0x41: |
| 312 | if (!this->cache.v41.has_value()) this->cache.v41 = GetPlatformInfoHelper(this->tile, true, false, false); |
| 313 | return *this->cache.v41; |
| 314 | |
| 315 | case 0x42: return GetTerrainType(this->tile) | (GetReverseRailTypeTranslation(GetRailType(this->tile), this->statspec->grf_prop.grffile) << 8); |
| 316 | case 0x43: return GetCompanyInfo(this->st->owner); // Station owner |
| 317 | case 0x44: return HasStationReservation(this->tile) ? 7 : 4; // PBS status |
| 318 | case 0x45: |
| 319 | if (!this->cache.v45.has_value()) this->cache.v45 = GetRailContinuationInfo(this->tile); |
| 320 | return *this->cache.v45; |
| 321 | |
| 322 | case 0x46: |
| 323 | if (!this->cache.v46.has_value()) this->cache.v46 = GetPlatformInfoHelper(this->tile, false, false, true); |
| 324 | return *this->cache.v46; |
| 325 | |
| 326 | case 0x47: |
| 327 | if (!this->cache.v47.has_value()) this->cache.v47 = GetPlatformInfoHelper(this->tile, true, false, true); |
| 328 | return *this->cache.v47; |
nothing calls this directly
no test coverage detected