diff options
author | rubidium <rubidium@openttd.org> | 2009-12-20 16:44:41 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-12-20 16:44:41 +0000 |
commit | 1ea8cb4fc45d22ff7aedcbe883c8757e8ac3e7fa (patch) | |
tree | 97672f745a19d10b61b0f3d2cf50392550a209be /src/vehicle_gui.cpp | |
parent | 90b7f0f3cb6e42e62a445e43407e4c543f55306f (diff) | |
download | openttd-1ea8cb4fc45d22ff7aedcbe883c8757e8ac3e7fa.tar.xz |
(svn r18576) -Codechange: use the function to determine the width of digits for determining the width of the unitnumber in vehicle lists.
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r-- | src/vehicle_gui.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index d4cd7212e..830c022b5 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -110,11 +110,11 @@ void BaseVehicleListWindow::BuildVehicleList(Owner owner, uint16 index, uint16 w * wider numbers to determine the width instead of just * the random number that it seems to be. */ if (unitnumber >= 1000) { - this->max_unitnumber = 9999; + this->unitnumber_digits = 4; } else if (unitnumber >= 100) { - this->max_unitnumber = 999; + this->unitnumber_digits = 3; } else { - this->max_unitnumber = 99; + this->unitnumber_digits = 2; } this->vehicles.RebuildDone(); @@ -908,8 +908,7 @@ void BaseVehicleListWindow::DrawVehicleListItems(VehicleID selected_vehicle, int int width = right - left; bool rtl = _dynlang.text_dir == TD_RTL; - SetDParam(0, this->max_unitnumber); - int text_offset = GetStringBoundingBox(STR_JUST_INT).width + WD_FRAMERECT_RIGHT; + int text_offset = GetDigitWidth() * this->unitnumber_digits + WD_FRAMERECT_RIGHT; int text_left = left + (rtl ? 0 : text_offset); int text_right = right - (rtl ? text_offset : 0); |