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

Method GetTypeName

src/town_gui.cpp:1530–1543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1528 static int GetClassIdFromHouseZone(HouseZones zones) { return FindFirstBit((zones & HZ_ZONE_ALL).base()) - to_underlying(HouseZone::TownEdge); }
1529
1530 StringID GetTypeName(int cls_id, int id) const override
1531 {
1532 const HouseSpec *spec = HouseSpec::Get(id);
1533 if (spec == nullptr) return INVALID_STRING_ID;
1534 if (!spec->enabled) return INVALID_STRING_ID;
1535 if (!spec->building_availability.Any(climate_mask)) return INVALID_STRING_ID;
1536 if (!spec->building_availability.Test(GetHouseZoneFromClassId(cls_id))) return INVALID_STRING_ID;
1537 for (int i = 0; i < cls_id; i++) {
1538 /* Don't include if it's already included in an earlier zone. */
1539 if (spec->building_availability.Test(GetHouseZoneFromClassId(i))) return INVALID_STRING_ID;
1540 }
1541
1542 return GetHouseName(spec);
1543 }
1544
1545 std::span<const BadgeID> GetTypeBadges(int cls_id, int id) const override
1546 {

Callers 5

SetClimateMaskMethod · 0.95
TypeTagNameFilterFunction · 0.45
DrawWidgetMethod · 0.45
BuildPickerTypeListMethod · 0.45

Calls 3

GetHouseNameFunction · 0.85
AnyMethod · 0.80
TestMethod · 0.80

Tested by

no test coverage detected