summaryrefslogtreecommitdiff
path: root/src/resources/db/itemdb.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-05-12 00:18:57 +0300
committerAndrei Karas <akaras@inbox.ru>2016-05-12 00:51:22 +0300
commitd5a00a320043f5782ebc489285c89943b667e094 (patch)
treeeb64f3b1f81f7ba2a3c7ff9e02ad329ef21abb83 /src/resources/db/itemdb.cpp
parent742b2a22bdcb69e6f615a284065ba2696e7bc261 (diff)
downloadmanaplus-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.cpp20
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"))