diff --git a/src/newgrf_badge_gui.cpp b/src/newgrf_badge_gui.cpp index 491986c82b..0a1290fedb 100644 --- a/src/newgrf_badge_gui.cpp +++ b/src/newgrf_badge_gui.cpp @@ -243,6 +243,11 @@ private: using DropDownListBadgeItem = DropDownBadges, FS_SMALL, true>>; using DropDownListBadgeIconItem = DropDownBadges, FS_SMALL, true>>; +std::unique_ptr MakeDropDownListBadgeItem(const std::shared_ptr &gui_classes, std::span badges, GrfSpecFeature feature, std::optional introduction_date, std::string &&str, int value, bool masked, bool shaded) +{ + return std::make_unique(gui_classes, badges, feature, introduction_date, "", std::move(str), value, masked, shaded); +} + std::unique_ptr MakeDropDownListBadgeItem(const std::shared_ptr &gui_classes, std::span badges, GrfSpecFeature feature, std::optional introduction_date, Money cost, std::string &&str, int value, bool masked, bool shaded) { return std::make_unique(gui_classes, badges, feature, introduction_date, GetString(STR_JUST_CURRENCY_SHORT, cost), std::move(str), value, masked, shaded); diff --git a/src/newgrf_badge_gui.h b/src/newgrf_badge_gui.h index b908cf7f55..bd47f05aaf 100644 --- a/src/newgrf_badge_gui.h +++ b/src/newgrf_badge_gui.h @@ -50,6 +50,7 @@ private: int DrawBadgeNameList(Rect r, std::span badges, GrfSpecFeature feature); void DrawBadgeColumn(Rect r, int column_group, const GUIBadgeClasses &gui_classes, std::span badges, GrfSpecFeature feature, std::optional introduction_date, PaletteID remap); +std::unique_ptr MakeDropDownListBadgeItem(const std::shared_ptr &gui_classes, std::span badges, GrfSpecFeature feature, std::optional introduction_date, std::string &&str, int value, bool masked = false, bool shaded = false); std::unique_ptr MakeDropDownListBadgeItem(const std::shared_ptr &gui_classes, std::span badges, GrfSpecFeature feature, std::optional introduction_date, Money cost, std::string &&str, int value, bool masked = false, bool shaded = false); std::unique_ptr MakeDropDownListBadgeIconItem(const std::shared_ptr &gui_classes, std::span badges, GrfSpecFeature feature, std::optional introduction_date, Money cost, const Dimension &dim, SpriteID sprite, PaletteID palette, std::string &&str, int value, bool masked = false, bool shaded = false); diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index a0d8688096..f577582df0 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -2065,7 +2065,7 @@ DropDownList GetRailTypeDropDownList(bool for_replacement, bool all_option) const RailTypeInfo *rti = GetRailTypeInfo(rt); if (for_replacement) { - list.push_back(MakeDropDownListBadgeItem(badge_class_list, rti->badges, GSF_RAILTYPES, rti->introduction_date, RailBuildCost(rt), GetString(rti->strings.replace_text), rt, !avail_railtypes.Test(rt))); + list.push_back(MakeDropDownListBadgeItem(badge_class_list, rti->badges, GSF_RAILTYPES, rti->introduction_date, GetString(rti->strings.replace_text), rt, !avail_railtypes.Test(rt))); } else { std::string str = rti->max_speed > 0 ? GetString(STR_TOOLBAR_RAILTYPE_VELOCITY, rti->strings.menu_text, rti->max_speed) diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 3e37167a76..7928f9c5a5 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -1805,7 +1805,7 @@ DropDownList GetRoadTypeDropDownList(RoadTramTypes rtts, bool for_replacement, b const RoadTypeInfo *rti = GetRoadTypeInfo(rt); if (for_replacement) { - list.push_back(MakeDropDownListBadgeItem(badge_class_list, rti->badges, GSF_ROADTYPES, rti->introduction_date, RoadBuildCost(rt), GetString(rti->strings.replace_text), rt, !avail_roadtypes.Test(rt))); + list.push_back(MakeDropDownListBadgeItem(badge_class_list, rti->badges, GSF_ROADTYPES, rti->introduction_date, GetString(rti->strings.replace_text), rt, !avail_roadtypes.Test(rt))); } else { std::string str = rti->max_speed > 0 ? GetString(STR_TOOLBAR_RAILTYPE_VELOCITY, rti->strings.menu_text, rti->max_speed / 2)