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 | |
parent | 742b2a22bdcb69e6f615a284065ba2696e7bc261 (diff) | |
download | mv-d5a00a320043f5782ebc489285c89943b667e094.tar.gz mv-d5a00a320043f5782ebc489285c89943b667e094.tar.bz2 mv-d5a00a320043f5782ebc489285c89943b667e094.tar.xz mv-d5a00a320043f5782ebc489285c89943b667e094.zip |
Add skipError parameter to loadXml functions.
This allow not show errors for some not main xml files.
47 files changed, 277 insertions, 160 deletions
diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp index 1a9901beb..e91e52eff 100644 --- a/src/effectmanager.cpp +++ b/src/effectmanager.cpp @@ -41,14 +41,15 @@ EffectManager::EffectManager() : mTimers() { logger->log1("Effects are now loading"); - loadXmlFile(paths.getStringValue("effectsFile")); - loadXmlFile(paths.getStringValue("effectsPatchFile")); + loadXmlFile(paths.getStringValue("effectsFile"), SkipError_false); + loadXmlFile(paths.getStringValue("effectsPatchFile"), SkipError_true); loadXmlDir("effectsPatchDir", loadXmlFile); } -void EffectManager::loadXmlFile(const std::string &fileName) +void EffectManager::loadXmlFile(const std::string &fileName, + const SkipError skipError) { - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, UseResman_true, skipError); const XmlNodePtrConst root = doc.rootNode(); if (!root || @@ -64,7 +65,7 @@ void EffectManager::loadXmlFile(const std::string &fileName) { const std::string name = XML::getProperty(node, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } else if (xmlNameEqual(node, "effect")) diff --git a/src/effectmanager.h b/src/effectmanager.h index 98a97076f..4c30f2690 100644 --- a/src/effectmanager.h +++ b/src/effectmanager.h @@ -25,6 +25,8 @@ #include "enums/resources/spritedirection.h" +#include "enums/simpletypes/skiperror.h" + #include "particle/particletimer.h" #include "resources/effectdescription.h" @@ -46,7 +48,8 @@ class EffectManager final ~EffectManager(); - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); /** * Triggers a effect with the id, at diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp index eed82636b..c75fde58f 100644 --- a/src/gui/windows/questswindow.cpp +++ b/src/gui/windows/questswindow.cpp @@ -125,8 +125,8 @@ QuestsWindow::QuestsWindow() : loadWindowState(); enableVisibleSound(true); - loadXmlFile(paths.getStringValue("questsFile")); - loadXmlFile(paths.getStringValue("questsPatchFile")); + loadXmlFile(paths.getStringValue("questsFile"), SkipError_false); + loadXmlFile(paths.getStringValue("questsPatchFile"), SkipError_true); loadXmlDir("questsPatchDir", loadXmlFile); } @@ -162,9 +162,12 @@ QuestsWindow::~QuestsWindow() } } -void QuestsWindow::loadXmlFile(const std::string &fileName) +void QuestsWindow::loadXmlFile(const std::string &fileName, + const SkipError skipError) { - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, + UseResman_true, + skipError); const XmlNodePtrConst root = doc.rootNode(); if (!root) return; @@ -175,7 +178,7 @@ void QuestsWindow::loadXmlFile(const std::string &fileName) { const std::string name = XML::getProperty(varNode, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } else if (xmlNameEqual(varNode, "var")) diff --git a/src/gui/windows/questswindow.h b/src/gui/windows/questswindow.h index 1012e813a..ec2f7da42 100644 --- a/src/gui/windows/questswindow.h +++ b/src/gui/windows/questswindow.h @@ -72,7 +72,8 @@ class QuestsWindow final : public Window, void addEffect(Being *const being); private: - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); void loadQuest(const int var, const XmlNodePtr node); diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index a11e0b5aa..b61afb70f 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -266,18 +266,21 @@ void SkillDialog::hideSkills(const SkillOwner::Type owner) void SkillDialog::loadSkills() { clearSkills(); - loadXmlFile(paths.getStringValue("skillsFile")); + loadXmlFile(paths.getStringValue("skillsFile"), SkipError_false); if (mSkills.empty()) - loadXmlFile(paths.getStringValue("skillsFile2")); - loadXmlFile(paths.getStringValue("skillsPatchFile")); + loadXmlFile(paths.getStringValue("skillsFile2"), SkipError_false); + loadXmlFile(paths.getStringValue("skillsPatchFile"), SkipError_true); loadXmlDir("skillsPatchDir", loadXmlFile); update(); } -void SkillDialog::loadXmlFile(const std::string &fileName) +void SkillDialog::loadXmlFile(const std::string &fileName, + const SkipError skipError) { - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, + UseResman_true, + skipError); XmlNodePtrConst root = doc.rootNode(); int setCount = 0; @@ -294,7 +297,7 @@ void SkillDialog::loadXmlFile(const std::string &fileName) { const std::string name = XML::getProperty(set, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } else if (xmlNameEqual(set, "set")) diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h index 910ba9b72..146b67bab 100644 --- a/src/gui/windows/skilldialog.h +++ b/src/gui/windows/skilldialog.h @@ -26,6 +26,7 @@ #include "gui/widgets/window.h" #include "enums/simpletypes/autotarget.h" +#include "enums/simpletypes/skiperror.h" #include "enums/simpletypes/modifiable.h" #include "listeners/actionlistener.h" @@ -77,7 +78,8 @@ class SkillDialog final : public Window, void updateModels(); - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); void clearSkills(); diff --git a/src/resources/beingcommon.h b/src/resources/beingcommon.h index 267ecaf2a..f86aba06b 100644 --- a/src/resources/beingcommon.h +++ b/src/resources/beingcommon.h @@ -38,15 +38,15 @@ struct SpriteDisplay; Files::getFilesInDir(paths.getStringValue( \ name), listVect, ".xml"); \ FOR_EACH (StringVectCIter, itVect, listVect) \ - function(*itVect); \ + function(*itVect, SkipError_true); \ } -#define loadXmlDir2(name, function, ext) \ +#define loadXmlDir2(name, function, ext, skipError) \ { \ StringVect listVect; \ Files::getFilesInDir(name, listVect, ext); \ FOR_EACH (StringVectCIter, itVect, listVect) \ - function(*itVect); \ + function(*itVect, skipError); \ } namespace BeingCommon diff --git a/src/resources/db/avatardb.cpp b/src/resources/db/avatardb.cpp index b62d13bbf..e41664e9a 100644 --- a/src/resources/db/avatardb.cpp +++ b/src/resources/db/avatardb.cpp @@ -46,14 +46,17 @@ void AvatarDB::load() { if (mLoaded) unload(); - loadXmlFile(paths.getStringValue("avatarsFile")); - loadXmlFile(paths.getStringValue("avatarsPatchFile")); + loadXmlFile(paths.getStringValue("avatarsFile"), SkipError_false); + loadXmlFile(paths.getStringValue("avatarsPatchFile"), SkipError_true); loadXmlDir("avatarsPatchDir", loadXmlFile); } -void AvatarDB::loadXmlFile(const std::string &fileName) +void AvatarDB::loadXmlFile(const std::string &fileName, + const SkipError skipError) { - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, + UseResman_true, + skipError); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "avatars")) @@ -70,7 +73,7 @@ void AvatarDB::loadXmlFile(const std::string &fileName) { const std::string name = XML::getProperty(avatarNode, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } diff --git a/src/resources/db/avatardb.h b/src/resources/db/avatardb.h index 48a4e7290..51dac81e0 100644 --- a/src/resources/db/avatardb.h +++ b/src/resources/db/avatardb.h @@ -24,6 +24,7 @@ #define RESOURCES_DB_AVATARDB_H #include "enums/simpletypes/beingtypeid.h" +#include "enums/simpletypes/skiperror.h" #include <string> @@ -39,7 +40,8 @@ namespace AvatarDB BeingInfo *get(const BeingTypeId id) A_WARN_UNUSED; - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); } // namespace AvatarDB #endif // RESOURCES_DB_AVATARDB_H diff --git a/src/resources/db/colordb.cpp b/src/resources/db/colordb.cpp index 5345010b3..2cbaa44ce 100644 --- a/src/resources/db/colordb.cpp +++ b/src/resources/db/colordb.cpp @@ -45,18 +45,24 @@ void ColorDB::load() ColorListsIterator it = mColorLists.find("hair"); if (it != mColorLists.end()) colors = it->second; - loadHair(paths.getStringValue("hairColorFile"), colors); - loadHair(paths.getStringValue("hairColorPatchFile"), colors); + loadHair(paths.getStringValue("hairColorFile"), + colors, + SkipError_true); + loadHair(paths.getStringValue("hairColorPatchFile"), + colors, + SkipError_true); StringVect list; Files::getFilesInDir(paths.getStringValue( "hairColorPatchDir"), list, ".xml"); FOR_EACH (StringVectCIter, it2, list) - loadHair(*it2, colors); + loadHair(*it2, colors, SkipError_true); mColorLists["hair"] = colors; - loadColorLists(paths.getStringValue("itemColorsFile")); - loadColorLists(paths.getStringValue("itemColorsPatchFile")); + loadColorLists(paths.getStringValue("itemColorsFile"), + SkipError_false); + loadColorLists(paths.getStringValue("itemColorsPatchFile"), + SkipError_true); loadXmlDir("itemColorsPatchDir", loadColorLists); it = mColorLists.find("hair"); @@ -68,11 +74,12 @@ void ColorDB::load() } void ColorDB::loadHair(const std::string &fileName, - std::map<ItemColor, ItemColorData> &colors) + std::map<ItemColor, ItemColorData> &colors, + const SkipError skipError) { XML::Document *doc = new XML::Document(fileName, UseResman_true, - SkipError_false); + skipError); const XmlNodePtrConst root = doc->rootNode(); if (!root || !xmlNameEqual(root, "colors")) @@ -90,7 +97,7 @@ void ColorDB::loadHair(const std::string &fileName, { const std::string name = XML::getProperty(node, "name", ""); if (!name.empty()) - loadHair(name, colors); + loadHair(name, colors, skipError); continue; } else if (xmlNameEqual(node, "color")) @@ -112,11 +119,12 @@ void ColorDB::loadHair(const std::string &fileName, delete doc; } -void ColorDB::loadColorLists(const std::string &fileName) +void ColorDB::loadColorLists(const std::string &fileName, + const SkipError skipError) { XML::Document *doc = new XML::Document(fileName, UseResman_true, - SkipError_false); + skipError); const XmlNodePtrConst root = doc->rootNode(); if (!root) { @@ -130,7 +138,7 @@ void ColorDB::loadColorLists(const std::string &fileName) { const std::string name = XML::getProperty(node, "name", ""); if (!name.empty()) - loadColorLists(name); + loadColorLists(name, skipError); continue; } else if (xmlNameEqual(node, "list")) diff --git a/src/resources/db/colordb.h b/src/resources/db/colordb.h index 5c311a08d..dcb417019 100644 --- a/src/resources/db/colordb.h +++ b/src/resources/db/colordb.h @@ -23,6 +23,7 @@ #define RESOURCES_DB_COLORDB_H #include "enums/simpletypes/itemcolor.h" +#include "enums/simpletypes/skiperror.h" #include <map> #include <string> @@ -66,9 +67,11 @@ namespace ColorDB * Loads the color data from <code>colors.xml</code>. */ void loadHair(const std::string &fileName, - std::map<ItemColor, ItemColorData> &colors); + std::map<ItemColor, ItemColorData> &colors, + const SkipError skipError); - void loadColorLists(const std::string &fileName); + void loadColorLists(const std::string &fileName, + const SkipError skipError); /** * Clear the color data diff --git a/src/resources/db/commandsdb.cpp b/src/resources/db/commandsdb.cpp index 2c9d44705..74096c25a 100644 --- a/src/resources/db/commandsdb.cpp +++ b/src/resources/db/commandsdb.cpp @@ -40,8 +40,10 @@ void CommandsDB::load() { if (mLoaded) unload(); - loadXmlFile(paths.getStringValue("defaultCommandsFile")); - loadXmlFile(paths.getStringValue("defaultCommandsPatchFile")); + loadXmlFile(paths.getStringValue("defaultCommandsFile"), + SkipError_false); + loadXmlFile(paths.getStringValue("defaultCommandsPatchFile"), + SkipError_true); loadXmlDir("defaultCommandsPatchDir", loadXmlFile); mLoaded = true; } @@ -56,9 +58,10 @@ static CommandTargetT parseTarget(const std::string &text) return CommandTarget::NoTarget; } -void CommandsDB::loadXmlFile(const std::string &fileName) +void CommandsDB::loadXmlFile(const std::string &fileName, + const SkipError skipError) { - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, UseResman_true, skipError); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "commands")) @@ -74,7 +77,7 @@ void CommandsDB::loadXmlFile(const std::string &fileName) { const std::string name = XML::getProperty(commandNode, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } diff --git a/src/resources/db/commandsdb.h b/src/resources/db/commandsdb.h index d3be770d7..38242c8b9 100644 --- a/src/resources/db/commandsdb.h +++ b/src/resources/db/commandsdb.h @@ -23,6 +23,8 @@ #ifndef RESOURCES_DB_COMMANDSDB_H #define RESOURCES_DB_COMMANDSDB_H +#include "enums/simpletypes/skiperror.h" + #include <map> #include <string> @@ -39,7 +41,8 @@ namespace CommandsDB void unload(); - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); CommandsMap &getAll(); } // namespace CommandsDB diff --git a/src/resources/db/deaddb.cpp b/src/resources/db/deaddb.cpp index a2a6a6494..fe336b215 100644 --- a/src/resources/db/deaddb.cpp +++ b/src/resources/db/deaddb.cpp @@ -40,17 +40,18 @@ void DeadDB::load() if (mLoaded) unload(); - loadXmlFile(paths.getStringValue("deadMessagesFile")); - loadXmlFile(paths.getStringValue("deadMessagesPatchFile")); + loadXmlFile(paths.getStringValue("deadMessagesFile"), SkipError_false); + loadXmlFile(paths.getStringValue("deadMessagesPatchFile"), SkipError_true); loadXmlDir("deadMessagesPatchDir", loadXmlFile); mLoaded = true; } -void DeadDB::loadXmlFile(const std::string &fileName) +void DeadDB::loadXmlFile(const std::string &fileName, + const SkipError skipError) { XML::Document *doc = new XML::Document(fileName, UseResman_true, - SkipError_false); + skipError); const XmlNodePtrConst root = doc->rootNode(); if (!root || !xmlNameEqual(root, "messages")) @@ -67,7 +68,7 @@ void DeadDB::loadXmlFile(const std::string &fileName) { const std::string name = XML::getProperty(node, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } else if (xmlNameEqual(node, "message")) diff --git a/src/resources/db/deaddb.h b/src/resources/db/deaddb.h index 67afcf39c..def0a42f2 100644 --- a/src/resources/db/deaddb.h +++ b/src/resources/db/deaddb.h @@ -21,6 +21,8 @@ #ifndef RESOURCES_DB_DEADDB_H #define RESOURCES_DB_DEADDB_H +#include "enums/simpletypes/skiperror.h" + #include <string> /** @@ -33,7 +35,8 @@ namespace DeadDB */ void load(); - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); /** * Clear the chars data diff --git a/src/resources/db/emotedb.cpp b/src/resources/db/emotedb.cpp index b2f9a0581..2d8804630 100644 --- a/src/resources/db/emotedb.cpp +++ b/src/resources/db/emotedb.cpp @@ -58,17 +58,19 @@ void EmoteDB::load() logger->log1("Initializing emote database..."); mLastEmote = 0; - loadXmlFile(paths.getStringValue("emotesFile")); - loadXmlFile(paths.getStringValue("emotesPatchFile")); + loadXmlFile(paths.getStringValue("emotesFile"), SkipError_false); + loadXmlFile(paths.getStringValue("emotesPatchFile"), SkipError_true); loadXmlDir("emotesPatchDir", loadXmlFile); - loadSpecialXmlFile("graphics/sprites/manaplus_emotes.xml"); + loadSpecialXmlFile("graphics/sprites/manaplus_emotes.xml", + SkipError_false); mLoaded = true; } -void EmoteDB::loadXmlFile(const std::string &fileName) +void EmoteDB::loadXmlFile(const std::string &fileName, + const SkipError skipError) { - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, UseResman_true, skipError); XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "emotes")) @@ -85,7 +87,7 @@ void EmoteDB::loadXmlFile(const std::string &fileName) { const std::string name = XML::getProperty(emoteNode, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } else if (!xmlNameEqual(emoteNode, "emote")) @@ -142,9 +144,10 @@ void EmoteDB::loadXmlFile(const std::string &fileName) } } -void EmoteDB::loadSpecialXmlFile(const std::string &fileName) +void EmoteDB::loadSpecialXmlFile(const std::string &fileName, + const SkipError skipError) { - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, UseResman_true, skipError); XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "emotes")) @@ -161,7 +164,7 @@ void EmoteDB::loadSpecialXmlFile(const std::string &fileName) { const std::string name = XML::getProperty(emoteNode, "name", ""); if (!name.empty()) - loadSpecialXmlFile(name); + loadSpecialXmlFile(name, skipError); continue; } else if (!xmlNameEqual(emoteNode, "emote")) diff --git a/src/resources/db/emotedb.h b/src/resources/db/emotedb.h index 09401103c..6d726de39 100644 --- a/src/resources/db/emotedb.h +++ b/src/resources/db/emotedb.h @@ -22,6 +22,8 @@ #ifndef RESOURCES_DB_EMOTEDB_H #define RESOURCES_DB_EMOTEDB_H +#include "enums/simpletypes/skiperror.h" + #include <map> #include <string> @@ -40,9 +42,11 @@ namespace EmoteDB { void load(); - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); - void loadSpecialXmlFile(const std::string &fileName); + void loadSpecialXmlFile(const std::string &fileName, + const SkipError skipError); void unload(); diff --git a/src/resources/db/homunculusdb.cpp b/src/resources/db/homunculusdb.cpp index e8d2f723e..c8c7d6d2c 100644 --- a/src/resources/db/homunculusdb.cpp +++ b/src/resources/db/homunculusdb.cpp @@ -45,16 +45,17 @@ void HomunculusDB::load() unload(); logger->log1("Initializing homunculus database..."); - loadXmlFile(paths.getStringValue("homunculusesFile")); - loadXmlFile(paths.getStringValue("homunculusesPatchFile")); + loadXmlFile(paths.getStringValue("homunculusesFile"), SkipError_false); + loadXmlFile(paths.getStringValue("homunculusesPatchFile"), SkipError_true); loadXmlDir("homunculusesPatchDir", loadXmlFile); mLoaded = true; } -void HomunculusDB::loadXmlFile(const std::string &fileName) +void HomunculusDB::loadXmlFile(const std::string &fileName, + const SkipError skipError) { - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, UseResman_true, skipError); const XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "homunculuses")) @@ -75,7 +76,7 @@ void HomunculusDB::loadXmlFile(const std::string &fileName) const std::string name = XML::getProperty( homunculusNode, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } if (!xmlNameEqual(homunculusNode, "homunculus")) diff --git a/src/resources/db/homunculusdb.h b/src/resources/db/homunculusdb.h index 01aafcdc1..45495d6b9 100644 --- a/src/resources/db/homunculusdb.h +++ b/src/resources/db/homunculusdb.h @@ -24,6 +24,7 @@ #define RESOURCES_DB_HOMUNCULUSDB_H #include "enums/simpletypes/beingtypeid.h" +#include "enums/simpletypes/skiperror.h" #include "localconsts.h" @@ -40,7 +41,8 @@ namespace HomunculusDB void unload(); - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); BeingInfo *get(const BeingTypeId id) A_WARN_UNUSED; } // namespace HomunculusDB diff --git a/src/resources/db/horsedb.cpp b/src/resources/db/horsedb.cpp index 8ede4ca3a..c43769bca 100644 --- a/src/resources/db/horsedb.cpp +++ b/src/resources/db/horsedb.cpp @@ -78,16 +78,19 @@ void HorseDB::load() logger->log1("Initializing horse database..."); - loadXmlFile(paths.getStringValue("horsesFile")); - loadXmlFile(paths.getStringValue("horsesPatchFile")); + loadXmlFile(paths.getStringValue("horsesFile"), SkipError_false); + loadXmlFile(paths.getStringValue("horsesPatchFile"), SkipError_true); loadXmlDir("horsesPatchDir", loadXmlFile); mLoaded = true; } -void HorseDB::loadXmlFile(const std::string &fileName) +void HorseDB::loadXmlFile(const std::string &fileName, + const SkipError skipError) { - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, + UseResman_true, + skipError); XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "horses")) @@ -104,7 +107,7 @@ void HorseDB::loadXmlFile(const std::string &fileName) { const std::string name = XML::getProperty(horseNode, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } else if (!xmlNameEqual(horseNode, "horse")) diff --git a/src/resources/db/horsedb.h b/src/resources/db/horsedb.h index 53855c767..8b009a108 100644 --- a/src/resources/db/horsedb.h +++ b/src/resources/db/horsedb.h @@ -22,6 +22,8 @@ #ifndef RESOURCES_DB_HORSEDB_H #define RESOURCES_DB_HORSEDB_H +#include "enums/simpletypes/skiperror.h" + #include <map> #include <string> @@ -38,9 +40,11 @@ namespace HorseDB { void load(); - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); - void loadSpecialXmlFile(const std::string &fileName); + void loadSpecialXmlFile(const std::string &fileName, + const SkipError skipError); void unload(); 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")) diff --git a/src/resources/db/itemdb.h b/src/resources/db/itemdb.h index e855c80ca..d8706ef31 100644 --- a/src/resources/db/itemdb.h +++ b/src/resources/db/itemdb.h @@ -23,6 +23,8 @@ #ifndef RESOURCES_DB_ITEMDB_H #define RESOURCES_DB_ITEMDB_H +#include "enums/simpletypes/skiperror.h" + #include "utils/stringvector.h" #include <map> @@ -45,7 +47,9 @@ namespace ItemDB void unload(); - void loadXmlFile(const std::string &fileName, int &tagNum); + void loadXmlFile(const std::string &fileName, + int &tagNum, + const SkipError skipError); const StringVect &getTags(); diff --git a/src/resources/db/mapdb.cpp b/src/resources/db/mapdb.cpp index 6d31c69f2..5e9f31cfc 100644 --- a/src/resources/db/mapdb.cpp +++ b/src/resources/db/mapdb.cpp @@ -47,21 +47,24 @@ void MapDB::load() if (mLoaded) unload(); - loadRemapXmlFile(paths.getStringValue("mapsRemapFile")); - loadRemapXmlFile(paths.getStringValue("mapsRemapPatchFile")); + loadRemapXmlFile(paths.getStringValue("mapsRemapFile"), + SkipError_true); + loadRemapXmlFile(paths.getStringValue("mapsRemapPatchFile"), + SkipError_true); loadXmlDir("mapsRemapPatchDir", loadRemapXmlFile); - loadInfo(paths.getStringValue("mapsFile")); - loadInfo(paths.getStringValue("mapsPatchFile")); + loadInfo(paths.getStringValue("mapsFile"), SkipError_false); + loadInfo(paths.getStringValue("mapsPatchFile"), SkipError_true); loadXmlDir("mapsPatchDir", loadInfo); mLoaded = true; } -void MapDB::loadRemapXmlFile(const std::string &fileName) +void MapDB::loadRemapXmlFile(const std::string &fileName, + const SkipError skipError) { XML::Document *const doc = new XML::Document(fileName, UseResman_true, - SkipError_false); + skipError); const XmlNodePtrConst root = doc->rootNode(); if (!root) @@ -88,7 +91,7 @@ void MapDB::loadRemapXmlFile(const std::string &fileName) { const std::string name = XML::getProperty(node, "name", ""); if (!name.empty()) - loadRemapXmlFile(name); + loadRemapXmlFile(name, skipError); continue; } } @@ -144,11 +147,12 @@ void MapDB::readAtlas(XmlNodePtrConst node) } } -void MapDB::loadInfo(const std::string &fileName) +void MapDB::loadInfo(const std::string &fileName, + const SkipError skipError) { XML::Document *doc = new XML::Document(fileName, UseResman_true, - SkipError_false); + skipError); const XmlNodePtrConst root = doc->rootNode(); if (!root) { @@ -170,7 +174,7 @@ void MapDB::loadInfo(const std::string &fileName) { const std::string name = XML::getProperty(node, "name", ""); if (!name.empty()) - loadInfo(name); + loadInfo(name, skipError); continue; } } diff --git a/src/resources/db/mapdb.h b/src/resources/db/mapdb.h index b25e1ea52..dfc0f1ca1 100644 --- a/src/resources/db/mapdb.h +++ b/src/resources/db/mapdb.h @@ -22,6 +22,8 @@ #ifndef RESOURCES_DB_MAPDB_H #define RESOURCES_DB_MAPDB_H +#include "enums/simpletypes/skiperror.h" + #include "resources/mapinfo.h" #include <map> @@ -38,9 +40,11 @@ namespace MapDB */ void load(); - void loadRemapXmlFile(const std::string &fileName); + void loadRemapXmlFile(const std::string &fileName, + const SkipError skipError); - void loadInfo(const std::string &fileName); + void loadInfo(const std::string &fileName, + const SkipError skipError); /** * Clear the remap data diff --git a/src/resources/db/mercenarydb.cpp b/src/resources/db/mercenarydb.cpp index 26476892d..60fe94504 100644 --- a/src/resources/db/mercenarydb.cpp +++ b/src/resources/db/mercenarydb.cpp @@ -45,16 +45,19 @@ void MercenaryDB::load() unload(); logger->log1("Initializing mercenary database..."); - loadXmlFile(paths.getStringValue("mercenariesFile")); - loadXmlFile(paths.getStringValue("mercenariesPatchFile")); + loadXmlFile(paths.getStringValue("mercenariesFile"), SkipError_false); + loadXmlFile(paths.getStringValue("mercenariesPatchFile"), SkipError_true); loadXmlDir("mercenariesPatchDir", loadXmlFile); mLoaded = true; } -void MercenaryDB::loadXmlFile(const std::string &fileName) +void MercenaryDB::loadXmlFile(const std::string &fileName, + const SkipError skipError) { - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, + UseResman_true, + skipError); const XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "mercenaries")) @@ -75,7 +78,7 @@ void MercenaryDB::loadXmlFile(const std::string &fileName) const std::string name = XML::getProperty( mercenaryNode, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } if (!xmlNameEqual(mercenaryNode, "mercenary")) diff --git a/src/resources/db/mercenarydb.h b/src/resources/db/mercenarydb.h index 66b27548a..3bfa5c80b 100644 --- a/src/resources/db/mercenarydb.h +++ b/src/resources/db/mercenarydb.h @@ -24,6 +24,7 @@ #define RESOURCES_DB_MERCENARYDB_H #include "enums/simpletypes/beingtypeid.h" +#include "enums/simpletypes/skiperror.h" #include "localconsts.h" @@ -40,7 +41,8 @@ namespace MercenaryDB void unload(); - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); BeingInfo *get(const BeingTypeId id) A_WARN_UNUSED; } // namespace MercenaryDB diff --git a/src/resources/db/moddb.cpp b/src/resources/db/moddb.cpp index c76bb8352..a03461d32 100644 --- a/src/resources/db/moddb.cpp +++ b/src/resources/db/moddb.cpp @@ -42,15 +42,16 @@ void ModDB::load() { if (mLoaded) unload(); - loadXmlFile(paths.getStringValue("modsFile")); - loadXmlFile(paths.getStringValue("modsPatchFile")); + loadXmlFile(paths.getStringValue("modsFile"), SkipError_false); + loadXmlFile(paths.getStringValue("modsPatchFile"), SkipError_true); loadXmlDir("modsPatchDir", loadXmlFile); mLoaded = true; } -void ModDB::loadXmlFile(const std::string &fileName) +void ModDB::loadXmlFile(const std::string &fileName, + const SkipError skipError) { - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, UseResman_true, skipError); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "mods")) @@ -66,7 +67,7 @@ void ModDB::loadXmlFile(const std::string &fileName) { const std::string name = XML::getProperty(modNode, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } diff --git a/src/resources/db/moddb.h b/src/resources/db/moddb.h index cbf6e2a0c..66488c691 100644 --- a/src/resources/db/moddb.h +++ b/src/resources/db/moddb.h @@ -23,6 +23,8 @@ #ifndef RESOURCES_DB_MODDB_H #define RESOURCES_DB_MODDB_H +#include "enums/simpletypes/skiperror.h" + #include "resources/modinfo.h" #include "localconsts.h" @@ -37,7 +39,8 @@ namespace ModDB ModInfo *get(const std::string &name) A_WARN_UNUSED; - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); const ModInfos &getAll(); } // namespace ModDB diff --git a/src/resources/db/monsterdb.cpp b/src/resources/db/monsterdb.cpp index 133b2545d..777fa32a7 100644 --- a/src/resources/db/monsterdb.cpp +++ b/src/resources/db/monsterdb.cpp @@ -48,16 +48,17 @@ void MonsterDB::load() unload(); logger->log1("Initializing monster database..."); - loadXmlFile(paths.getStringValue("monstersFile")); - loadXmlFile(paths.getStringValue("monstersPatchFile")); + loadXmlFile(paths.getStringValue("monstersFile"), SkipError_false); + loadXmlFile(paths.getStringValue("monstersPatchFile"), SkipError_true); loadXmlDir("monstersPatchDir", loadXmlFile); mLoaded = true; } -void MonsterDB::loadXmlFile(const std::string &fileName) +void MonsterDB::loadXmlFile(const std::string &fileName, + const SkipError skipError) { - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, UseResman_true, skipError); const XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "monsters")) @@ -78,7 +79,7 @@ void MonsterDB::loadXmlFile(const std::string &fileName) { const std::string name = XML::getProperty(monsterNode, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } if (!xmlNameEqual(monsterNode, "monster")) diff --git a/src/resources/db/monsterdb.h b/src/resources/db/monsterdb.h index c51549760..61778c44c 100644 --- a/src/resources/db/monsterdb.h +++ b/src/resources/db/monsterdb.h @@ -24,6 +24,7 @@ #define RESOURCES_DB_MONSTERDB_H #include "enums/simpletypes/beingtypeid.h" +#include "enums/simpletypes/skiperror.h" #include "localconsts.h" @@ -40,7 +41,8 @@ namespace MonsterDB void unload(); - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); BeingInfo *get(const BeingTypeId id) A_WARN_UNUSED; } // namespace MonsterDB diff --git a/src/resources/db/npcdb.cpp b/src/resources/db/npcdb.cpp index 1827cd859..6c63ee57f 100644 --- a/src/resources/db/npcdb.cpp +++ b/src/resources/db/npcdb.cpp @@ -48,16 +48,17 @@ void NPCDB::load() logger->log1("Initializing NPC database..."); - loadXmlFile(paths.getStringValue("npcsFile")); - loadXmlFile(paths.getStringValue("npcsPatchFile")); + loadXmlFile(paths.getStringValue("npcsFile"), SkipError_false); + loadXmlFile(paths.getStringValue("npcsPatchFile"), SkipError_true); loadXmlDir("npcsPatchDir", loadXmlFile); mLoaded = true; } -void NPCDB::loadXmlFile(const std::string &fileName) +void NPCDB::loadXmlFile(const std::string &fileName, + const SkipError skipError) { - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, UseResman_true, skipError); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "npcs")) @@ -75,7 +76,7 @@ void NPCDB::loadXmlFile(const std::string &fileName) { const std::string name = XML::getProperty(npcNode, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } diff --git a/src/resources/db/npcdb.h b/src/resources/db/npcdb.h index a53239683..5fcfd68ed 100644 --- a/src/resources/db/npcdb.h +++ b/src/resources/db/npcdb.h @@ -24,6 +24,7 @@ #define RESOURCES_DB_NPCDB_H #include "enums/simpletypes/beingtypeid.h" +#include "enums/simpletypes/skiperror.h" #include <string> @@ -44,7 +45,8 @@ namespace NPCDB BeingTypeId getAvatarFor(const BeingTypeId id); - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); } // namespace NPCDB #endif // RESOURCES_DB_NPCDB_H diff --git a/src/resources/db/npcdialogdb.cpp b/src/resources/db/npcdialogdb.cpp index 526561935..d59f472ad 100644 --- a/src/resources/db/npcdialogdb.cpp +++ b/src/resources/db/npcdialogdb.cpp @@ -42,8 +42,8 @@ void NpcDialogDB::load() unload(); logger->log1("Loading npcdialog database..."); - loadXmlFile(paths.getStringValue("npcDialogsFile")); - loadXmlFile(paths.getStringValue("npcDialogsPatchFile")); + loadXmlFile(paths.getStringValue("npcDialogsFile"), SkipError_false); + loadXmlFile(paths.getStringValue("npcDialogsPatchFile"), SkipError_true); loadXmlDir("npcDialogsPatchDir", loadXmlFile); mLoaded = true; @@ -144,11 +144,12 @@ static void loadNpcDialog(NpcDialogInfo *const dialog, } } -void NpcDialogDB::loadXmlFile(const std::string &fileName) +void NpcDialogDB::loadXmlFile(const std::string &fileName, + const SkipError skipError) { XML::Document *const doc = new XML::Document(fileName, UseResman_true, - SkipError_false); + skipError); const XmlNodePtrConst root = doc->rootNode(); if (!root) @@ -177,7 +178,7 @@ void NpcDialogDB::loadXmlFile(const std::string &fileName) { const std::string name = XML::getProperty(node, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } } diff --git a/src/resources/db/npcdialogdb.h b/src/resources/db/npcdialogdb.h index b99c7173c..063241d7d 100644 --- a/src/resources/db/npcdialogdb.h +++ b/src/resources/db/npcdialogdb.h @@ -21,6 +21,8 @@ #ifndef RESOURCES_DB_NPCDIALOGDB_H #define RESOURCES_DB_NPCDIALOGDB_H +#include "enums/simpletypes/skiperror.h" + #include <map> #include <string> @@ -38,7 +40,8 @@ namespace NpcDialogDB */ void load(); - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); /** * Clear the remap data diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp index 6c56f3437..03791945b 100644 --- a/src/resources/db/petdb.cpp +++ b/src/resources/db/petdb.cpp @@ -47,15 +47,18 @@ void PETDB::load() unload(); logger->log1("Initializing PET database..."); - loadXmlFile(paths.getStringValue("petsFile")); - loadXmlFile(paths.getStringValue("petsPatchFile")); + loadXmlFile(paths.getStringValue("petsFile"), SkipError_false); + loadXmlFile(paths.getStringValue("petsPatchFile"), SkipError_true); loadXmlDir("petsPatchDir", loadXmlFile); mLoaded = true; } -void PETDB::loadXmlFile(const std::string &fileName) +void PETDB::loadXmlFile(const std::string &fileName, + const SkipError skipError) { - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, + UseResman_true, + skipError); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "pets")) @@ -72,7 +75,7 @@ void PETDB::loadXmlFile(const std::string &fileName) { const std::string name = XML::getProperty(petNode, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } else if (!xmlNameEqual(petNode, "pet")) diff --git a/src/resources/db/petdb.h b/src/resources/db/petdb.h index 3bfa5d929..fdb84d4b7 100644 --- a/src/resources/db/petdb.h +++ b/src/resources/db/petdb.h @@ -24,6 +24,7 @@ #define RESOURCES_DB_PETDB_H #include "enums/simpletypes/beingtypeid.h" +#include "enums/simpletypes/skiperror.h" #include <string> @@ -35,7 +36,8 @@ namespace PETDB { void load(); - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); void unload(); diff --git a/src/resources/db/skillunitdb.cpp b/src/resources/db/skillunitdb.cpp index f77e3f3a2..16a080abd 100644 --- a/src/resources/db/skillunitdb.cpp +++ b/src/resources/db/skillunitdb.cpp @@ -47,15 +47,16 @@ void SkillUnitDb::load() unload(); logger->log1("Initializing skill unit database..."); - loadXmlFile(paths.getStringValue("skillUnitsFile")); - loadXmlFile(paths.getStringValue("skillUnitsPatchFile")); + loadXmlFile(paths.getStringValue("skillUnitsFile"), SkipError_true); + loadXmlFile(paths.getStringValue("skillUnitsPatchFile"), SkipError_false); loadXmlDir("skillUnitsPatchDir", loadXmlFile); mLoaded = true; } -void SkillUnitDb::loadXmlFile(const std::string &fileName) +void SkillUnitDb::loadXmlFile(const std::string &fileName, + const SkipError skipError) { - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, UseResman_true, skipError); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "skillunits")) @@ -73,7 +74,7 @@ void SkillUnitDb::loadXmlFile(const std::string &fileName) const std::string name = XML::getProperty(skillUnitNode, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } else if (!xmlNameEqual(skillUnitNode, "skillunit")) diff --git a/src/resources/db/skillunitdb.h b/src/resources/db/skillunitdb.h index 4498d4e62..83a135699 100644 --- a/src/resources/db/skillunitdb.h +++ b/src/resources/db/skillunitdb.h @@ -24,6 +24,7 @@ #define RESOURCES_DB_SKILLUNITDB_H #include "enums/simpletypes/beingtypeid.h" +#include "enums/simpletypes/skiperror.h" #include <string> @@ -35,7 +36,8 @@ namespace SkillUnitDb { void load(); - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); void unload(); diff --git a/src/resources/db/sounddb.cpp b/src/resources/db/sounddb.cpp index 238e17b51..3268a3e9c 100644 --- a/src/resources/db/sounddb.cpp +++ b/src/resources/db/sounddb.cpp @@ -38,16 +38,17 @@ namespace void SoundDB::load() { unload(); - loadXmlFile(paths.getStringValue("soundsFile")); - loadXmlFile(paths.getStringValue("soundsPatchFile")); + loadXmlFile(paths.getStringValue("soundsFile"), SkipError_false); + loadXmlFile(paths.getStringValue("soundsPatchFile"), SkipError_true); loadXmlDir("soundsPatchDir", loadXmlFile); } -void SoundDB::loadXmlFile(const std::string &fileName) +void SoundDB::loadXmlFile(const std::string &fileName, + const SkipError skipError) { XML::Document *doc = new XML::Document(fileName, UseResman_true, - SkipError_false); + skipError); const XmlNodePtrConst root = doc->rootNode(); if (!root || !xmlNameEqual(root, "sounds")) @@ -62,7 +63,7 @@ void SoundDB::loadXmlFile(const std::string &fileName) { const std::string name = XML::getProperty(node, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } else if (xmlNameEqual(node, "sound")) diff --git a/src/resources/db/sounddb.h b/src/resources/db/sounddb.h index a0710d688..6230cefae 100644 --- a/src/resources/db/sounddb.h +++ b/src/resources/db/sounddb.h @@ -21,6 +21,8 @@ #ifndef RESOURCES_DB_SOUNDDB_H #define RESOURCES_DB_SOUNDDB_H +#include "enums/simpletypes/skiperror.h" + #include <string> #include "localconsts.h" @@ -29,7 +31,8 @@ namespace SoundDB { void load(); - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); void unload(); diff --git a/src/resources/db/statuseffectdb.cpp b/src/resources/db/statuseffectdb.cpp index 0649497dc..a89915103 100644 --- a/src/resources/db/statuseffectdb.cpp +++ b/src/resources/db/statuseffectdb.cpp @@ -76,16 +76,18 @@ void StatusEffectDB::load() if (mLoaded) unload(); - loadXmlFile(paths.getStringValue("statusEffectsFile")); - loadXmlFile(paths.getStringValue("statusEffectsPatchFile")); + loadXmlFile(paths.getStringValue("statusEffectsFile"), SkipError_false); + loadXmlFile(paths.getStringValue("statusEffectsPatchFile"), + SkipError_true); loadXmlDir("statusEffectsPatchDir", loadXmlFile); mLoaded = true; } -void StatusEffectDB::loadXmlFile(const std::string &fileName) +void StatusEffectDB::loadXmlFile(const std::string &fileName, + const SkipError skipError) { - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, UseResman_true, skipError); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "status-effects")) @@ -100,7 +102,7 @@ void StatusEffectDB::loadXmlFile(const std::string &fileName) { const std::string incName = XML::getProperty(node, "name", ""); if (!incName.empty()) - loadXmlFile(incName); + loadXmlFile(incName, skipError); continue; } else if (!xmlNameEqual(node, "status-effect")) diff --git a/src/resources/db/statuseffectdb.h b/src/resources/db/statuseffectdb.h index c713979fd..0231b3ec3 100644 --- a/src/resources/db/statuseffectdb.h +++ b/src/resources/db/statuseffectdb.h @@ -24,6 +24,7 @@ #define RESOURCES_DB_STATUSEFFECTDB_H #include "enums/simpletypes/enable.h" +#include "enums/simpletypes/skiperror.h" #include <map> #include <string> @@ -58,7 +59,8 @@ namespace StatusEffectDB void load(); - void loadXmlFile(const std::string &fileName); + void loadXmlFile(const std::string &fileName, + const SkipError skipError); void unload(); diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 497817a7d..7c3c0a2ca 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -205,11 +205,12 @@ int inflateMemory(unsigned char *restrict const in, return outLength; } -void MapReader::addLayerToList(const std::string &fileName) +void MapReader::addLayerToList(const std::string &fileName, + const SkipError skipError) { XML::Document *doc = new XML::Document(fileName, UseResman_true, - SkipError_false); + skipError); XmlNodePtrConst node = doc->rootNode(); if (!node) { @@ -283,7 +284,7 @@ Map *MapReader::readMap(const std::string &restrict filename, void MapReader::loadLayers(const std::string &path) { BLOCK_START("MapReader::loadLayers") - loadXmlDir2(path, addLayerToList, ".tmx"); + loadXmlDir2(path, addLayerToList, ".tmx", SkipError_false); BLOCK_END("MapReader::loadLayers") } diff --git a/src/resources/mapreader.h b/src/resources/mapreader.h index 781a52cca..37b511d03 100644 --- a/src/resources/mapreader.h +++ b/src/resources/mapreader.h @@ -99,7 +99,8 @@ class MapReader final static void updateMusic(Map *const map) A_NONNULL(1); - static void addLayerToList(const std::string &fileName); + static void addLayerToList(const std::string &fileName, + const SkipError skipError); static void loadLayers(const std::string &path); diff --git a/src/units.cpp b/src/units.cpp index 57cc3aa6e..237b414f0 100644 --- a/src/units.cpp +++ b/src/units.cpp @@ -100,14 +100,15 @@ void Units::loadUnits() units[UNIT_CURRENCY] = ud; } - loadXmlFile(paths.getStringValue("unitsFile")); - loadXmlFile(paths.getStringValue("unitsPatchFile")); + loadXmlFile(paths.getStringValue("unitsFile"), SkipError_false); + loadXmlFile(paths.getStringValue("unitsPatchFile"), SkipError_true); loadXmlDir("unitsPatchDir", loadXmlFile); } -void Units::loadXmlFile(const std::string &fileName) +void Units::loadXmlFile(const std::string &fileName, + const SkipError skipError) { - XML::Document doc(fileName, UseResman_true, SkipError_false); + XML::Document doc(fileName, UseResman_true, skipError); const XmlNodePtrConst root = doc.rootNode(); if (!root || !xmlNameEqual(root, "units")) @@ -123,7 +124,7 @@ void Units::loadXmlFile(const std::string &fileName) { const std::string name = XML::getProperty(node, "name", ""); if (!name.empty()) - loadXmlFile(name); + loadXmlFile(name, skipError); continue; } else if (xmlNameEqual(node, "unit")) diff --git a/src/units.h b/src/units.h index d0c71cb2d..eb8d38587 100644 --- a/src/units.h +++ b/src/units.h @@ -23,6 +23,8 @@ #ifndef UNITS_H #define UNITS_H +#include "enums/simpletypes/skiperror.h" + #include <string> #include "localconsts.h" @@ -37,7 +39,8 @@ class Units final */ static void loadUnits(); - static void loadXmlFile(const std::string &fileName); + static void loadXmlFile(const std::string &fileName, + const SkipError skipError); /** * Formats the given number in the correct currency format. |