summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-10-22 16:30:09 +0000
committerrubidium <rubidium@openttd.org>2010-10-22 16:30:09 +0000
commit9f256e8785066c14206b7a988803f929228a71ff (patch)
treecd78cd8155120b31d1df3e410a4d88d3002ece46 /src
parent3a1a915c9af26759b121fb845b40708bc9db6cda (diff)
downloadopenttd-9f256e8785066c14206b7a988803f929228a71ff.tar.xz
(svn r21009) -Fix: for the compact notation 1.000.000k and 1.000M would be shown depending on the initial (and later rounded) value. Make everything that would round to 1.000.000k be drawn as 1.000M as well.
Diffstat (limited to 'src')
-rw-r--r--src/strings.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/strings.cpp b/src/strings.cpp
index 0d27bb9c0..912acfe65 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -339,7 +339,9 @@ static char *FormatGenericCurrency(char *buff, const CurrencySpec *spec, Money n
/* for huge numbers, compact the number into k or M */
if (compact) {
- if (number >= 1000000000) {
+ /* Take care of the 'k' rounding. Having 1 000 000 k
+ * and 1 000 M is inconsistent, so always use 1 000 M. */
+ if (number >= 1000000000 - 500) {
number = (number + 500000) / 1000000;
multiplier = "M";
} else if (number >= 1000000) {