Skip to content

Commit ef91136

Browse files
carlossss111JGRennison
authored andcommitted
Fix #10600: 'Replace Vehicles' didn't show numbers >999 (#10680)
(cherry picked from commit 71c2878)
1 parent 3ef6ecc commit ef91136

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/build_vehicle_gui.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,15 @@ void DrawEngineList(VehicleType type, const Rect &r, const GUIEngineList &eng_li
12391239
int count_width = 0;
12401240
if (show_count) {
12411241
replace_icon = GetSpriteSize(SPR_GROUP_REPLACE_ACTIVE);
1242-
SetDParamMaxDigits(0, 3, FS_SMALL);
1242+
1243+
uint biggest_num_engines = 0;
1244+
for (auto i = min; i < max; i++) {
1245+
const auto &item = eng_list[i];
1246+
const uint num_engines = GetGroupNumEngines(_local_company, selected_group, item.engine_id);
1247+
biggest_num_engines = std::max(biggest_num_engines, num_engines);
1248+
}
1249+
1250+
SetDParam(0, biggest_num_engines);
12431251
count_width = GetStringBoundingBox(STR_JUST_COMMA, FS_SMALL).width;
12441252
}
12451253

0 commit comments

Comments
 (0)