diff options
author | frosch <frosch@openttd.org> | 2013-06-01 15:10:32 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2013-06-01 15:10:32 +0000 |
commit | 4261b6cc822fa03e5d2c9824fdd610d21c7b289f (patch) | |
tree | 78836a3dc158844b9061ded777544aa2237032df /src/strings.cpp | |
parent | ce110eed32eef08e7ce1c35a2c5893698afee73a (diff) | |
download | openttd-4261b6cc822fa03e5d2c9824fdd610d21c7b289f.tar.xz |
(svn r25314) -Fix (r25313): If '0' is the broadest digit, 0 * sum(10^i, i=0..(n-1)) is not the broadest n-digit number.
-Fix [FS#5562]: Proper size-estimation for numbers with n digits.
Diffstat (limited to 'src/strings.cpp')
-rw-r--r-- | src/strings.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/strings.cpp b/src/strings.cpp index 777d5ccf4..fcc8df60e 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -116,10 +116,11 @@ void SetDParamMaxValue(uint n, uint64 max_value, uint min_count, FontSize size) */ void SetDParamMaxDigits(uint n, uint count, FontSize size) { - uint biggest_digit = GetBroadestDigit(size); - uint64 val = biggest_digit; + uint front, next; + GetBroadestDigit(&front, &next, size); + uint64 val = count > 1 ? front : next; for (; count > 1; count--) { - val = 10 * val + biggest_digit; + val = 10 * val + next; } SetDParam(n, val); } |