From d5a00a320043f5782ebc489285c89943b667e094 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 12 May 2016 00:18:57 +0300 Subject: Add skipError parameter to loadXml functions. This allow not show errors for some not main xml files. --- src/gui/windows/questswindow.cpp | 13 ++++++++----- src/gui/windows/questswindow.h | 3 ++- src/gui/windows/skilldialog.cpp | 15 +++++++++------ src/gui/windows/skilldialog.h | 4 +++- 4 files changed, 22 insertions(+), 13 deletions(-) (limited to 'src/gui') 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(); -- cgit v1.2.3-60-g2f50