1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-06 03:52:37 +01:00

Fix #14701: Company colour remap for sprites in badge filter dropdowns. (#14732)

This commit is contained in:
Rito12
2025-11-14 00:24:46 +01:00
committed by GitHub
parent dbe329733c
commit c38aa9cc86
3 changed files with 6 additions and 4 deletions

View File

@@ -1731,7 +1731,8 @@ struct BuildVehicleWindow : Window {
default:
if (IsInsideMM(widget, this->badge_filters.first, this->badge_filters.second)) {
ShowDropDownList(this, this->GetWidget<NWidgetBadgeFilter>(widget)->GetDropDownList(), -1, widget, 0, false);
PaletteID palette = SPR_2CCMAP_BASE + Company::Get(_local_company)->GetCompanyRecolourOffset(LS_DEFAULT);
ShowDropDownList(this, this->GetWidget<NWidgetBadgeFilter>(widget)->GetDropDownList(palette), -1, widget, 0, false);
}
break;
}

View File

@@ -508,9 +508,10 @@ std::string NWidgetBadgeFilter::GetStringParameter(const BadgeFilterChoices &cho
/**
* Get the drop down list of badges for this filter.
* @param palette Palette used to remap badge sprites.
* @return Drop down list for filter.
*/
DropDownList NWidgetBadgeFilter::GetDropDownList() const
DropDownList NWidgetBadgeFilter::GetDropDownList(PaletteID palette) const
{
DropDownList list;
@@ -533,7 +534,7 @@ DropDownList NWidgetBadgeFilter::GetDropDownList() const
if (badge.name == STR_NULL) continue;
if (!badge.features.Test(this->feature)) continue;
PalSpriteID ps = GetBadgeSprite(badge, this->feature, std::nullopt, PAL_NONE);
PalSpriteID ps = GetBadgeSprite(badge, this->feature, std::nullopt, palette);
if (ps.sprite == 0) {
list.push_back(MakeDropDownListStringItem(badge.name, badge.index.base()));
} else {

View File

@@ -65,7 +65,7 @@ public:
BadgeClassID GetBadgeClassID() const { return this->badge_class; }
std::string GetStringParameter(const BadgeFilterChoices &choices) const;
DropDownList GetDropDownList() const;
DropDownList GetDropDownList(PaletteID palette = PAL_NONE) const;
private:
GrfSpecFeature feature; ///< Feature of this dropdown.