Finish up applying badges to things */
| 1601 | |
| 1602 | /** Finish up applying badges to things */ |
| 1603 | static void FinaliseBadges() |
| 1604 | { |
| 1605 | for (const auto &file : _grf_files) { |
| 1606 | Badge *badge = GetBadgeByLabel(fmt::format("newgrf/{:08x}", std::byteswap(file.grfid))); |
| 1607 | if (badge == nullptr) continue; |
| 1608 | |
| 1609 | for (Engine *e : Engine::Iterate()) { |
| 1610 | if (e->grf_prop.grffile != &file) continue; |
| 1611 | e->badges.push_back(badge->index); |
| 1612 | badge->features.Set(static_cast<GrfSpecFeature>(GSF_TRAINS + e->type)); |
| 1613 | } |
| 1614 | |
| 1615 | AddBadgeToSpecs(file.stations, GSF_STATIONS, *badge); |
| 1616 | AddBadgeToSpecs(file.housespec, GSF_HOUSES, *badge); |
| 1617 | AddBadgeToSpecs(file.industryspec, GSF_INDUSTRIES, *badge); |
| 1618 | AddBadgeToSpecs(file.indtspec, GSF_INDUSTRYTILES, *badge); |
| 1619 | AddBadgeToSpecs(file.objectspec, GSF_OBJECTS, *badge); |
| 1620 | AddBadgeToSpecs(file.airportspec, GSF_AIRPORTS, *badge); |
| 1621 | AddBadgeToSpecs(file.airtspec, GSF_AIRPORTTILES, *badge); |
| 1622 | AddBadgeToSpecs(file.roadstops, GSF_ROADSTOPS, *badge); |
| 1623 | } |
| 1624 | |
| 1625 | ApplyBadgeFeaturesToClassBadges(); |
| 1626 | AddBadgeClassesToConfiguration(); |
| 1627 | } |
| 1628 | |
| 1629 | extern void InitGRFTownGeneratorNames(); |
| 1630 |
no test coverage detected