diff options
Diffstat (limited to 'src/resources/db')
-rw-r--r-- | src/resources/db/avatardb.cpp | 6 | ||||
-rw-r--r-- | src/resources/db/deaddb.cpp | 2 | ||||
-rw-r--r-- | src/resources/db/emotedb.cpp | 16 | ||||
-rw-r--r-- | src/resources/db/horsedb.cpp | 9 | ||||
-rw-r--r-- | src/resources/db/itemdb.cpp | 25 | ||||
-rw-r--r-- | src/resources/db/npcdb.cpp | 10 | ||||
-rw-r--r-- | src/resources/db/petdb.cpp | 8 | ||||
-rw-r--r-- | src/resources/db/skillunitdb.cpp | 8 |
8 files changed, 32 insertions, 52 deletions
diff --git a/src/resources/db/avatardb.cpp b/src/resources/db/avatardb.cpp index 783954006..5b377b173 100644 --- a/src/resources/db/avatardb.cpp +++ b/src/resources/db/avatardb.cpp @@ -107,13 +107,11 @@ void AvatarDB::loadXmlFile(const std::string &fileName) { if (xmlNameEqual(spriteNode, "sprite")) { - if (!spriteNode->xmlChildrenNode) + if (!XmlHaveChildContent(spriteNode)) continue; 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); diff --git a/src/resources/db/deaddb.cpp b/src/resources/db/deaddb.cpp index dcd658f0e..a2a6a6494 100644 --- a/src/resources/db/deaddb.cpp +++ b/src/resources/db/deaddb.cpp @@ -73,7 +73,7 @@ void DeadDB::loadXmlFile(const std::string &fileName) else if (xmlNameEqual(node, "message")) { const char *const data = reinterpret_cast<const char*>( - xmlNodeGetContent(node)); + XmlNodeGetContent(node)); if (!data || !*data) continue; mMessages.push_back(data); diff --git a/src/resources/db/emotedb.cpp b/src/resources/db/emotedb.cpp index eeaaaf0a2..b2f9a0581 100644 --- a/src/resources/db/emotedb.cpp +++ b/src/resources/db/emotedb.cpp @@ -116,7 +116,7 @@ void EmoteDB::loadXmlFile(const std::string &fileName) for_each_xml_child_node(spriteNode, emoteNode) { - if (!spriteNode->xmlChildrenNode) + if (!XmlHaveChildContent(spriteNode)) continue; if (xmlNameEqual(spriteNode, "sprite")) @@ -124,8 +124,7 @@ void EmoteDB::loadXmlFile(const std::string &fileName) EmoteSprite *const currentSprite = new EmoteSprite; currentSprite->sprite = AnimatedSprite::load( paths.getStringValue("sprites").append(std::string( - reinterpret_cast<const char*>( - spriteNode->xmlChildrenNode->content))), + XmlChildContent(spriteNode))), XML::getProperty(spriteNode, "variant", 0)); currentSprite->name = XML::langProperty( spriteNode, "name", ""); @@ -134,8 +133,7 @@ void EmoteDB::loadXmlFile(const std::string &fileName) } else if (xmlNameEqual(spriteNode, "particlefx")) { - currentInfo->particles.push_back(reinterpret_cast<const char*>( - spriteNode->xmlChildrenNode->content)); + currentInfo->particles.push_back(XmlChildContent(spriteNode)); } } mEmoteInfos[id] = currentInfo; @@ -190,7 +188,7 @@ void EmoteDB::loadSpecialXmlFile(const std::string &fileName) for_each_xml_child_node(spriteNode, emoteNode) { - if (!spriteNode->xmlChildrenNode) + if (!XmlHaveChildContent(spriteNode)) continue; if (xmlNameEqual(spriteNode, "sprite")) @@ -198,8 +196,7 @@ void EmoteDB::loadSpecialXmlFile(const std::string &fileName) EmoteSprite *const currentSprite = new EmoteSprite; currentSprite->sprite = AnimatedSprite::load( paths.getStringValue("sprites").append(std::string( - reinterpret_cast<const char*>( - spriteNode->xmlChildrenNode->content))), + XmlChildContent(spriteNode))), XML::getProperty(spriteNode, "variant", 0)); currentSprite->name = XML::langProperty( spriteNode, "name", ""); @@ -208,8 +205,7 @@ void EmoteDB::loadSpecialXmlFile(const std::string &fileName) } else if (xmlNameEqual(spriteNode, "particlefx")) { - currentInfo->particles.push_back(reinterpret_cast<const char*>( - spriteNode->xmlChildrenNode->content)); + currentInfo->particles.push_back(XmlChildContent(spriteNode)); } } mEmoteInfos[id] = currentInfo; diff --git a/src/resources/db/horsedb.cpp b/src/resources/db/horsedb.cpp index 011548b1f..27987c657 100644 --- a/src/resources/db/horsedb.cpp +++ b/src/resources/db/horsedb.cpp @@ -42,8 +42,7 @@ namespace { \ SpriteReference *const currentSprite = new SpriteReference; \ currentSprite->sprite = paths.getStringValue("sprites").append( \ - std::string(reinterpret_cast<const char*>( \ - spriteNode->xmlChildrenNode->content))); \ + std::string(XmlChildContent(spriteNode))); \ currentSprite->variant = XML::getProperty( \ spriteNode, "variant", 0); \ currentInfo->name.push_back(currentSprite); \ @@ -142,7 +141,7 @@ void HorseDB::loadXmlFile(const std::string &fileName) for_each_xml_child_node(spriteNode, horseNode) { - if (!spriteNode->xmlChildrenNode) + if (!XmlHaveChildContent(spriteNode)) continue; if (xmlNameEqual(spriteNode, "sprite")) @@ -162,7 +161,7 @@ static void loadDownSprites(XmlNodePtrConst parentNode, { for_each_xml_child_node(spriteNode, parentNode) { - if (!spriteNode->xmlChildrenNode) + if (!XmlHaveChildContent(spriteNode)) continue; if (xmlNameEqual(spriteNode, "sprite")) @@ -175,7 +174,7 @@ static void loadUpSprites(XmlNodePtrConst parentNode, { for_each_xml_child_node(spriteNode, parentNode) { - if (!spriteNode->xmlChildrenNode) + if (!XmlHaveChildContent(spriteNode)) continue; if (xmlNameEqual(spriteNode, "sprite")) 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)); } } } diff --git a/src/resources/db/npcdb.cpp b/src/resources/db/npcdb.cpp index 3362c02c9..1827cd859 100644 --- a/src/resources/db/npcdb.cpp +++ b/src/resources/db/npcdb.cpp @@ -118,23 +118,21 @@ void NPCDB::loadXmlFile(const std::string &fileName) { if (xmlNameEqual(spriteNode, "sprite")) { - if (!spriteNode->xmlChildrenNode) + if (!XmlHaveChildContent(spriteNode)) continue; 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")) { - if (!spriteNode->xmlChildrenNode) + if (!XmlHaveChildContent(spriteNode)) continue; - display.particles.push_back(reinterpret_cast<const char*>( - spriteNode->xmlChildrenNode->content)); + display.particles.push_back(XmlChildContent(spriteNode)); } else if (xmlNameEqual(spriteNode, "menu")) { diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp index 53f34fae8..160306d71 100644 --- a/src/resources/db/petdb.cpp +++ b/src/resources/db/petdb.cpp @@ -153,22 +153,20 @@ void PETDB::loadXmlFile(const std::string &fileName) SpriteDisplay display; for_each_xml_child_node(spriteNode, petNode) { - 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")) { - std::string particlefx = reinterpret_cast<const char*>( - spriteNode->xmlChildrenNode->content); + std::string particlefx = XmlChildContent(spriteNode); display.particles.push_back(particlefx); } } diff --git a/src/resources/db/skillunitdb.cpp b/src/resources/db/skillunitdb.cpp index d89eca896..30d0b3918 100644 --- a/src/resources/db/skillunitdb.cpp +++ b/src/resources/db/skillunitdb.cpp @@ -111,22 +111,20 @@ void SkillUnitDb::loadXmlFile(const std::string &fileName) SpriteDisplay display; for_each_xml_child_node(spriteNode, skillUnitNode) { - 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")) { - std::string particlefx = reinterpret_cast<const char*>( - spriteNode->xmlChildrenNode->content); + std::string particlefx = XmlChildContent(spriteNode); display.particles.push_back(particlefx); } } |