From 3555f26ae6b43e17d1ed72fe72e1147468ffefde Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 24 Nov 2025 22:19:25 +0000 Subject: [PATCH] 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. --- src/newgrf_badge_gui.cpp | 1 + src/newgrf_badge_type.h | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/newgrf_badge_gui.cpp b/src/newgrf_badge_gui.cpp index 93e133cf99..525f751a3a 100644 --- a/src/newgrf_badge_gui.cpp +++ b/src/newgrf_badge_gui.cpp @@ -133,6 +133,7 @@ int DrawBadgeNameList(Rect r, std::span 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; diff --git a/src/newgrf_badge_type.h b/src/newgrf_badge_type.h index f23daf2f9a..59864c20af 100644 --- a/src/newgrf_badge_type.h +++ b/src/newgrf_badge_type.h @@ -24,10 +24,11 @@ template <> struct std::hash { }; 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. };