summaryrefslogtreecommitdiff
path: root/src/resources/db/unitsdb.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-09-27 23:43:44 +0300
committerAndrei Karas <akaras@inbox.ru>2017-09-27 23:43:44 +0300
commita8041ac28118de1caef73bdac9567c9a7e25e41f (patch)
treef5c9842626b0ebeb6328566fbd1f0a424fb9af47 /src/resources/db/unitsdb.cpp
parentf70dcfe0a82db3aee879953f117d12aecc4fce85 (diff)
downloadplus-a8041ac28118de1caef73bdac9567c9a7e25e41f.tar.gz
plus-a8041ac28118de1caef73bdac9567c9a7e25e41f.tar.bz2
plus-a8041ac28118de1caef73bdac9567c9a7e25e41f.tar.xz
plus-a8041ac28118de1caef73bdac9567c9a7e25e41f.zip
Fix some issues with int64 to int32 implicit conversions.
Diffstat (limited to 'src/resources/db/unitsdb.cpp')
-rw-r--r--src/resources/db/unitsdb.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/resources/db/unitsdb.cpp b/src/resources/db/unitsdb.cpp
index aac6b72e3..a32786b84 100644
--- a/src/resources/db/unitsdb.cpp
+++ b/src/resources/db/unitsdb.cpp
@@ -325,6 +325,12 @@ std::string UnitsDb::formatCurrency(const int value)
return formatUnit(value, defaultCurrency);
}
+std::string UnitsDb::formatCurrency64(const int64_t value)
+{
+ return formatUnit(CAST_S32(value),
+ defaultCurrency);
+}
+
std::string UnitsDb::formatCurrency(std::string name,
const int value)
{
@@ -333,6 +339,15 @@ std::string UnitsDb::formatCurrency(std::string name,
return formatUnit(value, mCurrencies[name]);
}
+std::string UnitsDb::formatCurrency64(std::string name,
+ const int64_t value)
+{
+ if (mCurrencies.find(name) == mCurrencies.end())
+ name = DEFAULT_CURRENCY;
+ return formatUnit(CAST_S32(value),
+ mCurrencies[name]);
+}
+
std::string UnitsDb::formatWeight(const int value)
{
return formatUnit(value, defaultWeight);