summaryrefslogtreecommitdiff
path: root/src/resources/db/unitsdb.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-01-31 21:27:52 +0300
committerAndrei Karas <akaras@inbox.ru>2017-01-31 21:27:52 +0300
commit35481061f62111f916a39ce3cac6a314579418f9 (patch)
treeecf73b207a78f9e35bb47f8ed1067931733090b7 /src/resources/db/unitsdb.cpp
parentaea9e7f8c26644ba38db5eb9dbf412195f9851b2 (diff)
downloadmanaplus-35481061f62111f916a39ce3cac6a314579418f9.tar.gz
manaplus-35481061f62111f916a39ce3cac6a314579418f9.tar.bz2
manaplus-35481061f62111f916a39ce3cac6a314579418f9.tar.xz
manaplus-35481061f62111f916a39ce3cac6a314579418f9.zip
Load currency names for each npc from npcs.xml.
Diffstat (limited to 'src/resources/db/unitsdb.cpp')
-rw-r--r--src/resources/db/unitsdb.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/resources/db/unitsdb.cpp b/src/resources/db/unitsdb.cpp
index 3001ccb7b..94d055ffd 100644
--- a/src/resources/db/unitsdb.cpp
+++ b/src/resources/db/unitsdb.cpp
@@ -214,11 +214,18 @@ void UnitsDb::loadXmlFile(const std::string &fileName,
const std::string type = XML::getProperty(node, "type", "");
UnitDescription ud = loadUnit(node);
if (type == "weight")
+ {
defaultWeight = ud;
+ }
else if (type == "currency")
+ {
defaultCurrency = ud;
+ mCurrencies["default"] = ud;
+ }
else
+ {
logger->log("Error unknown unit type: %s", type.c_str());
+ }
}
else if (xmlNameEqual(node, "currency"))
{
@@ -318,6 +325,11 @@ std::string UnitsDb::formatWeight(const int value)
return formatUnit(value, defaultWeight);
}
+bool UnitsDb::existsCurrency(const std::string &name)
+{
+ return mCurrencies.find(name) != mCurrencies.end();
+}
+
static std::string splitNumber(std::string str,
const std::string &separator)
{