summaryrefslogtreecommitdiff
path: root/src/currency.h
diff options
context:
space:
mode:
authorrubidium42 <rubidium@openttd.org>2021-04-28 16:46:24 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-05-13 23:13:17 +0200
commit65cbde4b30f8fdf6d4cf1196f6a596a5550c9aee (patch)
tree180f29871d8401d18dce5ae92f196832b34fe0bc /src/currency.h
parent2022e3482417eceeb1045d01c2aa64db42f03f08 (diff)
downloadopenttd-65cbde4b30f8fdf6d4cf1196f6a596a5550c9aee.tar.xz
Codechange: move currency settings to std::string
Diffstat (limited to 'src/currency.h')
-rw-r--r--src/currency.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/currency.h b/src/currency.h
index e97fc6cb8..10caa59d3 100644
--- a/src/currency.h
+++ b/src/currency.h
@@ -70,11 +70,11 @@ enum Currencies {
/** Specification of a currency. */
struct CurrencySpec {
- uint16 rate;
- char separator[8];
- Year to_euro; ///< %Year of switching to the Euro. May also be #CF_NOEURO or #CF_ISEURO.
- char prefix[16];
- char suffix[16];
+ uint16 rate; ///< The conversion rate compared to the base currency.
+ std::string separator; ///< The thousands separator for this currency.
+ Year to_euro; ///< %Year of switching to the Euro. May also be #CF_NOEURO or #CF_ISEURO.
+ std::string prefix; ///< Prefix to apply when formatting money in this currency.
+ std::string suffix; ///< Suffix to apply when formatting money in this currency.
/**
* The currency symbol is represented by two possible values, prefix and suffix
* Usage of one or the other is determined by #symbol_pos.
@@ -89,11 +89,9 @@ struct CurrencySpec {
CurrencySpec() = default;
- CurrencySpec(uint16 rate, const char *separator, Year to_euro, const char *prefix, const char *suffix, byte symbol_pos, StringID name) : rate(rate), to_euro(to_euro), symbol_pos(symbol_pos), name(name)
+ CurrencySpec(uint16 rate, const char *separator, Year to_euro, const char *prefix, const char *suffix, byte symbol_pos, StringID name) :
+ rate(rate), separator(separator), to_euro(to_euro), prefix(prefix), suffix(suffix), symbol_pos(symbol_pos), name(name)
{
- strecpy(this->separator, separator, lastof(this->separator));
- strecpy(this->prefix, prefix, lastof(this->prefix));
- strecpy(this->suffix, suffix, lastof(this->suffix));
}
};