1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2025-12-10 15:02:06 +01:00

Add: [NewGRF] Allow badges to be excluded from badge name list. (#14818)

This allows badges to have names that can be filtered, but avoid cluttering the purchase text.
This commit is contained in:
Peter Nelson
2025-11-24 22:19:25 +00:00
committed by GitHub
parent 5533a24d84
commit 3555f26ae6
2 changed files with 5 additions and 3 deletions

View File

@@ -133,6 +133,7 @@ int DrawBadgeNameList(Rect r, std::span<const BadgeID> badges, GrfSpecFeature)
const Badge *badge = GetBadge(index);
if (badge == nullptr || badge->name == STR_NULL) continue;
if (badge->class_index != class_index) continue;
if (badge->flags.Test(BadgeFlag::NameListSkip)) continue;
if (!s.empty()) {
if (badge->flags.Test(BadgeFlag::NameListFirstOnly)) continue;

View File

@@ -24,10 +24,11 @@ template <> struct std::hash<BadgeClassID> {
};
enum class BadgeFlag : uint8_t {
Copy = 0, ///< Copy badge to related things.
NameListStop = 1, ///< Stop adding names to the name list after this badge.
Copy = 0, ///< Copy badge to related things.
NameListStop = 1, ///< Stop adding names to the name list after this badge.
NameListFirstOnly = 2, ///< Don't add this name to the name list if not first.
UseCompanyColour = 3, ///< Apply company colour palette to this badge.
UseCompanyColour = 3, ///< Apply company colour palette to this badge.
NameListSkip = 4, ///< Don't show name in name list at all.
HasText, ///< Internal flag set if the badge has text.
};