summaryrefslogtreecommitdiff
path: root/src/strings.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-08-12 01:28:11 +0000
committersmatz <smatz@openttd.org>2009-08-12 01:28:11 +0000
commita29bbb1e1f8d6525746dd31cd5e47159d896cc84 (patch)
tree4c454595c0694c5585b691600bd4aedef69d9983 /src/strings.cpp
parentd58d053438557ec5c4d0f30a2c92713236962376 (diff)
downloadopenttd-a29bbb1e1f8d6525746dd31cd5e47159d896cc84.tar.xz
(svn r17157) -Add: localised decimal separator
Diffstat (limited to 'src/strings.cpp')
-rw-r--r--src/strings.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/strings.cpp b/src/strings.cpp
index e05229f1b..bd1b6abaa 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -252,13 +252,16 @@ static char *FormatBytes(char *buff, int64 number, const char *last)
id++;
}
+ const char *decimal_separator = _settings_game.locale.digit_decimal_separator;
+ if (decimal_separator == NULL) decimal_separator = _langpack->digit_decimal_separator;
+
if (number < 1024) {
id = 0;
buff += seprintf(buff, last, "%i", (int)number);
} else if (number < 1024 * 10) {
- buff += seprintf(buff, last, "%i.%02i", (int)number / 1024, (int)(number % 1024) * 100 / 1024);
+ buff += seprintf(buff, last, "%i%s%02i", (int)number / 1024, decimal_separator, (int)(number % 1024) * 100 / 1024);
} else if (number < 1024 * 100) {
- buff += seprintf(buff, last, "%i.%01i", (int)number / 1024, (int)(number % 1024) * 10 / 1024);
+ buff += seprintf(buff, last, "%i%s%01i", (int)number / 1024, decimal_separator, (int)(number % 1024) * 10 / 1024);
} else {
assert(number < 1024 * 1024);
buff += seprintf(buff, last, "%i", (int)number / 1024);