diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-02-07 17:51:56 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-02-07 17:51:56 +0300 |
commit | bd2b67c0d1511a0068dfa3caf90a784fdf6fd3f2 (patch) | |
tree | 34749cc1679dc9a4d81652e77ed8aaf775f89882 | |
parent | 328eaa8ded37e86f2575cb2804d1aaa36cdd4a1b (diff) | |
download | manaplus-bd2b67c0d1511a0068dfa3caf90a784fdf6fd3f2.tar.gz manaplus-bd2b67c0d1511a0068dfa3caf90a784fdf6fd3f2.tar.bz2 manaplus-bd2b67c0d1511a0068dfa3caf90a784fdf6fd3f2.tar.xz manaplus-bd2b67c0d1511a0068dfa3caf90a784fdf6fd3f2.zip |
Dont show some useless errors while loading themes.
31 files changed, 46 insertions, 41 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp index df098dc90..8a9caae60 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -712,7 +712,7 @@ void ConfigurationObject::initFromXML(const XmlNodePtrConst parent_node) void Configuration::init(const std::string &filename, const bool useResManager) { cleanDefaults(); - XML::Document doc(filename, useResManager); + XML::Document doc(filename, useResManager, false); mFilename = filename; mUseResManager = useResManager; @@ -748,7 +748,7 @@ void Configuration::init(const std::string &filename, const bool useResManager) void Configuration::reInit() { - XML::Document doc(mFilename, mUseResManager); + XML::Document doc(mFilename, mUseResManager, false); if (!doc.rootNode()) { logger->log("Couldn't open configuration file: %s", mFilename.c_str()); diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp index a390e3707..1f5db8344 100644 --- a/src/effectmanager.cpp +++ b/src/effectmanager.cpp @@ -47,7 +47,7 @@ EffectManager::EffectManager() : void EffectManager::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, true); + XML::Document doc(fileName, true, false); const XmlNodePtrConst root = doc.rootNode(); if (!root || !xmlNameEqual(root, "being-effects")) diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 98db5dc4c..f2cfc4c09 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -373,7 +373,7 @@ Skin *Theme::readSkin(const std::string &filename, const bool full) // logger->log("Loading skin '%s'.", filename.c_str()); - XML::Document doc(resolveThemePath(filename), true); + XML::Document doc(resolveThemePath(filename), true, true); const XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "skinset")) @@ -967,7 +967,7 @@ void Theme::loadColors(std::string file) else file.append("/colors.xml"); - XML::Document doc(resolveThemePath(file), true); + XML::Document doc(resolveThemePath(file), true, false); const XmlNodePtrConst root = doc.rootNode(); if (!root || !xmlNameEqual(root, "colors")) @@ -1156,7 +1156,7 @@ ThemeInfo *Theme::loadInfo(const std::string &themeName) themeName).append("/info.xml"); } logger->log("loading: " + path); - XML::Document doc(path, true); + XML::Document doc(path, true, false); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "info")) diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index f5403449f..24bda1f0d 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -572,7 +572,8 @@ void EquipmentWindow::fillBoxes() { XML::Document *const doc = new XML::Document( paths.getStringValue("equipmentWindowFile"), - true); + true, + false); const XmlNodePtr root = doc->rootNode(); if (!root) { diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp index 370d6257d..fed9e36c6 100644 --- a/src/gui/windows/questswindow.cpp +++ b/src/gui/windows/questswindow.cpp @@ -166,7 +166,7 @@ QuestsWindow::~QuestsWindow() void QuestsWindow::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, true); + XML::Document doc(fileName, true, false); const XmlNodePtrConst root = doc.rootNode(); if (!root) return; diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index fab444050..a9542e74c 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -461,7 +461,7 @@ void ServerDialog::downloadServerList() void ServerDialog::loadServers(const bool addNew) { XML::Document doc(std::string(mDir).append("/").append( - branding.getStringValue("onlineServerFile")), false); + branding.getStringValue("onlineServerFile")), false, false); const XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "serverlist")) diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 14261a70a..9a2f37d12 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -264,7 +264,7 @@ void SkillDialog::loadSkills() void SkillDialog::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, true); + XML::Document doc(fileName, true, false); XmlNodePtrConst root = doc.rootNode(); int setCount = 0; diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 30477821e..fb3c55e4a 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -79,7 +79,7 @@ static std::vector<UpdateFile> loadXMLFile(const std::string &fileName, const bool loadMods) { std::vector<UpdateFile> files; - XML::Document doc(fileName, false); + XML::Document doc(fileName, false, false); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "updates")) diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index c0bd275e1..b75b8973b 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -292,7 +292,7 @@ Particle *Particle::addEffect(const std::string &particleEffectFile, const size_t pos = particleEffectFile.find('|'); const std::string dyePalettes = (pos != std::string::npos) ? particleEffectFile.substr(pos + 1) : ""; - XML::Document doc(particleEffectFile.substr(0, pos), true); + XML::Document doc(particleEffectFile.substr(0, pos), true, false); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "effect")) diff --git a/src/resources/db/avatardb.cpp b/src/resources/db/avatardb.cpp index c01eff88b..52242b4fe 100644 --- a/src/resources/db/avatardb.cpp +++ b/src/resources/db/avatardb.cpp @@ -52,7 +52,7 @@ void AvatarDB::load() void AvatarDB::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, true); + XML::Document doc(fileName, true, false); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "avatars")) diff --git a/src/resources/db/chardb.cpp b/src/resources/db/chardb.cpp index 15810596b..b05beb75c 100644 --- a/src/resources/db/chardb.cpp +++ b/src/resources/db/chardb.cpp @@ -50,7 +50,8 @@ void CharDB::load() XML::Document *doc = new XML::Document( paths.getStringValue("charCreationFile"), - true); + true, + false); const XmlNodePtrConst root = doc->rootNode(); if (!root || !xmlNameEqual(root, "chars")) diff --git a/src/resources/db/colordb.cpp b/src/resources/db/colordb.cpp index ff4833f2c..77024d290 100644 --- a/src/resources/db/colordb.cpp +++ b/src/resources/db/colordb.cpp @@ -72,7 +72,7 @@ void ColorDB::load() void ColorDB::loadHair(const std::string &fileName, std::map<int, ItemColor> &colors) { - XML::Document *doc = new XML::Document(fileName, true); + XML::Document *doc = new XML::Document(fileName, true, false); const XmlNodePtrConst root = doc->rootNode(); if (!root || !xmlNameEqual(root, "colors")) @@ -110,7 +110,7 @@ void ColorDB::loadHair(const std::string &fileName, void ColorDB::loadColorLists(const std::string &fileName) { - XML::Document *doc = new XML::Document(fileName, true); + XML::Document *doc = new XML::Document(fileName, true, false); const XmlNodePtrConst root = doc->rootNode(); if (!root) { diff --git a/src/resources/db/commandsdb.cpp b/src/resources/db/commandsdb.cpp index f1c177916..daab8ef2e 100644 --- a/src/resources/db/commandsdb.cpp +++ b/src/resources/db/commandsdb.cpp @@ -58,7 +58,7 @@ static SpellTarget parseTarget(const std::string &text) void CommandsDB::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, true); + XML::Document doc(fileName, true, false); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "commands")) diff --git a/src/resources/db/deaddb.cpp b/src/resources/db/deaddb.cpp index 45bc77478..fcb44e63f 100644 --- a/src/resources/db/deaddb.cpp +++ b/src/resources/db/deaddb.cpp @@ -48,7 +48,7 @@ void DeadDB::load() void DeadDB::loadXmlFile(const std::string &fileName) { - XML::Document *doc = new XML::Document(fileName, true); + XML::Document *doc = new XML::Document(fileName, true, false); const XmlNodePtrConst root = doc->rootNode(); if (!root || !xmlNameEqual(root, "messages")) diff --git a/src/resources/db/emotedb.cpp b/src/resources/db/emotedb.cpp index f527a9624..7da44c0da 100644 --- a/src/resources/db/emotedb.cpp +++ b/src/resources/db/emotedb.cpp @@ -67,7 +67,7 @@ void EmoteDB::load() void EmoteDB::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, true); + XML::Document doc(fileName, true, false); XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "emotes")) @@ -143,7 +143,7 @@ void EmoteDB::loadXmlFile(const std::string &fileName) void EmoteDB::loadSpecialXmlFile(const std::string &fileName) { - XML::Document doc(fileName, true); + XML::Document doc(fileName, true, false); XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "emotes")) diff --git a/src/resources/db/homunculusdb.cpp b/src/resources/db/homunculusdb.cpp index e5337f8c3..75194c4c7 100644 --- a/src/resources/db/homunculusdb.cpp +++ b/src/resources/db/homunculusdb.cpp @@ -56,7 +56,7 @@ void HomunculusDB::load() void HomunculusDB::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, true); + XML::Document doc(fileName, true, false); const XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "homunculuses")) diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index ba072f62a..189288bf1 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -234,7 +234,7 @@ void ItemDB::load() void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum) { - XML::Document doc(fileName, true); + XML::Document doc(fileName, true, false); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "items")) diff --git a/src/resources/db/mapdb.cpp b/src/resources/db/mapdb.cpp index 1a419bf9d..73a4a9905 100644 --- a/src/resources/db/mapdb.cpp +++ b/src/resources/db/mapdb.cpp @@ -59,7 +59,7 @@ void MapDB::load() void MapDB::loadRemapXmlFile(const std::string &fileName) { - XML::Document *const doc = new XML::Document(fileName, true); + XML::Document *const doc = new XML::Document(fileName, true, false); const XmlNodePtrConst root = doc->rootNode(); if (!root) @@ -140,7 +140,7 @@ void MapDB::readAtlas(XmlNodePtrConst node) void MapDB::loadInfo(const std::string &fileName) { - XML::Document *doc = new XML::Document(fileName, true); + XML::Document *doc = new XML::Document(fileName, true, false); const XmlNodePtrConst root = doc->rootNode(); if (!root) { diff --git a/src/resources/db/mercenarydb.cpp b/src/resources/db/mercenarydb.cpp index 5ce60f131..c63e8acd2 100644 --- a/src/resources/db/mercenarydb.cpp +++ b/src/resources/db/mercenarydb.cpp @@ -56,7 +56,7 @@ void MercenaryDB::load() void MercenaryDB::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, true); + XML::Document doc(fileName, true, false); const XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "mercenaries")) diff --git a/src/resources/db/moddb.cpp b/src/resources/db/moddb.cpp index 81fc1e428..5c4ffe0f6 100644 --- a/src/resources/db/moddb.cpp +++ b/src/resources/db/moddb.cpp @@ -50,7 +50,7 @@ void ModDB::load() void ModDB::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, true); + XML::Document doc(fileName, true, false); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "mods")) diff --git a/src/resources/db/monsterdb.cpp b/src/resources/db/monsterdb.cpp index 7d6fe30b2..3e4c78e63 100644 --- a/src/resources/db/monsterdb.cpp +++ b/src/resources/db/monsterdb.cpp @@ -59,7 +59,7 @@ void MonsterDB::load() void MonsterDB::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, true); + XML::Document doc(fileName, true, false); const XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "monsters")) diff --git a/src/resources/db/npcdb.cpp b/src/resources/db/npcdb.cpp index 079bbe4c8..6ba5fd0da 100644 --- a/src/resources/db/npcdb.cpp +++ b/src/resources/db/npcdb.cpp @@ -56,7 +56,7 @@ void NPCDB::load() void NPCDB::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, true); + XML::Document doc(fileName, true, false); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "npcs")) diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp index c89725a17..1f7fee0b7 100644 --- a/src/resources/db/petdb.cpp +++ b/src/resources/db/petdb.cpp @@ -54,7 +54,7 @@ void PETDB::load() void PETDB::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, true); + XML::Document doc(fileName, true, false); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "pets")) diff --git a/src/resources/db/sounddb.cpp b/src/resources/db/sounddb.cpp index c6e5bcb8a..ce61bf6d4 100644 --- a/src/resources/db/sounddb.cpp +++ b/src/resources/db/sounddb.cpp @@ -44,7 +44,7 @@ void SoundDB::load() void SoundDB::loadXmlFile(const std::string &fileName) { - XML::Document *doc = new XML::Document(fileName, true); + XML::Document *doc = new XML::Document(fileName, true, false); const XmlNodePtrConst root = doc->rootNode(); if (!root || !xmlNameEqual(root, "sounds")) diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 9c19419e3..5f95565ec 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -203,7 +203,7 @@ int inflateMemory(unsigned char *restrict const in, void MapReader::addLayerToList(const std::string &fileName) { - XML::Document *doc = new XML::Document(fileName, true); + XML::Document *doc = new XML::Document(fileName, true, false); XmlNodePtrConst node = doc->rootNode(); if (!node) { @@ -235,7 +235,7 @@ Map *MapReader::readMap(const std::string &restrict filename, BLOCK_START("MapReader::readMap str") logger->log("Attempting to read map %s", realFilename.c_str()); - XML::Document doc(realFilename, true); + XML::Document doc(realFilename, true, false); if (!doc.isLoaded()) { BLOCK_END("MapReader::readMap str") @@ -893,7 +893,7 @@ Tileset *MapReader::readTileset(XmlNodePtr node, std::string filename = XML::getProperty(node, "source", ""); filename = resolveRelativePath(path, filename); - doc = new XML::Document(filename, true); + doc = new XML::Document(filename, true, false); node = doc->rootNode(); if (!node) { diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp index 4151b73fd..6ea358448 100644 --- a/src/resources/spritedef.cpp +++ b/src/resources/spritedef.cpp @@ -87,7 +87,7 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, if (pos != std::string::npos) palettes = animationFile.substr(pos + 1); - XML::Document doc(animationFile.substr(0, pos), true); + XML::Document doc(animationFile.substr(0, pos), true, false); XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "sprite")) @@ -428,7 +428,7 @@ void SpriteDef::includeSprite(const XmlNodePtr includeNode, const int variant) } mProcessedFiles.insert(filename); - XML::Document doc(filename, true); + XML::Document doc(filename, true, false); const XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "sprite")) diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index a11c815e3..41697b852 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -150,7 +150,7 @@ void StatusEffect::load() void StatusEffect::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, true); + XML::Document doc(fileName, true, false); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "status-effects")) diff --git a/src/units.cpp b/src/units.cpp index a182c67db..577659818 100644 --- a/src/units.cpp +++ b/src/units.cpp @@ -111,7 +111,7 @@ void Units::loadUnits() void Units::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, true); + XML::Document doc(fileName, true, false); const XmlNodePtrConst root = doc.rootNode(); if (!root || !xmlNameEqual(root, "units")) diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index 179216b12..1cdb4678b 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -77,7 +77,9 @@ static void xmlErrorLogger(void *ctx A_UNUSED, const char *msg, ...) namespace XML { - Document::Document(const std::string &filename, const bool useResman) : + Document::Document(const std::string &filename, + const bool useResman, + const bool skipError) : mDoc(nullptr), mIsValid(false) { @@ -125,7 +127,7 @@ namespace XML if (!mDoc) logger->log("Error parsing XML file %s", filename.c_str()); } - else + else if (!skipError) { logger->log("Error loading %s", filename.c_str()); } diff --git a/src/utils/xml.h b/src/utils/xml.h index dd06f8df1..41e11c6b6 100644 --- a/src/utils/xml.h +++ b/src/utils/xml.h @@ -66,7 +66,8 @@ namespace XML * resource manager. Logs errors. */ explicit Document(const std::string &filename, - const bool useResman); + const bool useResman, + const bool skipError); /** * Constructor that attempts to load an XML document from memory. diff --git a/src/utils/xmlutils.cpp b/src/utils/xmlutils.cpp index 2e4a7d736..7c370dda0 100644 --- a/src/utils/xmlutils.cpp +++ b/src/utils/xmlutils.cpp @@ -34,7 +34,7 @@ void readXmlIntVector(const std::string &fileName, std::vector<int> &arr) { arr.clear(); - XML::Document doc(fileName, true); + XML::Document doc(fileName, true, false); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, rootName.c_str())) |