virtual */
| 60 | } |
| 61 | |
| 62 | /* virtual */ uint32_t RoadTypeScopeResolver::GetVariable(uint8_t variable, [[maybe_unused]] uint32_t parameter, bool &available) const |
| 63 | { |
| 64 | if (this->tile == INVALID_TILE) { |
| 65 | switch (variable) { |
| 66 | case 0x40: return 0; |
| 67 | case 0x41: return 0; |
| 68 | case 0x42: return 0; |
| 69 | case 0x43: return TimerGameCalendar::date.base(); |
| 70 | case 0x44: return to_underlying(HouseZone::TownEdge); |
| 71 | case 0x45: { |
| 72 | RoadType rt = this->rti->Index(); |
| 73 | uint8_t local = GetReverseRoadTypeTranslation(rt, this->ro.grffile); |
| 74 | if (local == 0xFF) local = 0xFE; |
| 75 | if (RoadTypeIsRoad(rt)) { |
| 76 | return 0xFFFF00 | local; |
| 77 | } else { |
| 78 | return 0xFF00FF | local << 8; |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | switch (variable) { |
| 85 | case 0x40: return GetTerrainType(this->tile, this->context); |
| 86 | case 0x41: return 0; |
| 87 | case 0x42: return IsLevelCrossingTile(this->tile) && IsCrossingBarred(this->tile); |
| 88 | case 0x43: |
| 89 | if (IsRoadDepotTile(this->tile)) return Depot::GetByTile(this->tile)->build_date.base(); |
| 90 | return TimerGameCalendar::date.base(); |
| 91 | case 0x44: { |
| 92 | const Town *t = nullptr; |
| 93 | if (IsRoadDepotTile(this->tile)) { |
| 94 | t = Depot::GetByTile(this->tile)->town; |
| 95 | } else { |
| 96 | t = ClosestTownFromTile(this->tile, UINT_MAX); |
| 97 | } |
| 98 | return to_underlying(t != nullptr ? GetTownRadiusGroup(t, this->tile) : HouseZone::TownEdge); |
| 99 | } |
| 100 | case 0x45: |
| 101 | return GetTrackTypes(this->tile, ro.grffile); |
| 102 | } |
| 103 | |
| 104 | Debug(grf, 1, "Unhandled road type tile variable 0x{:X}", variable); |
| 105 | |
| 106 | available = false; |
| 107 | return UINT_MAX; |
| 108 | } |
| 109 | |
| 110 | GrfSpecFeature RoadTypeResolverObject::GetFeature() const |
| 111 | { |
nothing calls this directly
no test coverage detected