mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-06 03:52:37 +01:00
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user