Skip to content

Commit

Permalink
Fix #10600: 'Replace Vehicles' didn't show numbers >999 (#10680)
Browse files Browse the repository at this point in the history
(cherry picked from commit 71c2878)
  • Loading branch information
carlossss111 authored and JGRennison committed Sep 23, 2023
1 parent 3ef6ecc commit ef91136
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/build_vehicle_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,15 @@ void DrawEngineList(VehicleType type, const Rect &r, const GUIEngineList &eng_li
int count_width = 0;
if (show_count) {
replace_icon = GetSpriteSize(SPR_GROUP_REPLACE_ACTIVE);
SetDParamMaxDigits(0, 3, FS_SMALL);

uint biggest_num_engines = 0;
for (auto i = min; i < max; i++) {
const auto &item = eng_list[i];
const uint num_engines = GetGroupNumEngines(_local_company, selected_group, item.engine_id);
biggest_num_engines = std::max(biggest_num_engines, num_engines);
}

SetDParam(0, biggest_num_engines);
count_width = GetStringBoundingBox(STR_JUST_COMMA, FS_SMALL).width;
}

Expand Down

0 comments on commit ef91136

Please sign in to comment.