summaryrefslogtreecommitdiff
path: root/strings.c
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2006-08-25 00:41:10 +0000
committerbelugas <belugas@openttd.org>2006-08-25 00:41:10 +0000
commit473885c61544af93695ad9b9e712a7aaec6eb023 (patch)
treecaad83c6db9639e15830a8ab332ae70450b40930 /strings.c
parent7875e073737fd0057414808fcc5da81433172d20 (diff)
downloadopenttd-473885c61544af93695ad9b9e712a7aaec6eb023.tar.xz
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
All properties can now be modified i.e: Introduction date for euro conversion Currency name, decimal separator, currency symbol (before or after amount) and the rate compared to the base currency, the british pound
Diffstat (limited to 'strings.c')
-rw-r--r--strings.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/strings.c b/strings.c
index 041a40ac1..d57d70129 100644
--- a/strings.c
+++ b/strings.c
@@ -381,9 +381,11 @@ static char *FormatGenericCurrency(char *buff, const CurrencySpec *spec, int64 n
number = -number;
}
- // add prefix part
- s = spec->prefix;
- while (s != spec->prefix + lengthof(spec->prefix) && (c = *s++) != '\0') *buff++ = c;
+ /* add prefix part, only if it is specified by symbol_pos */
+ if (spec->symbol_pos == 0) {
+ s = spec->prefix;
+ while (s != spec->prefix + lengthof(spec->prefix) && (c = *(s++)) != '\0') *(buff)++ = c;
+ }
// for huge numbers, compact the number into k or M
if (compact) {
@@ -411,9 +413,11 @@ static char *FormatGenericCurrency(char *buff, const CurrencySpec *spec, int64 n
if (compact) *buff++ = compact;
- // add suffix part
- s = spec->suffix;
- while (s != spec->suffix + lengthof(spec->suffix) && (c = *s++) != '\0') *buff++ = c;
+ /* add suffix part, only if it is specified by symbol_pos */
+ if (spec->symbol_pos != 0) {
+ s = spec->suffix;
+ while (s != spec->suffix + lengthof(spec->suffix) && (c = *(s++)) != '\0') *(buff++) = c;
+ }
return buff;
}