summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/db/unitsdb.cpp8
-rw-r--r--src/resources/db/unitsdb.h6
2 files changed, 14 insertions, 0 deletions
diff --git a/src/resources/db/unitsdb.cpp b/src/resources/db/unitsdb.cpp
index 7b56e8721..8746753c6 100644
--- a/src/resources/db/unitsdb.cpp
+++ b/src/resources/db/unitsdb.cpp
@@ -322,6 +322,14 @@ std::string UnitsDb::formatCurrency(const int value)
return formatUnit(value, defaultCurrency);
}
+std::string UnitsDb::formatCurrency(std::string name,
+ const int value)
+{
+ if (mCurrencies.find(name) == mCurrencies.end())
+ name = DEFAULT_CURRENCY;
+ return formatUnit(value, mCurrencies[name]);
+}
+
std::string UnitsDb::formatWeight(const int value)
{
return formatUnit(value, defaultWeight);
diff --git a/src/resources/db/unitsdb.h b/src/resources/db/unitsdb.h
index 7a913cc16..689e7a6ad 100644
--- a/src/resources/db/unitsdb.h
+++ b/src/resources/db/unitsdb.h
@@ -48,6 +48,12 @@ class UnitsDb final
static std::string formatCurrency(const int value) A_WARN_UNUSED;
/**
+ * Formats the given number in the correct currency format.
+ */
+ static std::string formatCurrency(std::string name,
+ const int value) A_WARN_UNUSED;
+
+ /**
* Formats the given number in the correct weight/mass format.
*/
static std::string formatWeight(const int value) A_WARN_UNUSED;