diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-11-30 13:59:45 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-01-20 21:58:39 +0300 |
commit | bc3a7cf853510ffe1e42dc683f854d360f6528c7 (patch) | |
tree | 9898f13eafc3e1a20388d8d592bfcc05c8f50ba7 /src/resources/db/itemdb.cpp | |
parent | a058af57bddd4a4394401cc75d33461e17aab8c1 (diff) | |
download | manaverse-bc3a7cf853510ffe1e42dc683f854d360f6528c7.tar.gz manaverse-bc3a7cf853510ffe1e42dc683f854d360f6528c7.tar.bz2 manaverse-bc3a7cf853510ffe1e42dc683f854d360f6528c7.tar.xz manaverse-bc3a7cf853510ffe1e42dc683f854d360f6528c7.zip |
Add pugixml backend incomplete.
Add some defines for xml nodes manipulation.
With pugixml backend no xml writing.
Diffstat (limited to 'src/resources/db/itemdb.cpp')
-rw-r--r-- | src/resources/db/itemdb.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index 9a815bed6..6a3766cc6 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -545,11 +545,8 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum) } else if (xmlNameEqual(itemChild, "particlefx")) { - if (itemChild->xmlChildrenNode) - { - display.particles.push_back(reinterpret_cast<const char*>( - itemChild->xmlChildrenNode->content)); - } + if (XmlHaveChildContent(itemChild)) + display.particles.push_back(XmlChildContent(itemChild)); } else if (xmlNameEqual(itemChild, "sound")) { @@ -844,11 +841,10 @@ static int parseDirectionName(const std::string &name) static void loadSpriteRef(ItemInfo *const itemInfo, const XmlNodePtr node) { const std::string gender = XML::getProperty(node, "gender", "unisex"); - if (!node || !node->xmlChildrenNode) + if (!node || !XmlHaveChildContent(node)) return; - const std::string filename = reinterpret_cast<const char*>( - node->xmlChildrenNode->content); + const std::string filename = XmlChildContent(node); const int race = XML::getProperty(node, "race", 0); if (gender == "male" || gender == "unisex") @@ -861,11 +857,10 @@ static void loadSpriteRef(ItemInfo *const itemInfo, const XmlNodePtr node) static void loadSoundRef(ItemInfo *const itemInfo, const XmlNodePtr node) { - if (!node || !node->xmlChildrenNode) + if (!node || !XmlHaveChildContent(node)) return; const std::string event = XML::getProperty(node, "event", ""); - const std::string filename = reinterpret_cast<const char*>( - node->xmlChildrenNode->content); + const std::string filename = XmlChildContent(node); const int delay = XML::getProperty(node, "delay", 0); const std::map<std::string, ItemSoundEvent::Type>::const_iterator @@ -888,21 +883,19 @@ static void loadFloorSprite(SpriteDisplay &display, return; for_each_xml_child_node(spriteNode, floorNode) { - if (!spriteNode->xmlChildrenNode) + if (!XmlHaveChildContent(spriteNode)) continue; if (xmlNameEqual(spriteNode, "sprite")) { SpriteReference *const currentSprite = new SpriteReference; - currentSprite->sprite = reinterpret_cast<const char*>( - spriteNode->xmlChildrenNode->content); + currentSprite->sprite = XmlChildContent(spriteNode); currentSprite->variant = XML::getProperty(spriteNode, "variant", 0); display.sprites.push_back(currentSprite); } else if (xmlNameEqual(spriteNode, "particlefx")) { - display.particles.push_back(reinterpret_cast<const char*>( - spriteNode->xmlChildrenNode->content)); + display.particles.push_back(XmlChildContent(spriteNode)); } } } |