1
0
Fork 0

Fix: Don't display badges if the class has no name.

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/13994/head
Peter Nelson 2025-04-13 15:53:08 +01:00
parent 7f82b181da
commit 0f0c3c10d6
No known key found for this signature in database
GPG Key ID: 8EF8F0A467DF75ED
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);
}