diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-10-21 02:19:07 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-10-21 02:19:07 +0300 |
commit | 2fcfbc4b1136265cbd463b9d3b721ce0cad52fe0 (patch) | |
tree | 854b9842e8ecbf791577e11d3d93d15380ec2eb2 /src | |
parent | 60621b7cd02030ab86a670c2124fb50f237b0c4f (diff) | |
download | manaplus-2fcfbc4b1136265cbd463b9d3b721ce0cad52fe0.tar.gz manaplus-2fcfbc4b1136265cbd463b9d3b721ce0cad52fe0.tar.bz2 manaplus-2fcfbc4b1136265cbd463b9d3b721ce0cad52fe0.tar.xz manaplus-2fcfbc4b1136265cbd463b9d3b721ce0cad52fe0.zip |
Fix parsing replace tags without item ids inside in items.xml.
Diffstat (limited to 'src')
-rw-r--r-- | src/resources/itemdb.cpp | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index 9ff80de22..74474e067 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -636,19 +636,20 @@ void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode) { case -1: { - for_each_xml_child_node(itemNode, replaceNode) + for (int f = 0; f < 9; f ++) { - if (xmlStrEqual(itemNode->name, BAD_CAST "item")) + std::map<int, int> *mapList + = itemInfo->addReplaceSprite( + parseSpriteName(removeSprite), f); + if (!mapList) + continue; + for_each_xml_child_node(itemNode, replaceNode) { - int from = XML::getProperty(itemNode, "from", 0); - int to = XML::getProperty(itemNode, "to", 1); - for (int f = 0; f < 9; f ++) + if (xmlStrEqual(itemNode->name, BAD_CAST "item")) { - std::map<int, int> *mapList - = itemInfo->addReplaceSprite( - parseSpriteName(removeSprite), f); - if (!mapList) - continue; + int from = XML::getProperty(itemNode, "from", 0); + int to = XML::getProperty(itemNode, "to", 1); + (*mapList)[from] = to; } } @@ -657,6 +658,13 @@ void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode) } case -2: { + itemInfo->addReplaceSprite(parseSpriteName( + removeSprite), DIRECTION_DOWN); + itemInfo->addReplaceSprite(parseSpriteName( + removeSprite), DIRECTION_DOWNLEFT); + itemInfo->addReplaceSprite(parseSpriteName( + removeSprite), DIRECTION_DOWNRIGHT); + for_each_xml_child_node(itemNode, replaceNode) { if (xmlStrEqual(itemNode->name, BAD_CAST "item")) @@ -683,6 +691,13 @@ void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode) } case -3: { + itemInfo->addReplaceSprite(parseSpriteName( + removeSprite), DIRECTION_UP); + itemInfo->addReplaceSprite(parseSpriteName( + removeSprite), DIRECTION_UPLEFT); + itemInfo->addReplaceSprite(parseSpriteName( + removeSprite), DIRECTION_UPRIGHT); + for_each_xml_child_node(itemNode, replaceNode) { if (xmlStrEqual(itemNode->name, BAD_CAST "item")) |