From 35481061f62111f916a39ce3cac6a314579418f9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 31 Jan 2017 21:27:52 +0300 Subject: Load currency names for each npc from npcs.xml. --- src/resources/db/unitsdb.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/resources/db/unitsdb.cpp') 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) { -- cgit v1.2.3-60-g2f50