* @note Used by the resolver to get values for feature 07 deterministic spritegroups. */ virtual */
| 308 | * @note Used by the resolver to get values for feature 07 deterministic spritegroups. |
| 309 | */ |
| 310 | /* virtual */ uint32_t HouseScopeResolver::GetVariable(uint8_t variable, [[maybe_unused]] uint32_t parameter, bool &available) const |
| 311 | { |
| 312 | if (this->tile == INVALID_TILE) { |
| 313 | /* House does not yet exist, nor is it being planned to exist. Provide some default values instead. */ |
| 314 | switch (variable) { |
| 315 | case 0x40: return TOWN_HOUSE_COMPLETED | this->view << 2; /* Construction stage. */ |
| 316 | case 0x41: return 0; |
| 317 | case 0x42: return 0; |
| 318 | case 0x43: return 0; |
| 319 | case 0x44: return 0; |
| 320 | case 0x45: return _generating_world ? 1 : 0; |
| 321 | case 0x46: return 0; |
| 322 | case 0x47: return 0; |
| 323 | case 0x60: return 0; |
| 324 | case 0x61: return 0; |
| 325 | case 0x62: return 0; |
| 326 | case 0x63: return 0; |
| 327 | case 0x64: return 0; |
| 328 | case 0x65: return 0; |
| 329 | case 0x66: return 0xFFFFFFFF; /* Class and ID of nearby house. */ |
| 330 | case 0x67: return 0; |
| 331 | |
| 332 | case 0x7A: return GetBadgeVariableResult(*this->ro.grffile, HouseSpec::Get(this->house_id)->badges, parameter); |
| 333 | } |
| 334 | |
| 335 | Debug(grf, 1, "Unhandled house variable 0x{:X}", variable); |
| 336 | available = false; |
| 337 | return UINT_MAX; |
| 338 | } |
| 339 | |
| 340 | switch (variable) { |
| 341 | /* Construction stage. */ |
| 342 | case 0x40: return (IsTileType(this->tile, MP_HOUSE) ? GetHouseBuildingStage(this->tile) : 0) | TileHash2Bit(TileX(this->tile), TileY(this->tile)) << 2; |
| 343 | |
| 344 | /* Building age. */ |
| 345 | case 0x41: return IsTileType(this->tile, MP_HOUSE) ? GetHouseAge(this->tile).base() : 0; |
| 346 | |
| 347 | /* Town zone */ |
| 348 | case 0x42: return to_underlying(GetTownRadiusGroup(this->town, this->tile)); |
| 349 | |
| 350 | /* Terrain type */ |
| 351 | case 0x43: return GetTerrainType(this->tile); |
| 352 | |
| 353 | /* Number of this type of building on the map. */ |
| 354 | case 0x44: return GetNumHouses(this->house_id, this->town); |
| 355 | |
| 356 | /* Whether the town is being created or just expanded. */ |
| 357 | case 0x45: return _generating_world ? 1 : 0; |
| 358 | |
| 359 | /* Current animation frame. */ |
| 360 | case 0x46: return IsTileType(this->tile, MP_HOUSE) ? GetAnimationFrame(this->tile) : 0; |
| 361 | |
| 362 | /* Position of the house */ |
| 363 | case 0x47: return TileY(this->tile) << 16 | TileX(this->tile); |
| 364 | |
| 365 | /* Building counts for old houses with id = parameter. */ |
| 366 | case 0x60: return parameter < NEW_HOUSE_OFFSET ? GetNumHouses(parameter, this->town) : 0; |
| 367 |
nothing calls this directly
no test coverage detected