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

Function FinaliseBadges

src/newgrf.cpp:1603–1627  ·  view source on GitHub ↗

Finish up applying badges to things */

Source from the content-addressed store, hash-verified

1601
1602/** Finish up applying badges to things */
1603static 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
1629extern void InitGRFTownGeneratorNames();
1630

Callers 1

AfterLoadGRFsFunction · 0.85

Calls 8

GetBadgeByLabelFunction · 0.85
byteswapFunction · 0.85
AddBadgeToSpecsFunction · 0.85
push_backMethod · 0.80
formatFunction · 0.50
SetMethod · 0.45

Tested by

no test coverage detected