diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-06 23:27:42 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-06 23:27:42 +0300 |
commit | 2bca0787182eb1637cd82fc246bc19578e90ca09 (patch) | |
tree | 046bc50c0cf38c3f7ad86798556a723e62df5a68 | |
parent | 6c9ef6af1b72b74b9ab94cc1c1349c3cd70c8be6 (diff) | |
download | manaverse-2bca0787182eb1637cd82fc246bc19578e90ca09.tar.gz manaverse-2bca0787182eb1637cd82fc246bc19578e90ca09.tar.bz2 manaverse-2bca0787182eb1637cd82fc246bc19578e90ca09.tar.xz manaverse-2bca0787182eb1637cd82fc246bc19578e90ca09.zip |
Add strong typed bool type SkipError.
33 files changed, 59 insertions, 42 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp index 0ed1299bb..d5af8c79f 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -714,7 +714,7 @@ void Configuration::init(const std::string &filename, const UseResman useResManager) { cleanDefaults(); - XML::Document doc(filename, useResManager, false); + XML::Document doc(filename, useResManager, SkipError_false); mFilename = filename; mUseResManager = useResManager; @@ -750,7 +750,7 @@ void Configuration::init(const std::string &filename, void Configuration::reInit() { - XML::Document doc(mFilename, mUseResManager, false); + XML::Document doc(mFilename, mUseResManager, SkipError_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 10ef68089..38e29c739 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, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_false); const XmlNodePtrConst root = doc.rootNode(); if (!root || !xmlNameEqual(root, "being-effects")) diff --git a/src/enums/simpletypes.h b/src/enums/simpletypes.h index 217028f56..90e39c364 100644 --- a/src/enums/simpletypes.h +++ b/src/enums/simpletypes.h @@ -66,5 +66,6 @@ defBoolEnum(NpcNames); defBoolEnum(Enable); defBoolEnum(ForceDisplay); defBoolEnum(UseResman); +defBoolEnum(SkipError); #endif // ENUMS_SIMPLETYPES_H diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 6f6f622a5..844341e3f 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -373,7 +373,9 @@ Skin *Theme::readSkin(const std::string &filename, const bool full) // logger->log("Loading skin '%s'.", filename.c_str()); - XML::Document doc(resolveThemePath(filename), UseResman_true, true); + XML::Document doc(resolveThemePath(filename), + UseResman_true, + SkipError_true); const XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "skinset")) @@ -967,7 +969,7 @@ void Theme::loadColors(std::string file) else file.append("/colors.xml"); - XML::Document doc(resolveThemePath(file), UseResman_true, false); + XML::Document doc(resolveThemePath(file), UseResman_true, SkipError_false); const XmlNodePtrConst root = doc.rootNode(); if (!root || !xmlNameEqual(root, "colors")) @@ -1156,7 +1158,7 @@ ThemeInfo *Theme::loadInfo(const std::string &themeName) themeName).append("/info.xml"); } logger->log("loading: " + path); - XML::Document doc(path, UseResman_true, false); + XML::Document doc(path, UseResman_true, SkipError_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 08cb4eccb..80d8f8fbe 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -573,7 +573,7 @@ void EquipmentWindow::fillBoxes() XML::Document *const doc = new XML::Document( paths.getStringValue("equipmentWindowFile"), UseResman_true, - false); + SkipError_false); const XmlNodePtr root = doc->rootNode(); if (!root) { diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp index cb7c8ae5f..3a7fd8acc 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, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_false); const XmlNodePtrConst root = doc.rootNode(); if (!root) return; diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index 8aae85e23..e82bcc806 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -453,7 +453,7 @@ void ServerDialog::loadServers(const bool addNew) XML::Document doc(std::string(mDir).append("/").append( branding.getStringValue("onlineServerFile")), UseResman_false, - false); + SkipError_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 a512a89ad..10a5f987b 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -261,7 +261,7 @@ void SkillDialog::loadSkills() void SkillDialog::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_false); XmlNodePtrConst root = doc.rootNode(); int setCount = 0; diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 9dd27a9c1..ab6295ab5 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -77,7 +77,7 @@ static std::vector<UpdateFile> loadXMLFile(const std::string &fileName, const bool loadMods) { std::vector<UpdateFile> files; - XML::Document doc(fileName, UseResman_false, false); + XML::Document doc(fileName, UseResman_false, SkipError_false); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "updates")) diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index 2fdb6eab0..08131cd23 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -290,7 +290,9 @@ 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), UseResman_true, false); + XML::Document doc(particleEffectFile.substr(0, pos), + UseResman_true, + SkipError_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 ab8e7d2c9..7e58db364 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, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_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 6f304cf65..9b6f24358 100644 --- a/src/resources/db/chardb.cpp +++ b/src/resources/db/chardb.cpp @@ -51,7 +51,7 @@ void CharDB::load() XML::Document *doc = new XML::Document( paths.getStringValue("charCreationFile"), UseResman_true, - false); + SkipError_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 d1ac10e3f..1b636e407 100644 --- a/src/resources/db/colordb.cpp +++ b/src/resources/db/colordb.cpp @@ -70,7 +70,9 @@ void ColorDB::load() void ColorDB::loadHair(const std::string &fileName, std::map<int, ItemColor> &colors) { - XML::Document *doc = new XML::Document(fileName, UseResman_true, false); + XML::Document *doc = new XML::Document(fileName, + UseResman_true, + SkipError_false); const XmlNodePtrConst root = doc->rootNode(); if (!root || !xmlNameEqual(root, "colors")) @@ -108,7 +110,9 @@ void ColorDB::loadHair(const std::string &fileName, void ColorDB::loadColorLists(const std::string &fileName) { - XML::Document *doc = new XML::Document(fileName, UseResman_true, false); + XML::Document *doc = new XML::Document(fileName, + UseResman_true, + SkipError_false); const XmlNodePtrConst root = doc->rootNode(); if (!root) { diff --git a/src/resources/db/commandsdb.cpp b/src/resources/db/commandsdb.cpp index be7666f32..091ae718c 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, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_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 a3465dabd..24d62a796 100644 --- a/src/resources/db/deaddb.cpp +++ b/src/resources/db/deaddb.cpp @@ -48,7 +48,9 @@ void DeadDB::load() void DeadDB::loadXmlFile(const std::string &fileName) { - XML::Document *doc = new XML::Document(fileName, UseResman_true, false); + XML::Document *doc = new XML::Document(fileName, + UseResman_true, + SkipError_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 37c0bacc7..accea5ae9 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, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_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, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_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 b954ea9ab..173b37e65 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, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_false); const XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "homunculuses")) diff --git a/src/resources/db/horsedb.cpp b/src/resources/db/horsedb.cpp index df653ecfe..11fd57d36 100644 --- a/src/resources/db/horsedb.cpp +++ b/src/resources/db/horsedb.cpp @@ -58,7 +58,7 @@ void HorseDB::load() void HorseDB::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_false); XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "horses")) diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index cf78a0a06..d1ec2d00f 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, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_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 a40a7b2ae..1bd63af2f 100644 --- a/src/resources/db/mapdb.cpp +++ b/src/resources/db/mapdb.cpp @@ -61,7 +61,7 @@ void MapDB::loadRemapXmlFile(const std::string &fileName) { XML::Document *const doc = new XML::Document(fileName, UseResman_true, - false); + SkipError_false); const XmlNodePtrConst root = doc->rootNode(); if (!root) @@ -144,7 +144,7 @@ void MapDB::loadInfo(const std::string &fileName) { XML::Document *doc = new XML::Document(fileName, UseResman_true, - false); + SkipError_false); const XmlNodePtrConst root = doc->rootNode(); if (!root) { diff --git a/src/resources/db/mercenarydb.cpp b/src/resources/db/mercenarydb.cpp index f8ecd9839..a101bc891 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, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_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 82cd14be8..49e9b48f5 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, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_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 0c546ff25..cfb7f4e92 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, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_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 101f95f1a..bb006e75a 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, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_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 47723b92d..31893403f 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, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_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 8e1d22bc0..09b7af65d 100644 --- a/src/resources/db/sounddb.cpp +++ b/src/resources/db/sounddb.cpp @@ -44,7 +44,9 @@ void SoundDB::load() void SoundDB::loadXmlFile(const std::string &fileName) { - XML::Document *doc = new XML::Document(fileName, UseResman_true, false); + XML::Document *doc = new XML::Document(fileName, + UseResman_true, + SkipError_false); const XmlNodePtrConst root = doc->rootNode(); if (!root || !xmlNameEqual(root, "sounds")) diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 474e339ec..421915775 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -204,7 +204,9 @@ int inflateMemory(unsigned char *restrict const in, void MapReader::addLayerToList(const std::string &fileName) { - XML::Document *doc = new XML::Document(fileName, UseResman_true, false); + XML::Document *doc = new XML::Document(fileName, + UseResman_true, + SkipError_false); XmlNodePtrConst node = doc->rootNode(); if (!node) { @@ -236,7 +238,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, UseResman_true, false); + XML::Document doc(realFilename, UseResman_true, SkipError_false); if (!doc.isLoaded()) { BLOCK_END("MapReader::readMap str") @@ -894,7 +896,7 @@ Tileset *MapReader::readTileset(XmlNodePtr node, std::string filename = XML::getProperty(node, "source", ""); filename = resolveRelativePath(path, filename); - doc = new XML::Document(filename, UseResman_true, false); + doc = new XML::Document(filename, UseResman_true, SkipError_false); node = doc->rootNode(); if (!node) { diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp index d22cc7899..9dae7289e 100644 --- a/src/resources/spritedef.cpp +++ b/src/resources/spritedef.cpp @@ -87,7 +87,9 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, if (pos != std::string::npos) palettes = animationFile.substr(pos + 1); - XML::Document doc(animationFile.substr(0, pos), UseResman_true, false); + XML::Document doc(animationFile.substr(0, pos), + UseResman_true, + SkipError_false); XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "sprite")) @@ -434,7 +436,7 @@ void SpriteDef::includeSprite(const XmlNodePtr includeNode, const int variant) } mProcessedFiles.insert(filename); - XML::Document doc(filename, UseResman_true, false); + XML::Document doc(filename, UseResman_true, SkipError_false); const XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "sprite")) diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index 60b32f31d..8090f8011 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -151,7 +151,7 @@ void StatusEffect::load() void StatusEffect::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_false); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "status-effects")) diff --git a/src/units.cpp b/src/units.cpp index 79fca0ea9..b19944ccd 100644 --- a/src/units.cpp +++ b/src/units.cpp @@ -107,7 +107,7 @@ void Units::loadUnits() void Units::loadXmlFile(const std::string &fileName) { - XML::Document doc(fileName, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_false); const XmlNodePtrConst root = doc.rootNode(); if (!root || !xmlNameEqual(root, "units")) diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index 487c177bb..f2cbdb384 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -77,7 +77,7 @@ namespace XML { Document::Document(const std::string &filename, const UseResman useResman, - const bool skipError) : + const SkipError skipError) : mDoc(nullptr), mIsValid(false) { @@ -125,7 +125,7 @@ namespace XML if (!mDoc) logger->log("Error parsing XML file %s", filename.c_str()); } - else if (!skipError) + else if (skipError == SkipError_false) { logger->log("Error loading %s", filename.c_str()); } diff --git a/src/utils/xml.h b/src/utils/xml.h index f8d531963..fdefc1682 100644 --- a/src/utils/xml.h +++ b/src/utils/xml.h @@ -69,7 +69,7 @@ namespace XML */ Document(const std::string &filename, const UseResman useResman, - const bool skipError); + const SkipError skipError); /** * Constructor that attempts to load an XML document from memory. diff --git a/src/utils/xmlutils.cpp b/src/utils/xmlutils.cpp index f275477c0..232ec92b1 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, UseResman_true, false); + XML::Document doc(fileName, UseResman_true, SkipError_false); const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, rootName.c_str())) |