summaryrefslogtreecommitdiff
path: root/strings.c
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2006-09-15 02:52:17 +0000
committerbelugas <belugas@openttd.org>2006-09-15 02:52:17 +0000
commitf9ea48bf3d0fe0c4a00313c45c31c73be614e210 (patch)
tree0d7242b1c537ae7e104d4a21a28cdbf998409ea0 /strings.c
parent79971ac119941a0a31b23f211bce5c8ee64ad568 (diff)
downloadopenttd-f9ea48bf3d0fe0c4a00313c45c31c73be614e210.tar.xz
(svn r6454) -Fix(r6108) : Allow custom currency to display both prefix and suffix
-Codechange : Divide rate of conversion from grf by 1000, to match OTTD internal system
Diffstat (limited to 'strings.c')
-rw-r--r--strings.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/strings.c b/strings.c
index 8436dfcd4..67669a5e4 100644
--- a/strings.c
+++ b/strings.c
@@ -381,8 +381,10 @@ static char *FormatGenericCurrency(char *buff, const CurrencySpec *spec, int64 n
number = -number;
}
- /* add prefix part, only if it is specified by symbol_pos */
- if (spec->symbol_pos == 0) {
+ /* Add prefix part, folowing symbol_pos specification.
+ * Here, it can can be either 0 (prefix) or 2 (both prefix anf suffix).
+ * The only remaining value is 1 (suffix), so everything that is not 1 */
+ if (spec->symbol_pos != 1){
s = spec->prefix;
while (s != spec->prefix + lengthof(spec->prefix) && (c = *(s++)) != '\0') *(buff)++ = c;
}
@@ -413,7 +415,9 @@ static char *FormatGenericCurrency(char *buff, const CurrencySpec *spec, int64 n
if (compact) *buff++ = compact;
- /* add suffix part, only if it is specified by symbol_pos */
+ /* Add suffix part, folowing symbol_pos specification.
+ * Here, it can can be either 1 (suffix) or 2 (both prefix anf suffix).
+ * The only remaining value is 1 (prefix), so everything that is not 0 */
if (spec->symbol_pos != 0) {
s = spec->suffix;
while (s != spec->suffix + lengthof(spec->suffix) && (c = *(s++)) != '\0') *(buff++) = c;