From c38aa9cc869cfcc1182cd5e4969859ef1168a42b Mon Sep 17 00:00:00 2001 From: Rito12 <111280526+Rito13@users.noreply.github.com> Date: Fri, 14 Nov 2025 00:24:46 +0100 Subject: [PATCH] Fix #14701: Company colour remap for sprites in badge filter dropdowns. (#14732) --- src/build_vehicle_gui.cpp | 3 ++- src/newgrf_badge_gui.cpp | 5 +++-- src/newgrf_badge_gui.h | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index ea6efdcfc4..27deb5f430 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1731,7 +1731,8 @@ struct BuildVehicleWindow : Window { default: if (IsInsideMM(widget, this->badge_filters.first, this->badge_filters.second)) { - ShowDropDownList(this, this->GetWidget(widget)->GetDropDownList(), -1, widget, 0, false); + PaletteID palette = SPR_2CCMAP_BASE + Company::Get(_local_company)->GetCompanyRecolourOffset(LS_DEFAULT); + ShowDropDownList(this, this->GetWidget(widget)->GetDropDownList(palette), -1, widget, 0, false); } break; } diff --git a/src/newgrf_badge_gui.cpp b/src/newgrf_badge_gui.cpp index ff0a1d48c9..93e133cf99 100644 --- a/src/newgrf_badge_gui.cpp +++ b/src/newgrf_badge_gui.cpp @@ -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 { diff --git a/src/newgrf_badge_gui.h b/src/newgrf_badge_gui.h index e603308094..af2ed4cafc 100644 --- a/src/newgrf_badge_gui.h +++ b/src/newgrf_badge_gui.h @@ -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.