diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-01-10 18:58:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-01-10 18:58:54 +0300 |
commit | 793a119a7a36f9680dad108e75075c8c4bd4a0d0 (patch) | |
tree | f995b989135dda75bcd45d8214571b4b4ed4e871 /src | |
parent | bad730dd0de24b2b17b91922c0c7f2b31b7b4d9b (diff) | |
download | ManaVerse-793a119a7a36f9680dad108e75075c8c4bd4a0d0.tar.gz ManaVerse-793a119a7a36f9680dad108e75075c8c4bd4a0d0.tar.bz2 ManaVerse-793a119a7a36f9680dad108e75075c8c4bd4a0d0.tar.xz ManaVerse-793a119a7a36f9680dad108e75075c8c4bd4a0d0.zip |
Replace all xmlNodePtr to XmlNodePtr.
Diffstat (limited to 'src')
37 files changed, 99 insertions, 97 deletions
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<int, EffectDescription *> 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<updateFile> loadXMLFile(const std::string &fileName) { std::vector<updateFile> 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 <typename T> ParticleEmitterProp<T> -ParticleEmitter::readParticleEmitterProp(xmlNodePtr propertyNode, T def) +ParticleEmitter::readParticleEmitterProp(XmlNodePtr propertyNode, T def) { ParticleEmitterProp<T> 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 <typename T> ParticleEmitterProp<T> - 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<const char*>( @@ -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<const char*>( @@ -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<char*>(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 <string> +#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 |