1
0
Fork 0

Fix: Don't display badges if the class has no name. (#13994)

Unnamed badges are intended to be for internal-use, not for player information.

Additionally if there is no name to the class, then is causes problems when user configuration comes.
pull/13999/head
Peter Nelson 2025-04-13 18:00:41 +01:00 committed by GitHub
parent 369983846a
commit 4721a1f93e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -353,6 +353,9 @@ GUIBadgeClasses::GUIBadgeClasses(GrfSpecFeature feature)
uint max_column = 0;
for (BadgeClassID class_index : used.Classes()) {
const Badge *class_badge = GetClassBadge(class_index);
if (class_badge->name == STR_NULL) continue;
Dimension size = GetBadgeMaximalDimension(class_index, feature);
if (size.width == 0) continue;
@ -360,9 +363,7 @@ GUIBadgeClasses::GUIBadgeClasses(GrfSpecFeature feature)
bool visible = true;
uint sort_order = UINT_MAX;
std::string_view label = GetClassBadge(class_index)->label;
this->gui_classes.emplace_back(class_index, column, visible, sort_order, size, label);
this->gui_classes.emplace_back(class_index, column, visible, sort_order, size, class_badge->label);
if (visible) max_column = std::max<uint>(max_column, column);
}