diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-05-12 00:18:57 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-05-12 00:51:22 +0300 |
commit | d5a00a320043f5782ebc489285c89943b667e094 (patch) | |
tree | eb64f3b1f81f7ba2a3c7ff9e02ad329ef21abb83 /src/resources/db/itemdb.cpp | |
parent | 742b2a22bdcb69e6f615a284065ba2696e7bc261 (diff) | |
download | manaplus-d5a00a320043f5782ebc489285c89943b667e094.tar.gz manaplus-d5a00a320043f5782ebc489285c89943b667e094.tar.bz2 manaplus-d5a00a320043f5782ebc489285c89943b667e094.tar.xz manaplus-d5a00a320043f5782ebc489285c89943b667e094.zip |
Add skipError parameter to loadXml functions.
This allow not show errors for some not main xml files.
Diffstat (limited to 'src/resources/db/itemdb.cpp')
-rw-r--r-- | src/resources/db/itemdb.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index 934974a5b..a6dcd48ab 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -268,15 +268,19 @@ void ItemDB::load() mUnknown->setSprite(errFile, Gender::FEMALE, 0); mUnknown->setSprite(errFile, Gender::OTHER, 0); mUnknown->addTag(mTags["All"]); - loadXmlFile(paths.getStringValue("itemsFile"), tagNum); - loadXmlFile(paths.getStringValue("itemsPatchFile"), tagNum); + loadXmlFile(paths.getStringValue("itemsFile"), + tagNum, + SkipError_false); + loadXmlFile(paths.getStringValue("itemsPatchFile"), + tagNum, + SkipError_true); StringVect list; Files::getFilesInDir(paths.getStringValue("itemsPatchDir"), list, ".xml"); FOR_EACH (StringVectCIter, it, list) - loadXmlFile(*it, tagNum); + loadXmlFile(*it, tagNum, SkipError_true); // Hairstyles are encoded as negative numbers. Count how far negative // we can go. @@ -297,7 +301,9 @@ void ItemDB::load() mNumberOfRaces = races - 100; } -void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum) +void ItemDB::loadXmlFile(const std::string &fileName, + int &tagNum, + const SkipError skipError) { if (fileName.empty()) { @@ -305,7 +311,9 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum) return; } - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, + UseResman_true, + skipError); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "items")) @@ -321,7 +329,7 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum) { const std::string name = XML::getProperty(node, "name", ""); if (!name.empty()) - loadXmlFile(name, tagNum); + loadXmlFile(name, tagNum, skipError); continue; } if (!xmlNameEqual(node, "item")) |