From 7cf5cb58865bc5f3951a6f4e40cf892ede96fc5a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 5 Jan 2012 18:35:21 +0300 Subject: Update copyrights year. --- src/gui/updaterwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui/updaterwindow.cpp') diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index ac51cc76f..089aa1ea1 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2004-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011 The ManaPlus Developers + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * -- cgit v1.2.3-70-g09d2 From 08dc59e8bff25736d15d11313e0296f60e248e0a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 8 Jan 2012 21:37:28 +0300 Subject: Add check for update files path. --- src/gui/updaterwindow.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/gui/updaterwindow.cpp') diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index 089aa1ea1..4e641b5ca 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -91,7 +91,8 @@ std::vector loadXMLFile(const std::string &fileName) else file.required = false; - files.push_back(file); + if (checkPath(file.name)) + files.push_back(file); } return files; @@ -118,7 +119,7 @@ std::vector loadTxtFile(const std::string &fileName) thisFile.required = true; thisFile.desc = ""; - if (!thisFile.name.empty()) + if (!thisFile.name.empty() && checkPath(thisFile.name)) files.push_back(thisFile); } } -- cgit v1.2.3-70-g09d2 From 793a119a7a36f9680dad108e75075c8c4bd4a0d0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 10 Jan 2012 18:58:54 +0300 Subject: Replace all xmlNodePtr to XmlNodePtr. --- src/actorsprite.cpp | 4 ++-- src/animationparticle.cpp | 2 +- src/animationparticle.h | 2 +- src/configuration.cpp | 4 ++-- src/configuration.h | 2 +- src/effectmanager.cpp | 2 +- src/gui/equipmentwindow.cpp | 8 ++++---- src/gui/equipmentwindow.h | 6 +++--- src/gui/serverdialog.cpp | 2 +- src/gui/skilldialog.cpp | 2 +- src/gui/theme.cpp | 4 ++-- src/gui/updaterwindow.cpp | 2 +- src/net/manaserv/attributes.cpp | 2 +- src/particle.cpp | 4 ++-- src/particleemitter.cpp | 4 ++-- src/particleemitter.h | 4 ++-- src/resources/chardb.cpp | 4 ++-- src/resources/chardb.h | 2 +- src/resources/colordb.cpp | 4 ++-- src/resources/emotedb.cpp | 2 +- src/resources/itemdb.cpp | 22 +++++++++++----------- src/resources/mapdb.cpp | 2 +- src/resources/mapreader.cpp | 14 +++++++------- src/resources/mapreader.h | 8 ++++---- src/resources/monsterdb.cpp | 2 +- src/resources/npcdb.cpp | 2 +- src/resources/specialdb.cpp | 2 +- src/resources/spritedef.cpp | 14 +++++++------- src/resources/spritedef.h | 10 +++++----- src/rotationalparticle.cpp | 2 +- src/rotationalparticle.h | 2 +- src/simpleanimation.cpp | 6 +++--- src/simpleanimation.h | 4 ++-- src/statuseffect.cpp | 2 +- src/units.cpp | 2 +- src/utils/xml.cpp | 12 ++++++------ src/utils/xml.h | 24 +++++++++++++----------- 37 files changed, 99 insertions(+), 97 deletions(-) (limited to 'src/gui/updaterwindow.cpp') diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp index c7ee1fa77..fd2de295a 100644 --- a/src/actorsprite.cpp +++ b/src/actorsprite.cpp @@ -164,7 +164,7 @@ static EffectDescription *default_effect = nullptr; static std::map effects; static bool effects_initialized = false; -static EffectDescription *getEffectDescription(xmlNodePtr node, int *id) +static EffectDescription *getEffectDescription(XmlNodePtr node, int *id) { EffectDescription *ed = new EffectDescription; @@ -180,7 +180,7 @@ static EffectDescription *getEffectDescription(int effectId) if (!effects_initialized) { XML::Document doc(EFFECTS_FILE); - xmlNodePtr root = doc.rootNode(); + XmlNodePtr root = doc.rootNode(); if (!root || !xmlStrEqual(root->name, BAD_CAST "being-effects")) { diff --git a/src/animationparticle.cpp b/src/animationparticle.cpp index 3d08554fa..c1bf251af 100644 --- a/src/animationparticle.cpp +++ b/src/animationparticle.cpp @@ -33,7 +33,7 @@ AnimationParticle::AnimationParticle(Map *map, Animation *animation): { } -AnimationParticle::AnimationParticle(Map *map, xmlNodePtr animationNode, +AnimationParticle::AnimationParticle(Map *map, XmlNodePtr animationNode, const std::string& dyePalettes): ImageParticle(map, nullptr), mAnimation(new SimpleAnimation(animationNode, dyePalettes)) diff --git a/src/animationparticle.h b/src/animationparticle.h index 27e7d0b22..933f2d164 100644 --- a/src/animationparticle.h +++ b/src/animationparticle.h @@ -36,7 +36,7 @@ class AnimationParticle : public ImageParticle public: AnimationParticle(Map *map, Animation *animation); - AnimationParticle(Map *map, xmlNodePtr animationNode, + AnimationParticle(Map *map, XmlNodePtr animationNode, const std::string& dyePalettes = std::string()); ~AnimationParticle(); diff --git a/src/configuration.cpp b/src/configuration.cpp index 40c3ab8c3..957fa1798 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -426,7 +426,7 @@ bool Configuration::resetBoolValue(const std::string &key) return defaultValue; } -void ConfigurationObject::initFromXML(xmlNodePtr parent_node) +void ConfigurationObject::initFromXML(XmlNodePtr parent_node) { clear(); @@ -489,7 +489,7 @@ void Configuration::init(const std::string &filename, bool useResManager) return; } - xmlNodePtr rootNode = doc.rootNode(); + XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "configuration")) { diff --git a/src/configuration.h b/src/configuration.h index 7e4c65a40..55e588964 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -193,7 +193,7 @@ class ConfigurationObject } protected: - virtual void initFromXML(xmlNodePtr node); + virtual void initFromXML(XmlNodePtr node); virtual void writeToXML(xmlTextWriterPtr writer); void deleteList(const std::string &name); diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp index 55bf692cd..b00687631 100644 --- a/src/effectmanager.cpp +++ b/src/effectmanager.cpp @@ -32,7 +32,7 @@ EffectManager::EffectManager() { XML::Document doc("effects.xml"); - xmlNodePtr root = doc.rootNode(); + XmlNodePtr root = doc.rootNode(); if (!root || !xmlStrEqual(root->name, BAD_CAST "being-effects")) { diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 483e2da94..4bfc477a0 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -355,7 +355,7 @@ void EquipmentWindow::resetBeing(Being *being) void EquipmentWindow::fillBoxes() { XML::Document *doc = new XML::Document("equipmentwindow.xml"); - xmlNodePtr root = doc->rootNode(); + XmlNodePtr root = doc->rootNode(); if (!root) { delete doc; @@ -381,13 +381,13 @@ void EquipmentWindow::fillBoxes() delete doc; } -void EquipmentWindow::loadWindow(xmlNodePtr windowNode) +void EquipmentWindow::loadWindow(XmlNodePtr windowNode) { setDefaultSize(XML::getProperty(windowNode, "width", 180), XML::getProperty(windowNode, "height", 345), ImageRect::CENTER); } -void EquipmentWindow::loadPlayerBox(xmlNodePtr playerBoxNode) +void EquipmentWindow::loadPlayerBox(XmlNodePtr playerBoxNode) { mPlayerBox->setDimension(gcn::Rectangle( XML::getProperty(playerBoxNode, "x", 50), @@ -396,7 +396,7 @@ void EquipmentWindow::loadPlayerBox(xmlNodePtr playerBoxNode) XML::getProperty(playerBoxNode, "height", 168))); } -void EquipmentWindow::loadSlot(xmlNodePtr slotNode, ImageSet *imageset) +void EquipmentWindow::loadSlot(XmlNodePtr slotNode, ImageSet *imageset) { int slot = parseSlotName(XML::getProperty(slotNode, "name", "")); if (slot < 0) diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h index b06333b2f..c8cf095f8 100644 --- a/src/gui/equipmentwindow.h +++ b/src/gui/equipmentwindow.h @@ -108,11 +108,11 @@ class EquipmentWindow : public Window, public gcn::ActionListener void addBox(int idx, int x, int y, int imageIndex); - void loadWindow(xmlNodePtr windowNode); + void loadWindow(XmlNodePtr windowNode); - void loadPlayerBox(xmlNodePtr playerBoxNode); + void loadPlayerBox(XmlNodePtr playerBoxNode); - void loadSlot(xmlNodePtr slotNode, ImageSet *imageset); + void loadSlot(XmlNodePtr slotNode, ImageSet *imageset); int parseSlotName(std::string name); diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 65421abd3..a4a477527 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -628,7 +628,7 @@ void ServerDialog::downloadServerList() void ServerDialog::loadServers(bool addNew) { XML::Document doc(mDir + "/serverlist.xml", false); - xmlNodePtr rootNode = doc.rootNode(); + XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "serverlist")) { diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 833a2bbe7..72f5a8ca1 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -362,7 +362,7 @@ void SkillDialog::loadSkills(const std::string &file) return; XML::Document doc(file); - xmlNodePtr root = doc.rootNode(); + XmlNodePtr root = doc.rootNode(); int setCount = 0; std::string setName; diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index ecc491191..2d3b0beea 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -315,7 +315,7 @@ Skin *Theme::readSkin(const std::string &filename) // filename = resman->mapPathToSkin(filename0); XML::Document doc(resolveThemePath(filename)); - xmlNodePtr rootNode = doc.rootNode(); + XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "skinset")) return nullptr; @@ -818,7 +818,7 @@ void Theme::loadColors(std::string file) file += "/colors.xml"; XML::Document doc(resolveThemePath(file)); - xmlNodePtr root = doc.rootNode(); + XmlNodePtr root = doc.rootNode(); if (!root || !xmlStrEqual(root->name, BAD_CAST "colors")) { diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index 4e641b5ca..5e8e51464 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -67,7 +67,7 @@ std::vector loadXMLFile(const std::string &fileName) { std::vector files; XML::Document doc(fileName, false); - xmlNodePtr rootNode = doc.rootNode(); + XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "updates")) { diff --git a/src/net/manaserv/attributes.cpp b/src/net/manaserv/attributes.cpp index be22e2822..01bd23273 100644 --- a/src/net/manaserv/attributes.cpp +++ b/src/net/manaserv/attributes.cpp @@ -238,7 +238,7 @@ namespace Attributes logger->log("Initializing attributes database..."); XML::Document doc(DEFAULT_ATTRIBUTESDB_FILE); - xmlNodePtr rootNode = doc.rootNode(); + XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "attributes")) { diff --git a/src/particle.cpp b/src/particle.cpp index bc92a21b5..aae780b7a 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -291,7 +291,7 @@ Particle *Particle::addEffect(const std::string &particleEffectFile, dyePalettes = particleEffectFile.substr(pos + 1); XML::Document doc(particleEffectFile.substr(0, pos)); - xmlNodePtr rootNode = doc.rootNode(); + XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "effect")) { @@ -309,7 +309,7 @@ Particle *Particle::addEffect(const std::string &particleEffectFile, continue; // Determine the exact particle type - xmlNodePtr node; + XmlNodePtr node; // Animation if ((node = XML::findFirstChildByName(effectChildNode, "animation"))) diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp index f1c81e9ab..40f06d671 100644 --- a/src/particleemitter.cpp +++ b/src/particleemitter.cpp @@ -39,7 +39,7 @@ #define SIN45 0.707106781f #define DEG_RAD_FACTOR 0.017453293f -ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, +ParticleEmitter::ParticleEmitter(XmlNodePtr emitterNode, Particle *target, Map *map, int rotation, const std::string& dyePalettes): mOutputPauseLeft(0), @@ -466,7 +466,7 @@ ParticleEmitter::~ParticleEmitter() template ParticleEmitterProp -ParticleEmitter::readParticleEmitterProp(xmlNodePtr propertyNode, T def) +ParticleEmitter::readParticleEmitterProp(XmlNodePtr propertyNode, T def) { ParticleEmitterProp retval; diff --git a/src/particleemitter.h b/src/particleemitter.h index 09e17767a..faa54dd12 100644 --- a/src/particleemitter.h +++ b/src/particleemitter.h @@ -43,7 +43,7 @@ class Particle; class ParticleEmitter { public: - ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *map, + ParticleEmitter(XmlNodePtr emitterNode, Particle *target, Map *map, int rotation = 0, const std::string& dyePalettes = std::string()); @@ -82,7 +82,7 @@ class ParticleEmitter private: template ParticleEmitterProp - readParticleEmitterProp(xmlNodePtr propertyNode, T def); + readParticleEmitterProp(XmlNodePtr propertyNode, T def); /** * initial position of particles: diff --git a/src/resources/chardb.cpp b/src/resources/chardb.cpp index 30408c239..4be2e2b04 100644 --- a/src/resources/chardb.cpp +++ b/src/resources/chardb.cpp @@ -44,7 +44,7 @@ void CharDB::load() unload(); XML::Document *doc = new XML::Document("charcreation.xml"); - xmlNodePtr root = doc->rootNode(); + XmlNodePtr root = doc->rootNode(); if (!root || !xmlStrEqual(root->name, BAD_CAST "chars")) { @@ -76,7 +76,7 @@ void CharDB::load() mLoaded = true; } -void CharDB::loadMinMax(xmlNodePtr node, unsigned *min, unsigned *max) +void CharDB::loadMinMax(XmlNodePtr node, unsigned *min, unsigned *max) { *min = XML::getProperty(node, "min", 1); *max = XML::getProperty(node, "max", 10); diff --git a/src/resources/chardb.h b/src/resources/chardb.h index c668c1a73..60ff31084 100644 --- a/src/resources/chardb.h +++ b/src/resources/chardb.h @@ -42,7 +42,7 @@ namespace CharDB */ void unload(); - void loadMinMax(xmlNodePtr node, unsigned *min, unsigned *max); + void loadMinMax(XmlNodePtr node, unsigned *min, unsigned *max); unsigned getMinHairColor(); diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp index 2a79f0554..cdbfbeba8 100644 --- a/src/resources/colordb.cpp +++ b/src/resources/colordb.cpp @@ -49,7 +49,7 @@ void ColorDB::load() void ColorDB::loadHair() { XML::Document *doc = new XML::Document("hair.xml"); - xmlNodePtr root = doc->rootNode(); + XmlNodePtr root = doc->rootNode(); bool hairXml = true; if (!root || !xmlStrEqual(root->name, BAD_CAST "colors")) @@ -97,7 +97,7 @@ void ColorDB::loadHair() void ColorDB::loadColorLists() { XML::Document *doc = new XML::Document("itemcolors.xml"); - xmlNodePtr root = doc->rootNode(); + XmlNodePtr root = doc->rootNode(); if (!root) { delete doc; diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp index c456c49e4..163d8b879 100644 --- a/src/resources/emotedb.cpp +++ b/src/resources/emotedb.cpp @@ -52,7 +52,7 @@ void EmoteDB::load() logger->log1("Initializing emote database..."); XML::Document doc("emotes.xml"); - xmlNodePtr rootNode = doc.rootNode(); + XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "emotes")) { diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index 2c381286a..fcc20613d 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -47,11 +47,11 @@ namespace } // Forward declarations -static void loadSpriteRef(ItemInfo *itemInfo, xmlNodePtr node); -static void loadSoundRef(ItemInfo *itemInfo, xmlNodePtr node); -static void loadFloorSprite(SpriteDisplay *display, xmlNodePtr node); -static void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode); -static void loadOrderSprite(ItemInfo *itemInfo, xmlNodePtr node, +static void loadSpriteRef(ItemInfo *itemInfo, XmlNodePtr node); +static void loadSoundRef(ItemInfo *itemInfo, XmlNodePtr node); +static void loadFloorSprite(SpriteDisplay *display, XmlNodePtr node); +static void loadReplaceSprite(ItemInfo *itemInfo, XmlNodePtr replaceNode); +static void loadOrderSprite(ItemInfo *itemInfo, XmlNodePtr node, bool drawAfter); static int parseSpriteName(std::string name); static int parseDirectionName(std::string name); @@ -172,7 +172,7 @@ void ItemDB::load() mUnknown->addTag(mTags["All"]); XML::Document doc("items.xml"); - xmlNodePtr rootNode = doc.rootNode(); + XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "items")) { @@ -593,7 +593,7 @@ int parseDirectionName(std::string name) return id; } -void loadSpriteRef(ItemInfo *itemInfo, xmlNodePtr node) +void loadSpriteRef(ItemInfo *itemInfo, XmlNodePtr node) { std::string gender = XML::getProperty(node, "gender", "unisex"); std::string filename = reinterpret_cast( @@ -605,7 +605,7 @@ void loadSpriteRef(ItemInfo *itemInfo, xmlNodePtr node) itemInfo->setSprite(filename, GENDER_FEMALE); } -void loadSoundRef(ItemInfo *itemInfo, xmlNodePtr node) +void loadSoundRef(ItemInfo *itemInfo, XmlNodePtr node) { std::string event = XML::getProperty(node, "event", ""); std::string filename = reinterpret_cast( @@ -626,7 +626,7 @@ void loadSoundRef(ItemInfo *itemInfo, xmlNodePtr node) } } -void loadFloorSprite(SpriteDisplay *display, xmlNodePtr floorNode) +void loadFloorSprite(SpriteDisplay *display, XmlNodePtr floorNode) { for_each_xml_child_node(spriteNode, floorNode) { @@ -648,7 +648,7 @@ void loadFloorSprite(SpriteDisplay *display, xmlNodePtr floorNode) } } -void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode) +void loadReplaceSprite(ItemInfo *itemInfo, XmlNodePtr replaceNode) { std::string removeSprite = XML::getProperty(replaceNode, "sprite", ""); int direction = parseDirectionName(XML::getProperty( @@ -766,7 +766,7 @@ void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode) } } -void loadOrderSprite(ItemInfo *itemInfo, xmlNodePtr node, bool drawAfter) +void loadOrderSprite(ItemInfo *itemInfo, XmlNodePtr node, bool drawAfter) { int sprite = parseSpriteName(XML::getProperty(node, "name", "")); int priority = XML::getProperty(node, "priority", 0); diff --git a/src/resources/mapdb.cpp b/src/resources/mapdb.cpp index 1da3dd908..aa10aff85 100644 --- a/src/resources/mapdb.cpp +++ b/src/resources/mapdb.cpp @@ -43,7 +43,7 @@ void MapDB::load() XML::Document *doc = new XML::Document( paths.getStringValue("maps") + "remap.xml"); - xmlNodePtr root = doc->rootNode(); + XmlNodePtr root = doc->rootNode(); if (!root) { delete doc; diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 8c8bf2f9d..aa7bce59d 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -222,7 +222,7 @@ Map *MapReader::readMap(const std::string &filename, XML::Document doc(reinterpret_cast(inflated), inflatedSize); free(inflated); - xmlNodePtr node = doc.rootNode(); + XmlNodePtr node = doc.rootNode(); // Parse the inflated map data if (node) @@ -247,7 +247,7 @@ Map *MapReader::readMap(const std::string &filename, return map; } -Map *MapReader::readMap(xmlNodePtr node, const std::string &path) +Map *MapReader::readMap(XmlNodePtr node, const std::string &path) { if (!node) return nullptr; @@ -379,7 +379,7 @@ Map *MapReader::readMap(xmlNodePtr node, const std::string &path) return map; } -void MapReader::readProperties(xmlNodePtr node, Properties *props) +void MapReader::readProperties(XmlNodePtr node, Properties *props) { if (!node || !props) return; @@ -442,7 +442,7 @@ inline static void setTile(Map *map, MapLayer *layer, int x, int y, int gid) } } -void MapReader::readLayer(xmlNodePtr node, Map *map) +void MapReader::readLayer(XmlNodePtr node, Map *map) { // Layers are not necessarily the same size as the map const int w = XML::getProperty(node, "width", map->getWidth()); @@ -491,7 +491,7 @@ void MapReader::readLayer(xmlNodePtr node, Map *map) } // Read base64 encoded map file - xmlNodePtr dataChild = childNode->xmlChildrenNode; + XmlNodePtr dataChild = childNode->xmlChildrenNode; if (!dataChild) continue; @@ -576,7 +576,7 @@ void MapReader::readLayer(xmlNodePtr node, Map *map) } else if (encoding == "csv") { - xmlNodePtr dataChild = childNode->xmlChildrenNode; + XmlNodePtr dataChild = childNode->xmlChildrenNode; if (!dataChild) continue; @@ -646,7 +646,7 @@ void MapReader::readLayer(xmlNodePtr node, Map *map) } -Tileset *MapReader::readTileset(xmlNodePtr node, const std::string &path, +Tileset *MapReader::readTileset(XmlNodePtr node, const std::string &path, Map *map) { if (!map) diff --git a/src/resources/mapreader.h b/src/resources/mapreader.h index 8fc11e70f..c9c742ecd 100644 --- a/src/resources/mapreader.h +++ b/src/resources/mapreader.h @@ -47,7 +47,7 @@ class MapReader * Read an XML map from a parsed XML tree. The path is used to find the * location of referenced tileset images. */ - static Map *readMap(xmlNodePtr node, const std::string &path); + static Map *readMap(XmlNodePtr node, const std::string &path); private: /** @@ -57,17 +57,17 @@ class MapReader * @param props The Properties instance to which the properties will * be assigned. */ - static void readProperties(xmlNodePtr node, Properties* props); + static void readProperties(XmlNodePtr node, Properties* props); /** * Reads a map layer and adds it to the given map. */ - static void readLayer(xmlNodePtr node, Map *map); + static void readLayer(XmlNodePtr node, Map *map); /** * Reads a tile set. */ - static Tileset *readTileset(xmlNodePtr node, const std::string &path, + static Tileset *readTileset(XmlNodePtr node, const std::string &path, Map *map); }; diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp index b994ea57f..e6901fa2f 100644 --- a/src/resources/monsterdb.cpp +++ b/src/resources/monsterdb.cpp @@ -52,7 +52,7 @@ void MonsterDB::load() logger->log1("Initializing monster database..."); XML::Document doc("monsters.xml"); - xmlNodePtr rootNode = doc.rootNode(); + XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "monsters")) { diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp index 71834e2bc..b823620f0 100644 --- a/src/resources/npcdb.cpp +++ b/src/resources/npcdb.cpp @@ -46,7 +46,7 @@ void NPCDB::load() logger->log1("Initializing NPC database..."); XML::Document doc("npcs.xml"); - xmlNodePtr rootNode = doc.rootNode(); + XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "npcs")) { diff --git a/src/resources/specialdb.cpp b/src/resources/specialdb.cpp index e771c3738..eb4a81c9a 100644 --- a/src/resources/specialdb.cpp +++ b/src/resources/specialdb.cpp @@ -55,7 +55,7 @@ void SpecialDB::load() logger->log("Initializing special database..."); XML::Document doc("specials.xml"); - xmlNodePtr root = doc.rootNode(); + XmlNodePtr root = doc.rootNode(); if (!root || !xmlStrEqual(root->name, BAD_CAST "specials")) { diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp index 40bdb64c8..7ff74ac18 100644 --- a/src/resources/spritedef.cpp +++ b/src/resources/spritedef.cpp @@ -81,7 +81,7 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, int variant) palettes = animationFile.substr(pos + 1); XML::Document doc(animationFile.substr(0, pos)); - xmlNodePtr rootNode = doc.rootNode(); + XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "sprite")) { @@ -134,7 +134,7 @@ void SpriteDef::substituteActions() substituteAction(SpriteAction::SPAWN, SpriteAction::STAND); } -void SpriteDef::loadSprite(xmlNodePtr spriteNode, int variant, +void SpriteDef::loadSprite(XmlNodePtr spriteNode, int variant, const std::string &palettes) { // Get the variant @@ -158,7 +158,7 @@ void SpriteDef::loadSprite(xmlNodePtr spriteNode, int variant, } } -void SpriteDef::loadImageSet(xmlNodePtr node, const std::string &palettes) +void SpriteDef::loadImageSet(XmlNodePtr node, const std::string &palettes) { const std::string name = XML::getProperty(node, "name", ""); @@ -186,7 +186,7 @@ void SpriteDef::loadImageSet(xmlNodePtr node, const std::string &palettes) mImageSets[name] = imageSet; } -void SpriteDef::loadAction(xmlNodePtr node, int variant_offset) +void SpriteDef::loadAction(XmlNodePtr node, int variant_offset) { const std::string actionName = XML::getProperty(node, "name", ""); const std::string imageSetName = XML::getProperty(node, "imageset", ""); @@ -228,7 +228,7 @@ void SpriteDef::loadAction(xmlNodePtr node, int variant_offset) } } -void SpriteDef::loadAnimation(xmlNodePtr animationNode, +void SpriteDef::loadAnimation(XmlNodePtr animationNode, Action *action, ImageSet *imageSet, int variant_offset) { @@ -346,7 +346,7 @@ void SpriteDef::loadAnimation(xmlNodePtr animationNode, } // for frameNode } -void SpriteDef::includeSprite(xmlNodePtr includeNode) +void SpriteDef::includeSprite(XmlNodePtr includeNode) { std::string filename = XML::getProperty(includeNode, "file", ""); @@ -363,7 +363,7 @@ void SpriteDef::includeSprite(xmlNodePtr includeNode) mProcessedFiles.insert(filename); XML::Document doc(filename); - xmlNodePtr rootNode = doc.rootNode(); + XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "sprite")) { diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h index 3f656be0d..0490bdcb3 100644 --- a/src/resources/spritedef.h +++ b/src/resources/spritedef.h @@ -145,30 +145,30 @@ class SpriteDef : public Resource /** * Loads a sprite element. */ - void loadSprite(xmlNodePtr spriteNode, int variant, + void loadSprite(XmlNodePtr spriteNode, int variant, const std::string &palettes = ""); /** * Loads an imageset element. */ - void loadImageSet(xmlNodePtr node, const std::string &palettes); + void loadImageSet(XmlNodePtr node, const std::string &palettes); /** * Loads an action element. */ - void loadAction(xmlNodePtr node, int variant_offset); + void loadAction(XmlNodePtr node, int variant_offset); /** * Loads an animation element. */ - void loadAnimation(xmlNodePtr animationNode, + void loadAnimation(XmlNodePtr animationNode, Action *action, ImageSet *imageSet, int variant_offset); /** * Include another sprite into this one. */ - void includeSprite(xmlNodePtr includeNode); + void includeSprite(XmlNodePtr includeNode); /** * Complete missing actions by copying existing ones. diff --git a/src/rotationalparticle.cpp b/src/rotationalparticle.cpp index f9c493eb1..e1a7fd035 100644 --- a/src/rotationalparticle.cpp +++ b/src/rotationalparticle.cpp @@ -34,7 +34,7 @@ RotationalParticle::RotationalParticle(Map *map, Animation *animation): { } -RotationalParticle::RotationalParticle(Map *map, xmlNodePtr animationNode, +RotationalParticle::RotationalParticle(Map *map, XmlNodePtr animationNode, const std::string& dyePalettes): ImageParticle(map, 0), mAnimation(new SimpleAnimation(animationNode, dyePalettes)) diff --git a/src/rotationalparticle.h b/src/rotationalparticle.h index 96b7a29ff..251e3769c 100644 --- a/src/rotationalparticle.h +++ b/src/rotationalparticle.h @@ -36,7 +36,7 @@ class RotationalParticle : public ImageParticle public: RotationalParticle(Map *map, Animation *animation); - RotationalParticle(Map *map, xmlNodePtr animationNode, + RotationalParticle(Map *map, XmlNodePtr animationNode, const std::string& dyePalettes = std::string()); ~RotationalParticle(); diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp index 5de9813fd..f0002b47e 100644 --- a/src/simpleanimation.cpp +++ b/src/simpleanimation.cpp @@ -44,7 +44,7 @@ SimpleAnimation::SimpleAnimation(Animation *animation): { } -SimpleAnimation::SimpleAnimation(xmlNodePtr animationNode, +SimpleAnimation::SimpleAnimation(XmlNodePtr animationNode, const std::string& dyePalettes): mAnimation(new Animation), mAnimationTime(0), @@ -136,7 +136,7 @@ Image *SimpleAnimation::getCurrentImage() const return nullptr; } -void SimpleAnimation::initializeAnimation(xmlNodePtr animationNode, +void SimpleAnimation::initializeAnimation(XmlNodePtr animationNode, const std::string& dyePalettes) { mInitialized = false; @@ -161,7 +161,7 @@ void SimpleAnimation::initializeAnimation(xmlNodePtr animationNode, return; // Get animation frames - for (xmlNodePtr frameNode = animationNode->xmlChildrenNode; + for (XmlNodePtr frameNode = animationNode->xmlChildrenNode; frameNode; frameNode = frameNode->next) { int delay = XML::getProperty(frameNode, "delay", 0); diff --git a/src/simpleanimation.h b/src/simpleanimation.h index eda8d1fc0..de1203662 100644 --- a/src/simpleanimation.h +++ b/src/simpleanimation.h @@ -47,7 +47,7 @@ class SimpleAnimation /** * Creates a simple animation that creates its animation from XML Data. */ - SimpleAnimation(xmlNodePtr animationNode, + SimpleAnimation(XmlNodePtr animationNode, const std::string& dyePalettes = std::string()); ~SimpleAnimation(); @@ -68,7 +68,7 @@ class SimpleAnimation Image *getCurrentImage() const; private: - void initializeAnimation(xmlNodePtr animationNode, const std::string& + void initializeAnimation(XmlNodePtr animationNode, const std::string& dyePalettes = std::string()); /** The hosted animation. */ diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index 5a33df561..3de30e3cf 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -130,7 +130,7 @@ void StatusEffect::load() unload(); XML::Document doc(STATUS_EFFECTS_FILE); - xmlNodePtr rootNode = doc.rootNode(); + XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "status-effects")) { diff --git a/src/units.cpp b/src/units.cpp index 82d3920f7..c031558cf 100644 --- a/src/units.cpp +++ b/src/units.cpp @@ -100,7 +100,7 @@ void Units::loadUnits() } XML::Document doc("units.xml"); - xmlNodePtr root = doc.rootNode(); + XmlNodePtr root = doc.rootNode(); if (!root || !xmlStrEqual(root->name, BAD_CAST "units")) { diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index 5a9558cc2..d1df63510 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -101,12 +101,12 @@ namespace XML xmlFreeDoc(mDoc); } - xmlNodePtr Document::rootNode() + XmlNodePtr Document::rootNode() { return mDoc ? xmlDocGetRootElement(mDoc) : nullptr; } - int getProperty(xmlNodePtr node, const char* name, int def) + int getProperty(XmlNodePtr node, const char* name, int def) { int &ret = def; @@ -120,7 +120,7 @@ namespace XML return ret; } - double getFloatProperty(xmlNodePtr node, const char* name, double def) + double getFloatProperty(XmlNodePtr node, const char* name, double def) { double &ret = def; @@ -134,7 +134,7 @@ namespace XML return ret; } - std::string getProperty(xmlNodePtr node, const char *name, + std::string getProperty(XmlNodePtr node, const char *name, const std::string &def) { xmlChar *prop = xmlGetProp(node, BAD_CAST name); @@ -148,7 +148,7 @@ namespace XML return def; } - bool getBoolProperty(xmlNodePtr node, const char* name, bool def) + bool getBoolProperty(XmlNodePtr node, const char* name, bool def) { xmlChar *prop = xmlGetProp(node, BAD_CAST name); @@ -159,7 +159,7 @@ namespace XML return def; } - xmlNodePtr findFirstChildByName(xmlNodePtr parent, const char *name) + XmlNodePtr findFirstChildByName(XmlNodePtr parent, const char *name) { for_each_xml_child_node(child, parent) { diff --git a/src/utils/xml.h b/src/utils/xml.h index 2b97b45f5..849bc2060 100644 --- a/src/utils/xml.h +++ b/src/utils/xml.h @@ -29,6 +29,8 @@ #include +#define XmlNodePtr xmlNodePtr + /** * XML helper functions. */ @@ -65,42 +67,42 @@ namespace XML * Returns the root node of the document (or NULL if there was a * load error). */ - xmlNodePtr rootNode(); + XmlNodePtr rootNode(); private: xmlDocPtr mDoc; }; /** - * Gets an floating point property from an xmlNodePtr. + * Gets an floating point property from an XmlNodePtr. */ - double getFloatProperty(xmlNodePtr node, const char *name, double def); + double getFloatProperty(XmlNodePtr node, const char *name, double def); /** - * Gets an integer property from an xmlNodePtr. + * Gets an integer property from an XmlNodePtr. */ - int getProperty(xmlNodePtr node, const char *name, int def); + int getProperty(XmlNodePtr node, const char *name, int def); /** - * Gets a string property from an xmlNodePtr. + * Gets a string property from an XmlNodePtr. */ - std::string getProperty(xmlNodePtr node, const char *name, + std::string getProperty(XmlNodePtr node, const char *name, const std::string &def); /** - * Gets a boolean property from an xmlNodePtr. + * Gets a boolean property from an XmlNodePtr. */ - bool getBoolProperty(xmlNodePtr node, const char *name, bool def); + bool getBoolProperty(XmlNodePtr node, const char *name, bool def); /** * Finds the first child node with the given name */ - xmlNodePtr findFirstChildByName(xmlNodePtr parent, const char *name); + XmlNodePtr findFirstChildByName(XmlNodePtr parent, const char *name); void initXML(); } #define for_each_xml_child_node(var, parent) \ - for (xmlNodePtr var = parent->xmlChildrenNode; var; var = var->next) + for (XmlNodePtr var = parent->xmlChildrenNode; var; var = var->next) #endif // XML_H -- cgit v1.2.3-70-g09d2 From 5edddb1313ed0dc275e6ae70b8a1780ded3a590d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 10 Jan 2012 21:06:33 +0300 Subject: Replace xmlStrEqual to xmlNameEqual. --- src/actorsprite.cpp | 6 +++--- src/configuration.cpp | 8 ++++---- src/effectmanager.cpp | 4 ++-- src/gui/equipmentwindow.cpp | 6 +++--- src/gui/serverdialog.cpp | 8 ++++---- src/gui/skilldialog.cpp | 6 +++--- src/gui/theme.cpp | 14 +++++++------- src/gui/updaterwindow.cpp | 4 ++-- src/net/manaserv/attributes.cpp | 8 ++++---- src/particle.cpp | 8 ++++---- src/particleemitter.cpp | 22 +++++++++++----------- src/resources/chardb.cpp | 8 ++++---- src/resources/colordb.cpp | 10 +++++----- src/resources/emotedb.cpp | 16 ++++++++-------- src/resources/itemdb.cpp | 28 ++++++++++++++-------------- src/resources/mapdb.cpp | 2 +- src/resources/mapreader.cpp | 26 +++++++++++++------------- src/resources/monsterdb.cpp | 12 ++++++------ src/resources/npcdb.cpp | 8 ++++---- src/resources/specialdb.cpp | 6 +++--- src/resources/spritedef.cpp | 24 ++++++++++++------------ src/simpleanimation.cpp | 6 +++--- src/statuseffect.cpp | 8 +++++--- src/units.cpp | 6 +++--- src/utils/xml.cpp | 2 +- src/utils/xml.h | 2 ++ 26 files changed, 131 insertions(+), 127 deletions(-) (limited to 'src/gui/updaterwindow.cpp') diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp index fd2de295a..c1c139bb9 100644 --- a/src/actorsprite.cpp +++ b/src/actorsprite.cpp @@ -182,7 +182,7 @@ static EffectDescription *getEffectDescription(int effectId) XML::Document doc(EFFECTS_FILE); XmlNodePtr root = doc.rootNode(); - if (!root || !xmlStrEqual(root->name, BAD_CAST "being-effects")) + if (!root || !xmlNameEqual(root, "being-effects")) { logger->log1("Error loading being effects file: " EFFECTS_FILE); @@ -193,13 +193,13 @@ static EffectDescription *getEffectDescription(int effectId) { int id; - if (xmlStrEqual(node->name, BAD_CAST "effect")) + if (xmlNameEqual(node, "effect")) { EffectDescription *EffectDescription = getEffectDescription(node, &id); effects[id] = EffectDescription; } - else if (xmlStrEqual(node->name, BAD_CAST "default")) + else if (xmlNameEqual(node, "default")) { EffectDescription *effectDescription = getEffectDescription(node, &id); diff --git a/src/configuration.cpp b/src/configuration.cpp index 957fa1798..b3d5d77d0 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -432,7 +432,7 @@ void ConfigurationObject::initFromXML(XmlNodePtr parent_node) for_each_xml_child_node(node, parent_node) { - if (xmlStrEqual(node->name, BAD_CAST "list")) + if (xmlNameEqual(node, "list")) { // list option handling @@ -440,7 +440,7 @@ void ConfigurationObject::initFromXML(XmlNodePtr parent_node) for_each_xml_child_node(subnode, node) { - if (xmlStrEqual(subnode->name, BAD_CAST name.c_str()) + if (xmlNameEqual(subnode, name.c_str()) && subnode->type == XML_ELEMENT_NODE) { ConfigurationObject *cobj = new ConfigurationObject; @@ -452,7 +452,7 @@ void ConfigurationObject::initFromXML(XmlNodePtr parent_node) } } - else if (xmlStrEqual(node->name, BAD_CAST "option")) + else if (xmlNameEqual(node, "option")) { // single option handling @@ -491,7 +491,7 @@ void Configuration::init(const std::string &filename, bool useResManager) XmlNodePtr rootNode = doc.rootNode(); - if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "configuration")) + if (!rootNode || !xmlNameEqual(rootNode, "configuration")) { logger->log("Warning: No configuration file (%s)", filename.c_str()); return; diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp index b00687631..de12ecaa5 100644 --- a/src/effectmanager.cpp +++ b/src/effectmanager.cpp @@ -34,7 +34,7 @@ EffectManager::EffectManager() XML::Document doc("effects.xml"); XmlNodePtr root = doc.rootNode(); - if (!root || !xmlStrEqual(root->name, BAD_CAST "being-effects")) + if (!root || !xmlNameEqual(root, "being-effects")) { logger->log1("Error loading being effects file: effects.xml"); return; @@ -46,7 +46,7 @@ EffectManager::EffectManager() for_each_xml_child_node(node, root) { - if (xmlStrEqual(node->name, BAD_CAST "effect")) + if (xmlNameEqual(node, "effect")) { EffectDescription ed; ed.id = XML::getProperty(node, "id", -1); diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 4bfc477a0..0dadca2dc 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -371,11 +371,11 @@ void EquipmentWindow::fillBoxes() for_each_xml_child_node(node, root) { - if (xmlStrEqual(node->name, BAD_CAST "window")) + if (xmlNameEqual(node, "window")) loadWindow(node); - else if (xmlStrEqual(node->name, BAD_CAST "playerbox")) + else if (xmlNameEqual(node, "playerbox")) loadPlayerBox(node); - else if (xmlStrEqual(node->name, BAD_CAST "slot")) + else if (xmlNameEqual(node, "slot")) loadSlot(node, mImageSet); } delete doc; diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index a4a477527..85b3bbf4e 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -630,7 +630,7 @@ void ServerDialog::loadServers(bool addNew) XML::Document doc(mDir + "/serverlist.xml", false); XmlNodePtr rootNode = doc.rootNode(); - if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "serverlist")) + if (!rootNode || !xmlNameEqual(rootNode, "serverlist")) { logger->log1("Error loading server list!"); return; @@ -646,7 +646,7 @@ void ServerDialog::loadServers(bool addNew) for_each_xml_child_node(serverNode, rootNode) { - if (!xmlStrEqual(serverNode->name, BAD_CAST "server")) + if (!xmlNameEqual(serverNode, "server")) continue; ServerInfo server; @@ -681,7 +681,7 @@ void ServerDialog::loadServers(bool addNew) for_each_xml_child_node(subNode, serverNode) { - if (xmlStrEqual(subNode->name, BAD_CAST "connection")) + if (xmlNameEqual(subNode, "connection")) { server.hostname = XML::getProperty(subNode, "hostname", ""); server.port = static_cast( @@ -693,7 +693,7 @@ void ServerDialog::loadServers(bool addNew) server.port = defaultPortForServerType(server.type); } } - else if (xmlStrEqual(subNode->name, BAD_CAST "description")) + else if (xmlNameEqual(subNode, "description")) { server.description = reinterpret_cast( subNode->xmlChildrenNode->content); diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 72f5a8ca1..4ee674325 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -370,7 +370,7 @@ void SkillDialog::loadSkills(const std::string &file) SkillListBox *listbox; SkillTab *tab; - if (!root || !xmlStrEqual(root->name, BAD_CAST "skills")) + if (!root || !xmlNameEqual(root, "skills")) { logger->log("Error loading skills file: %s", file.c_str()); @@ -413,7 +413,7 @@ void SkillDialog::loadSkills(const std::string &file) for_each_xml_child_node(set, root) { - if (xmlStrEqual(set->name, BAD_CAST "set")) + if (xmlNameEqual(set, "set")) { setCount++; setName = XML::getProperty(set, "name", @@ -425,7 +425,7 @@ void SkillDialog::loadSkills(const std::string &file) for_each_xml_child_node(node, set) { - if (xmlStrEqual(node->name, BAD_CAST "skill")) + if (xmlNameEqual(node, "skill")) { int id = atoi(XML::getProperty(node, "id", "-1").c_str()); std::string name = XML::getProperty(node, "name", diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 2d3b0beea..85fd215ac 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -317,7 +317,7 @@ Skin *Theme::readSkin(const std::string &filename) XML::Document doc(resolveThemePath(filename)); XmlNodePtr rootNode = doc.rootNode(); - if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "skinset")) + if (!rootNode || !xmlNameEqual(rootNode, "skinset")) return nullptr; const std::string skinSetImage = XML::getProperty(rootNode, "image", ""); @@ -339,7 +339,7 @@ Skin *Theme::readSkin(const std::string &filename) // iterate 's for_each_xml_child_node(widgetNode, rootNode) { - if (!xmlStrEqual(widgetNode->name, BAD_CAST "widget")) + if (!xmlNameEqual(widgetNode, "widget")) continue; const std::string widgetType = @@ -348,7 +348,7 @@ Skin *Theme::readSkin(const std::string &filename) { for_each_xml_child_node(partNode, widgetNode) { - if (xmlStrEqual(partNode->name, BAD_CAST "part")) + if (xmlNameEqual(partNode, "part")) { const std::string partType = XML::getProperty(partNode, "type", "unknown"); @@ -477,7 +477,7 @@ Skin *Theme::readSkin(const std::string &filename) "'%s'", partType.c_str()); } } - else if (xmlStrEqual(partNode->name, BAD_CAST "option")) + else if (xmlNameEqual(partNode, "option")) { const std::string name = XML::getProperty( partNode, "name", ""); @@ -820,7 +820,7 @@ void Theme::loadColors(std::string file) XML::Document doc(resolveThemePath(file)); XmlNodePtr root = doc.rootNode(); - if (!root || !xmlStrEqual(root->name, BAD_CAST "colors")) + if (!root || !xmlNameEqual(root, "colors")) { logger->log("Error loading colors file: %s", file.c_str()); return; @@ -835,7 +835,7 @@ void Theme::loadColors(std::string file) for_each_xml_child_node(node, root) { - if (xmlStrEqual(node->name, BAD_CAST "color")) + if (xmlNameEqual(node, "color")) { type = readColorType(XML::getProperty(node, "id", "")); if (type < 0) // invalid or no type given @@ -850,7 +850,7 @@ void Theme::loadColors(std::string file) mColors[type].set(type, color, grad, 10); } - else if (xmlStrEqual(node->name, BAD_CAST "progressbar")) + else if (xmlNameEqual(node, "progressbar")) { type = readProgressType(XML::getProperty(node, "id", "")); if (type < 0) // invalid or no type given diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index 5e8e51464..39dde65c3 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -69,7 +69,7 @@ std::vector loadXMLFile(const std::string &fileName) XML::Document doc(fileName, false); XmlNodePtr rootNode = doc.rootNode(); - if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "updates")) + if (!rootNode || !xmlNameEqual(rootNode, "updates")) { logger->log("Error loading update file: %s", fileName.c_str()); return files; @@ -78,7 +78,7 @@ std::vector loadXMLFile(const std::string &fileName) for_each_xml_child_node(fileNode, rootNode) { // Ignore all tags except for the "update" tags - if (!xmlStrEqual(fileNode->name, BAD_CAST "update")) + if (!xmlNameEqual(fileNode, "update")) continue; updateFile file; diff --git a/src/net/manaserv/attributes.cpp b/src/net/manaserv/attributes.cpp index 01bd23273..662032e29 100644 --- a/src/net/manaserv/attributes.cpp +++ b/src/net/manaserv/attributes.cpp @@ -240,7 +240,7 @@ namespace Attributes XML::Document doc(DEFAULT_ATTRIBUTESDB_FILE); XmlNodePtr rootNode = doc.rootNode(); - if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "attributes")) + if (!rootNode || !xmlNameEqual(rootNode, "attributes")) { logger->log("Attributes: Error while loading " DEFAULT_ATTRIBUTESDB_FILE ". Using Built-ins."); @@ -251,7 +251,7 @@ namespace Attributes for_each_xml_child_node(node, rootNode) { - if (xmlStrEqual(node->name, BAD_CAST "attribute")) + if (xmlNameEqual(node, "attribute")) { int id = XML::getProperty(node, "id", 0); @@ -290,7 +290,7 @@ namespace Attributes unsigned int count = 0; for_each_xml_child_node(effectNode, node) { - if (!xmlStrEqual(effectNode->name, BAD_CAST "modifier")) + if (!xmlNameEqual(effectNode, "modifier")) continue; ++count; std::string tag = XML::getProperty(effectNode, "tag", ""); @@ -334,7 +334,7 @@ namespace Attributes logger->log("Found %d tags for attribute %d.", count, id); }// End attribute - else if (xmlStrEqual(node->name, BAD_CAST "points")) + else if (xmlNameEqual(node, "points")) { creationPoints = XML::getProperty( node, "start", DEFAULT_POINTS); diff --git a/src/particle.cpp b/src/particle.cpp index aae780b7a..a0acb4f73 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -293,7 +293,7 @@ Particle *Particle::addEffect(const std::string &particleEffectFile, XML::Document doc(particleEffectFile.substr(0, pos)); XmlNodePtr rootNode = doc.rootNode(); - if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "effect")) + if (!rootNode || !xmlNameEqual(rootNode, "effect")) { logger->log("Error loading particle: %s", particleEffectFile.c_str()); return nullptr; @@ -305,7 +305,7 @@ Particle *Particle::addEffect(const std::string &particleEffectFile, for_each_xml_child_node(effectChildNode, rootNode) { // We're only interested in particles - if (!xmlStrEqual(effectChildNode->name, BAD_CAST "particle")) + if (!xmlNameEqual(effectChildNode, "particle")) continue; // Determine the exact particle type @@ -361,14 +361,14 @@ Particle *Particle::addEffect(const std::string &particleEffectFile, // Look for additional emitters for this particle for_each_xml_child_node(emitterNode, effectChildNode) { - if (xmlStrEqual(emitterNode->name, BAD_CAST "emitter")) + if (xmlNameEqual(emitterNode, "emitter")) { ParticleEmitter *newEmitter; newEmitter = new ParticleEmitter(emitterNode, newParticle, mMap, rotation, dyePalettes); newParticle->addEmitter(newEmitter); } - else if (xmlStrEqual(emitterNode->name, BAD_CAST "deatheffect")) + else if (xmlNameEqual(emitterNode, "deatheffect")) { std::string deathEffect = reinterpret_cast( emitterNode->xmlChildrenNode->content); diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp index 40f06d671..62f6767c6 100644 --- a/src/particleemitter.cpp +++ b/src/particleemitter.cpp @@ -71,7 +71,7 @@ ParticleEmitter::ParticleEmitter(XmlNodePtr emitterNode, Particle *target, for_each_xml_child_node(propertyNode, emitterNode) { - if (xmlStrEqual(propertyNode->name, BAD_CAST "property")) + if (xmlNameEqual(propertyNode, "property")) { std::string name = XML::getProperty(propertyNode, "name", ""); @@ -197,13 +197,13 @@ ParticleEmitter::ParticleEmitter(XmlNodePtr emitterNode, Particle *target, name.c_str()); } } - else if (xmlStrEqual(propertyNode->name, BAD_CAST "emitter")) + else if (xmlNameEqual(propertyNode, "emitter")) { ParticleEmitter newEmitter(propertyNode, mParticleTarget, map, rotation, dyePalettes); mParticleChildEmitters.push_back(newEmitter); } - else if (xmlStrEqual(propertyNode->name, BAD_CAST "rotation")) + else if (xmlNameEqual(propertyNode, "rotation")) { ImageSet *imageset = ResourceManager::getInstance()->getImageSet( XML::getProperty(propertyNode, "imageset", ""), @@ -229,7 +229,7 @@ ParticleEmitter::ParticleEmitter(XmlNodePtr emitterNode, Particle *target, offsetY -= imageset->getHeight() - 32; offsetX -= imageset->getWidth() / 2 - 16; - if (xmlStrEqual(frameNode->name, BAD_CAST "frame")) + if (xmlNameEqual(frameNode, "frame")) { int index = XML::getProperty(frameNode, "index", -1); @@ -250,7 +250,7 @@ ParticleEmitter::ParticleEmitter(XmlNodePtr emitterNode, Particle *target, mParticleRotation.addFrame(img, delay, offsetX, offsetY, rand); } - else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence")) + else if (xmlNameEqual(frameNode, "sequence")) { int start = XML::getProperty(frameNode, "start", -1); int end = XML::getProperty(frameNode, "end", -1); @@ -276,13 +276,13 @@ ParticleEmitter::ParticleEmitter(XmlNodePtr emitterNode, Particle *target, start++; } } - else if (xmlStrEqual(frameNode->name, BAD_CAST "end")) + else if (xmlNameEqual(frameNode, "end")) { mParticleRotation.addTerminator(rand); } } // for frameNode } - else if (xmlStrEqual(propertyNode->name, BAD_CAST "animation")) + else if (xmlNameEqual(propertyNode, "animation")) { ImageSet *imageset = ResourceManager::getInstance()->getImageSet( XML::getProperty(propertyNode, "imageset", ""), @@ -307,7 +307,7 @@ ParticleEmitter::ParticleEmitter(XmlNodePtr emitterNode, Particle *target, offsetY -= imageset->getHeight() - 32; offsetX -= imageset->getWidth() / 2 - 16; - if (xmlStrEqual(frameNode->name, BAD_CAST "frame")) + if (xmlNameEqual(frameNode, "frame")) { int index = XML::getProperty(frameNode, "index", -1); @@ -328,7 +328,7 @@ ParticleEmitter::ParticleEmitter(XmlNodePtr emitterNode, Particle *target, mParticleAnimation.addFrame(img, delay, offsetX, offsetY, rand); } - else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence")) + else if (xmlNameEqual(frameNode, "sequence")) { int start = XML::getProperty(frameNode, "start", -1); int end = XML::getProperty(frameNode, "end", -1); @@ -354,13 +354,13 @@ ParticleEmitter::ParticleEmitter(XmlNodePtr emitterNode, Particle *target, start++; } } - else if (xmlStrEqual(frameNode->name, BAD_CAST "end")) + else if (xmlNameEqual(frameNode, "end")) { mParticleAnimation.addTerminator(rand); } } // for frameNode } - else if (xmlStrEqual(propertyNode->name, BAD_CAST "deatheffect")) + else if (xmlNameEqual(propertyNode, "deatheffect")) { mDeathEffect = reinterpret_cast( propertyNode->xmlChildrenNode->content); diff --git a/src/resources/chardb.cpp b/src/resources/chardb.cpp index 4be2e2b04..f38f13224 100644 --- a/src/resources/chardb.cpp +++ b/src/resources/chardb.cpp @@ -46,7 +46,7 @@ void CharDB::load() XML::Document *doc = new XML::Document("charcreation.xml"); XmlNodePtr root = doc->rootNode(); - if (!root || !xmlStrEqual(root->name, BAD_CAST "chars")) + if (!root || !xmlNameEqual(root, "chars")) { logger->log1("CharDB: Failed to parse charcreation.xml."); @@ -56,15 +56,15 @@ void CharDB::load() for_each_xml_child_node(node, root) { - if (xmlStrEqual(node->name, BAD_CAST "haircolor")) + if (xmlNameEqual(node, "haircolor")) { loadMinMax(node, &mMinHairColor, &mMaxHairColor); } - else if (xmlStrEqual(node->name, BAD_CAST "hairstyle")) + else if (xmlNameEqual(node, "hairstyle")) { loadMinMax(node, &mMinHairStyle, &mMaxHairStyle); } - else if (xmlStrEqual(node->name, BAD_CAST "stat")) + else if (xmlNameEqual(node, "stat")) { loadMinMax(node, &mMinStat, &mMaxStat); mSumStat = XML::getProperty(node, "sum", 0); diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp index cdbfbeba8..1ffe507b2 100644 --- a/src/resources/colordb.cpp +++ b/src/resources/colordb.cpp @@ -52,7 +52,7 @@ void ColorDB::loadHair() XmlNodePtr root = doc->rootNode(); bool hairXml = true; - if (!root || !xmlStrEqual(root->name, BAD_CAST "colors")) + if (!root || !xmlNameEqual(root, "colors")) { logger->log1("Trying to fall back on colors.xml"); @@ -62,7 +62,7 @@ void ColorDB::loadHair() doc = new XML::Document("colors.xml"); root = doc->rootNode(); - if (!root || !xmlStrEqual(root->name, BAD_CAST "colors")) + if (!root || !xmlNameEqual(root, "colors")) { logger->log1("ColorDB: Failed to find any color files."); mHairColors[0] = mFail; @@ -76,7 +76,7 @@ void ColorDB::loadHair() for_each_xml_child_node(node, root) { - if (xmlStrEqual(node->name, BAD_CAST "color")) + if (xmlNameEqual(node, "color")) { int id = XML::getProperty(node, "id", 0); @@ -106,7 +106,7 @@ void ColorDB::loadColorLists() for_each_xml_child_node(node, root) { - if (xmlStrEqual(node->name, BAD_CAST "list")) + if (xmlNameEqual(node, "list")) { std::string name = XML::getProperty(node, "name", ""); if (name.empty()) @@ -120,7 +120,7 @@ void ColorDB::loadColorLists() for_each_xml_child_node(colorNode, node) { - if (xmlStrEqual(colorNode->name, BAD_CAST "color")) + if (xmlNameEqual(colorNode, "color")) { ItemColor c(XML::getProperty(colorNode, "id", -1), XML::getProperty(colorNode, "name", ""), diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp index 163d8b879..c6126a57b 100644 --- a/src/resources/emotedb.cpp +++ b/src/resources/emotedb.cpp @@ -54,7 +54,7 @@ void EmoteDB::load() XML::Document doc("emotes.xml"); XmlNodePtr rootNode = doc.rootNode(); - if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "emotes")) + if (!rootNode || !xmlNameEqual(rootNode, "emotes")) { logger->log1("Emote Database: Error while loading emotes.xml!"); return; @@ -63,7 +63,7 @@ void EmoteDB::load() //iterate s for_each_xml_child_node(emoteNode, rootNode) { - if (!xmlStrEqual(emoteNode->name, BAD_CAST "emote")) + if (!xmlNameEqual(emoteNode, "emote")) continue; int id = XML::getProperty(emoteNode, "id", -1); @@ -81,7 +81,7 @@ void EmoteDB::load() if (!spriteNode->xmlChildrenNode) continue; - if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite")) + if (xmlNameEqual(spriteNode, "sprite")) { EmoteSprite *currentSprite = new EmoteSprite; std::string file = paths.getStringValue("sprites") @@ -92,7 +92,7 @@ void EmoteDB::load() currentSprite->name = XML::getProperty(spriteNode, "name", ""); currentInfo->sprites.push_back(currentSprite); } - else if (xmlStrEqual(spriteNode->name, BAD_CAST "particlefx")) + else if (xmlNameEqual(spriteNode, "particlefx")) { std::string particlefx = reinterpret_cast( spriteNode->xmlChildrenNode->content); @@ -108,7 +108,7 @@ void EmoteDB::load() XML::Document doc2("graphics/sprites/manaplus_emotes.xml"); rootNode = doc2.rootNode(); - if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "emotes")) + if (!rootNode || !xmlNameEqual(rootNode, "emotes")) { logger->log1("Emote Database: Error while loading" " manaplus_emotes.xml!"); @@ -118,7 +118,7 @@ void EmoteDB::load() //iterate s for_each_xml_child_node(emoteNode, rootNode) { - if (!xmlStrEqual(emoteNode->name, BAD_CAST "emote")) + if (!xmlNameEqual(emoteNode, "emote")) continue; int id = XML::getProperty(emoteNode, "id", -1); @@ -136,7 +136,7 @@ void EmoteDB::load() if (!spriteNode->xmlChildrenNode) continue; - if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite")) + if (xmlNameEqual(spriteNode, "sprite")) { EmoteSprite *currentSprite = new EmoteSprite; std::string file = paths.getStringValue("sprites") @@ -147,7 +147,7 @@ void EmoteDB::load() currentSprite->name = XML::getProperty(spriteNode, "name", ""); currentInfo->sprites.push_back(currentSprite); } - else if (xmlStrEqual(spriteNode->name, BAD_CAST "particlefx")) + else if (xmlNameEqual(spriteNode, "particlefx")) { std::string particlefx = reinterpret_cast( spriteNode->xmlChildrenNode->content); diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index fcc20613d..5fa68a88f 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -174,7 +174,7 @@ void ItemDB::load() XML::Document doc("items.xml"); XmlNodePtr rootNode = doc.rootNode(); - if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "items")) + if (!rootNode || !xmlNameEqual(rootNode, "items")) { logger->log("ItemDB: Error while loading items.xml!"); mLoaded = true; @@ -183,7 +183,7 @@ void ItemDB::load() for_each_xml_child_node(node, rootNode) { - if (!xmlStrEqual(node->name, BAD_CAST "item")) + if (!xmlNameEqual(node, "item")) continue; int id = XML::getProperty(node, "id", 0); @@ -324,7 +324,7 @@ void ItemDB::load() for_each_xml_child_node(itemChild, node) { - if (xmlStrEqual(itemChild->name, BAD_CAST "sprite")) + if (xmlNameEqual(itemChild, "sprite")) { std::string attackParticle = XML::getProperty( itemChild, "particle-effect", ""); @@ -332,23 +332,23 @@ void ItemDB::load() loadSpriteRef(itemInfo, itemChild); } - else if (xmlStrEqual(itemChild->name, BAD_CAST "sound")) + else if (xmlNameEqual(itemChild, "sound")) { loadSoundRef(itemInfo, itemChild); } - else if (xmlStrEqual(itemChild->name, BAD_CAST "floor")) + else if (xmlNameEqual(itemChild, "floor")) { loadFloorSprite(&display, itemChild); } - else if (xmlStrEqual(itemChild->name, BAD_CAST "replace")) + else if (xmlNameEqual(itemChild, "replace")) { loadReplaceSprite(itemInfo, itemChild); } - else if (xmlStrEqual(itemChild->name, BAD_CAST "drawAfter")) + else if (xmlNameEqual(itemChild, "drawAfter")) { loadOrderSprite(itemInfo, itemChild, true); } - else if (xmlStrEqual(itemChild->name, BAD_CAST "drawBefore")) + else if (xmlNameEqual(itemChild, "drawBefore")) { loadOrderSprite(itemInfo, itemChild, false); } @@ -630,7 +630,7 @@ void loadFloorSprite(SpriteDisplay *display, XmlNodePtr floorNode) { for_each_xml_child_node(spriteNode, floorNode) { - if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite")) + if (xmlNameEqual(spriteNode, "sprite")) { SpriteReference *currentSprite = new SpriteReference; currentSprite->sprite = reinterpret_cast( @@ -639,7 +639,7 @@ void loadFloorSprite(SpriteDisplay *display, XmlNodePtr floorNode) = XML::getProperty(spriteNode, "variant", 0); display->sprites.push_back(currentSprite); } - else if (xmlStrEqual(spriteNode->name, BAD_CAST "particlefx")) + else if (xmlNameEqual(spriteNode, "particlefx")) { std::string particlefx = reinterpret_cast( spriteNode->xmlChildrenNode->content); @@ -669,7 +669,7 @@ void loadReplaceSprite(ItemInfo *itemInfo, XmlNodePtr replaceNode) continue; for_each_xml_child_node(itemNode, replaceNode) { - if (xmlStrEqual(itemNode->name, BAD_CAST "item")) + if (xmlNameEqual(itemNode, "item")) { int from = XML::getProperty(itemNode, "from", 0); int to = XML::getProperty(itemNode, "to", 1); @@ -691,7 +691,7 @@ void loadReplaceSprite(ItemInfo *itemInfo, XmlNodePtr replaceNode) for_each_xml_child_node(itemNode, replaceNode) { - if (xmlStrEqual(itemNode->name, BAD_CAST "item")) + if (xmlNameEqual(itemNode, "item")) { int from = XML::getProperty(itemNode, "from", 0); int to = XML::getProperty(itemNode, "to", 1); @@ -724,7 +724,7 @@ void loadReplaceSprite(ItemInfo *itemInfo, XmlNodePtr replaceNode) for_each_xml_child_node(itemNode, replaceNode) { - if (xmlStrEqual(itemNode->name, BAD_CAST "item")) + if (xmlNameEqual(itemNode, "item")) { int from = XML::getProperty(itemNode, "from", 0); int to = XML::getProperty(itemNode, "to", 1); @@ -754,7 +754,7 @@ void loadReplaceSprite(ItemInfo *itemInfo, XmlNodePtr replaceNode) return; for_each_xml_child_node(itemNode, replaceNode) { - if (xmlStrEqual(itemNode->name, BAD_CAST "item")) + if (xmlNameEqual(itemNode, "item")) { int from = XML::getProperty(itemNode, "from", 0); int to = XML::getProperty(itemNode, "to", 1); diff --git a/src/resources/mapdb.cpp b/src/resources/mapdb.cpp index aa10aff85..b186ad658 100644 --- a/src/resources/mapdb.cpp +++ b/src/resources/mapdb.cpp @@ -52,7 +52,7 @@ void MapDB::load() for_each_xml_child_node(node, root) { - if (xmlStrEqual(node->name, BAD_CAST "map")) + if (xmlNameEqual(node, "map")) { std::string name = XML::getProperty(node, "name", ""); if (name.empty()) diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index aa7bce59d..8d71779f2 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -227,7 +227,7 @@ Map *MapReader::readMap(const std::string &filename, // Parse the inflated map data if (node) { - if (!xmlStrEqual(node->name, BAD_CAST "map")) + if (!xmlNameEqual(node, "map")) logger->log("Error: Not a map file (%s)!", realFilename.c_str()); else map = readMap(node, realFilename); @@ -276,23 +276,23 @@ Map *MapReader::readMap(XmlNodePtr node, const std::string &path) for_each_xml_child_node(childNode, node) { - if (xmlStrEqual(childNode->name, BAD_CAST "tileset")) + if (xmlNameEqual(childNode, "tileset")) { Tileset *tileset = readTileset(childNode, pathDir, map); if (tileset) map->addTileset(tileset); } - else if (xmlStrEqual(childNode->name, BAD_CAST "layer")) + else if (xmlNameEqual(childNode, "layer")) { readLayer(childNode, map); } - else if (xmlStrEqual(childNode->name, BAD_CAST "properties")) + else if (xmlNameEqual(childNode, "properties")) { readProperties(childNode, map); map->setVersion(atoi(map->getProperty( "manaplus version").c_str())); } - else if (xmlStrEqual(childNode->name, BAD_CAST "objectgroup")) + else if (xmlNameEqual(childNode, "objectgroup")) { // The object group offset is applied to each object individually const int tileOffsetX = XML::getProperty(childNode, "x", 0); @@ -302,7 +302,7 @@ Map *MapReader::readMap(XmlNodePtr node, const std::string &path) for_each_xml_child_node(objectNode, childNode) { - if (xmlStrEqual(objectNode->name, BAD_CAST "object")) + if (xmlNameEqual(objectNode, "object")) { std::string objType = XML::getProperty( objectNode, "type", ""); @@ -386,7 +386,7 @@ void MapReader::readProperties(XmlNodePtr node, Properties *props) for_each_xml_child_node(childNode, node) { - if (!xmlStrEqual(childNode->name, BAD_CAST "property")) + if (!xmlNameEqual(childNode, "property")) continue; // Example: @@ -472,7 +472,7 @@ void MapReader::readLayer(XmlNodePtr node, Map *map) // Load the tile data for_each_xml_child_node(childNode, node) { - if (!xmlStrEqual(childNode->name, BAD_CAST "data")) + if (!xmlNameEqual(childNode, "data")) continue; const std::string encoding = @@ -619,7 +619,7 @@ void MapReader::readLayer(XmlNodePtr node, Map *map) // Read plain XML map file for_each_xml_child_node(childNode2, childNode) { - if (!xmlStrEqual(childNode2->name, BAD_CAST "tile")) + if (!xmlNameEqual(childNode2, "tile")) continue; const int gid = XML::getProperty(childNode2, "gid", -1); @@ -678,7 +678,7 @@ Tileset *MapReader::readTileset(XmlNodePtr node, const std::string &path, for_each_xml_child_node(childNode, node) { - if (xmlStrEqual(childNode->name, BAD_CAST "image")) + if (xmlNameEqual(childNode, "image")) { const std::string source = XML::getProperty( childNode, "source", ""); @@ -703,11 +703,11 @@ Tileset *MapReader::readTileset(XmlNodePtr node, const std::string &path, } } } - else if (xmlStrEqual(childNode->name, BAD_CAST "tile")) + else if (xmlNameEqual(childNode, "tile")) { for_each_xml_child_node(tileNode, childNode) { - if (!xmlStrEqual(tileNode->name, BAD_CAST "properties")) + if (!xmlNameEqual(tileNode, "properties")) continue; int tileGID = firstGid + XML::getProperty(childNode, "id", 0); @@ -716,7 +716,7 @@ Tileset *MapReader::readTileset(XmlNodePtr node, const std::string &path, std::map tileProperties; for_each_xml_child_node(propertyNode, tileNode) { - if (!xmlStrEqual(propertyNode->name, BAD_CAST "property")) + if (!xmlNameEqual(propertyNode, "property")) continue; std::string name = XML::getProperty( propertyNode, "name", ""); diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp index e6901fa2f..9d295db35 100644 --- a/src/resources/monsterdb.cpp +++ b/src/resources/monsterdb.cpp @@ -54,7 +54,7 @@ void MonsterDB::load() XML::Document doc("monsters.xml"); XmlNodePtr rootNode = doc.rootNode(); - if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "monsters")) + if (!rootNode || !xmlNameEqual(rootNode, "monsters")) { logger->log("Monster Database: Error while loading monster.xml!"); mLoaded = true; @@ -71,7 +71,7 @@ void MonsterDB::load() //iterate s for_each_xml_child_node(monsterNode, rootNode) { - if (!xmlStrEqual(monsterNode->name, BAD_CAST "monster")) + if (!xmlNameEqual(monsterNode, "monster")) continue; BeingInfo *currentInfo = new BeingInfo; @@ -119,7 +119,7 @@ void MonsterDB::load() if (!spriteNode->xmlChildrenNode) continue; - if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite")) + if (xmlNameEqual(spriteNode, "sprite")) { SpriteReference *currentSprite = new SpriteReference; currentSprite->sprite = reinterpret_cast( @@ -129,7 +129,7 @@ void MonsterDB::load() spriteNode, "variant", 0); display.sprites.push_back(currentSprite); } - else if (xmlStrEqual(spriteNode->name, BAD_CAST "sound")) + else if (xmlNameEqual(spriteNode, "sound")) { std::string event = XML::getProperty(spriteNode, "event", ""); const char *filename; @@ -172,7 +172,7 @@ void MonsterDB::load() currentInfo->getName().c_str()); } } - else if (xmlStrEqual(spriteNode->name, BAD_CAST "attack")) + else if (xmlNameEqual(spriteNode, "attack")) { const int id = XML::getProperty(spriteNode, "id", 0); const std::string particleEffect = XML::getProperty( @@ -185,7 +185,7 @@ void MonsterDB::load() currentInfo->addAttack(id, spriteAction, particleEffect, missileParticle); } - else if (xmlStrEqual(spriteNode->name, BAD_CAST "particlefx")) + else if (xmlNameEqual(spriteNode, "particlefx")) { display.particles.push_back(reinterpret_cast( spriteNode->xmlChildrenNode->content)); diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp index b823620f0..832fa26d6 100644 --- a/src/resources/npcdb.cpp +++ b/src/resources/npcdb.cpp @@ -48,7 +48,7 @@ void NPCDB::load() XML::Document doc("npcs.xml"); XmlNodePtr rootNode = doc.rootNode(); - if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "npcs")) + if (!rootNode || !xmlNameEqual(rootNode, "npcs")) { logger->log("NPC Database: Error while loading npcs.xml!"); mLoaded = true; @@ -58,7 +58,7 @@ void NPCDB::load() //iterate s for_each_xml_child_node(npcNode, rootNode) { - if (!xmlStrEqual(npcNode->name, BAD_CAST "npc")) + if (!xmlNameEqual(npcNode, "npc")) continue; int id = XML::getProperty(npcNode, "id", 0); @@ -84,7 +84,7 @@ void NPCDB::load() if (!spriteNode->xmlChildrenNode) continue; - if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite")) + if (xmlNameEqual(spriteNode, "sprite")) { SpriteReference *currentSprite = new SpriteReference; currentSprite->sprite = reinterpret_cast( @@ -93,7 +93,7 @@ void NPCDB::load() XML::getProperty(spriteNode, "variant", 0); display.sprites.push_back(currentSprite); } - else if (xmlStrEqual(spriteNode->name, BAD_CAST "particlefx")) + else if (xmlNameEqual(spriteNode, "particlefx")) { std::string particlefx = reinterpret_cast( spriteNode->xmlChildrenNode->content); diff --git a/src/resources/specialdb.cpp b/src/resources/specialdb.cpp index eb4a81c9a..b1a3a9c4d 100644 --- a/src/resources/specialdb.cpp +++ b/src/resources/specialdb.cpp @@ -57,7 +57,7 @@ void SpecialDB::load() XML::Document doc("specials.xml"); XmlNodePtr root = doc.rootNode(); - if (!root || !xmlStrEqual(root->name, BAD_CAST "specials")) + if (!root || !xmlNameEqual(root, "specials")) { logger->log("Error loading specials file specials.xml"); return; @@ -67,13 +67,13 @@ void SpecialDB::load() for_each_xml_child_node(set, root) { - if (xmlStrEqual(set->name, BAD_CAST "set")) + if (xmlNameEqual(set, "set")) { setName = XML::getProperty(set, "name", "Actions"); for_each_xml_child_node(special, set) { - if (xmlStrEqual(special->name, BAD_CAST "special")) + if (xmlNameEqual(special, "special")) { SpecialInfo *info = new SpecialInfo(); int id = XML::getProperty(special, "id", 0); diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp index 7ff74ac18..0d9b95f6f 100644 --- a/src/resources/spritedef.cpp +++ b/src/resources/spritedef.cpp @@ -83,7 +83,7 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, int variant) XML::Document doc(animationFile.substr(0, pos)); XmlNodePtr rootNode = doc.rootNode(); - if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "sprite")) + if (!rootNode || !xmlNameEqual(rootNode, "sprite")) { logger->log("Error, failed to parse %s", animationFile.c_str()); @@ -149,11 +149,11 @@ void SpriteDef::loadSprite(XmlNodePtr spriteNode, int variant, for_each_xml_child_node(node, spriteNode) { - if (xmlStrEqual(node->name, BAD_CAST "imageset")) + if (xmlNameEqual(node, "imageset")) loadImageSet(node, palettes); - else if (xmlStrEqual(node->name, BAD_CAST "action")) + else if (xmlNameEqual(node, "action")) loadAction(node, variant_offset); - else if (xmlStrEqual(node->name, BAD_CAST "include")) + else if (xmlNameEqual(node, "include")) includeSprite(node); } } @@ -223,7 +223,7 @@ void SpriteDef::loadAction(XmlNodePtr node, int variant_offset) // Load animations for_each_xml_child_node(animationNode, node) { - if (xmlStrEqual(animationNode->name, BAD_CAST "animation")) + if (xmlNameEqual(animationNode, "animation")) loadAnimation(animationNode, action, imageSet, variant_offset); } } @@ -262,7 +262,7 @@ void SpriteDef::loadAnimation(XmlNodePtr animationNode, offsetY -= imageSet->getHeight() - 32; offsetX -= imageSet->getWidth() / 2 - 16; - if (xmlStrEqual(frameNode->name, BAD_CAST "frame")) + if (xmlNameEqual(frameNode, "frame")) { const int index = XML::getProperty(frameNode, "index", -1); @@ -282,7 +282,7 @@ void SpriteDef::loadAnimation(XmlNodePtr animationNode, animation->addFrame(img, delay, offsetX, offsetY, rand); } - else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence")) + else if (xmlNameEqual(frameNode, "sequence")) { const int start = XML::getProperty(frameNode, "start", -1); const int end = XML::getProperty(frameNode, "end", -1); @@ -322,22 +322,22 @@ void SpriteDef::loadAnimation(XmlNodePtr animationNode, repeat --; } } - else if (xmlStrEqual(frameNode->name, BAD_CAST "end")) + else if (xmlNameEqual(frameNode, "end")) { animation->addTerminator(rand); } - else if (xmlStrEqual(frameNode->name, BAD_CAST "jump")) + else if (xmlNameEqual(frameNode, "jump")) { animation->addJump(XML::getProperty( frameNode, "action", ""), rand); } - else if (xmlStrEqual(frameNode->name, BAD_CAST "label")) + else if (xmlNameEqual(frameNode, "label")) { std::string name = XML::getProperty(frameNode, "name", ""); if (!name.empty()) animation->addLabel(name); } - else if (xmlStrEqual(frameNode->name, BAD_CAST "goto")) + else if (xmlNameEqual(frameNode, "goto")) { std::string name = XML::getProperty(frameNode, "label", ""); if (!name.empty()) @@ -365,7 +365,7 @@ void SpriteDef::includeSprite(XmlNodePtr includeNode) XML::Document doc(filename); XmlNodePtr rootNode = doc.rootNode(); - if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "sprite")) + if (!rootNode || !xmlNameEqual(rootNode, "sprite")) { logger->log("Error, no sprite root node in %s", filename.c_str()); return; diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp index f0002b47e..2b7cc328d 100644 --- a/src/simpleanimation.cpp +++ b/src/simpleanimation.cpp @@ -171,7 +171,7 @@ void SimpleAnimation::initializeAnimation(XmlNodePtr animationNode, offsetY -= imageset->getHeight() - 32; offsetX -= imageset->getWidth() / 2 - 16; - if (xmlStrEqual(frameNode->name, BAD_CAST "frame")) + if (xmlNameEqual(frameNode, "frame")) { int index = XML::getProperty(frameNode, "index", -1); @@ -192,7 +192,7 @@ void SimpleAnimation::initializeAnimation(XmlNodePtr animationNode, if (mAnimation) mAnimation->addFrame(img, delay, offsetX, offsetY, rand); } - else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence")) + else if (xmlNameEqual(frameNode, "sequence")) { int start = XML::getProperty(frameNode, "start", -1); int end = XML::getProperty(frameNode, "end", -1); @@ -218,7 +218,7 @@ void SimpleAnimation::initializeAnimation(XmlNodePtr animationNode, start++; } } - else if (xmlStrEqual(frameNode->name, BAD_CAST "end")) + else if (xmlNameEqual(frameNode, "end")) { if (mAnimation) mAnimation->addTerminator(rand); diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index 3de30e3cf..a7e06a2f4 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -132,7 +132,7 @@ void StatusEffect::load() XML::Document doc(STATUS_EFFECTS_FILE); XmlNodePtr rootNode = doc.rootNode(); - if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "status-effects")) + if (!rootNode || !xmlNameEqual(rootNode, "status-effects")) { logger->log1("Error loading status effects file: " STATUS_EFFECTS_FILE); @@ -145,7 +145,7 @@ void StatusEffect::load() int index = atoi(XML::getProperty(node, "id", "-1").c_str()); - if (xmlStrEqual(node->name, BAD_CAST "status-effect")) + if (xmlNameEqual(node, "status-effect")) { the_map = &statusEffects; int block_index = atoi(XML::getProperty( @@ -155,8 +155,10 @@ void StatusEffect::load() blockEffectIndexMap[block_index] = index; } - else if (xmlStrEqual(node->name, BAD_CAST "stun-effect")) + else if (xmlNameEqual(node, "stun-effect")) + { the_map = &stunEffects; + } if (the_map) { diff --git a/src/units.cpp b/src/units.cpp index c031558cf..804512dbd 100644 --- a/src/units.cpp +++ b/src/units.cpp @@ -102,7 +102,7 @@ void Units::loadUnits() XML::Document doc("units.xml"); XmlNodePtr root = doc.rootNode(); - if (!root || !xmlStrEqual(root->name, BAD_CAST "units")) + if (!root || !xmlNameEqual(root, "units")) { logger->log1("Error loading unit definition file: units.xml"); return; @@ -110,7 +110,7 @@ void Units::loadUnits() for_each_xml_child_node(node, root) { - if (xmlStrEqual(node->name, BAD_CAST "unit")) + if (xmlNameEqual(node, "unit")) { struct UnitDescription ud; int level = 1; @@ -127,7 +127,7 @@ void Units::loadUnits() for_each_xml_child_node(uLevel, node) { - if (xmlStrEqual(uLevel->name, BAD_CAST "level")) + if (xmlNameEqual(uLevel, "level")) { struct UnitLevel ul; ul.symbol = XML::getProperty(uLevel, "symbol", diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index 9d6858d9d..420915d8f 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -163,7 +163,7 @@ namespace XML { for_each_xml_child_node(child, parent) { - if (xmlStrEqual(child->name, BAD_CAST name)) + if (xmlNameEqual(child, name)) return child; } diff --git a/src/utils/xml.h b/src/utils/xml.h index fac90c63d..821ee2de4 100644 --- a/src/utils/xml.h +++ b/src/utils/xml.h @@ -31,6 +31,8 @@ #define XmlNodePtr xmlNodePtr +#define xmlNameEqual(node, str) xmlStrEqual((node)->name, BAD_CAST (str)) + /** * XML helper functions. */ -- cgit v1.2.3-70-g09d2 From 07ecab051e47f2a934acef615294db496520e87c Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Fri, 20 Jan 2012 20:38:54 +0100 Subject: Made the update window bigger and resizable Also made it remember its size and position. Reviewed-by: Erik Schilling Conflicts: src/gui/updaterwindow.cpp --- src/gui/updaterwindow.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/gui/updaterwindow.cpp') diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index 39dde65c3..28bd8467c 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -155,6 +155,12 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost, mLoadUpdates(applyUpdates), mUpdateType(updateType) { + setWindowName("UpdaterWindow"); + setResizable(true); + setDefaultSize(450, 400, ImageRect::CENTER); + setMinWidth(320); + setMinHeight(240); + mBrowserBox = new BrowserBox; mScrollArea = new ScrollArea(mBrowserBox); mLabel = new Label(_("Connecting...")); @@ -175,14 +181,12 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost, placer(3, 5, mCancelButton); placer(4, 5, mPlayButton); - reflowLayout(450, 400); - Layout &layout = getLayout(); layout.setRowHeight(0, Layout::AUTO_SET); addKeyListener(this); - center(); + loadWindowState(); setVisible(true); mCancelButton->requestFocus(); -- cgit v1.2.3-70-g09d2