diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-08-29 02:04:52 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-08-29 02:04:52 +0300 |
commit | f2286853ea4322c980b05577bbc04ed2c211997b (patch) | |
tree | 602d9fe582eb2fb227dfa300dc8c22cf4700757f /src/resources/itemdb.cpp | |
parent | 8002c6f3844e637e246d0bd96dd6253ac91324a3 (diff) | |
download | plus-f2286853ea4322c980b05577bbc04ed2c211997b.tar.gz plus-f2286853ea4322c980b05577bbc04ed2c211997b.tar.bz2 plus-f2286853ea4322c980b05577bbc04ed2c211997b.tar.xz plus-f2286853ea4322c980b05577bbc04ed2c211997b.zip |
Fix item sprites replacment issue if mixed directional and non directional
replacement rules.
Diffstat (limited to 'src/resources/itemdb.cpp')
-rw-r--r-- | src/resources/itemdb.cpp | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index e60127997..60fe51443 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -624,21 +624,42 @@ void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode) std::string removeSprite = XML::getProperty(replaceNode, "sprite", ""); int direction = parseDirectionName(XML::getProperty( replaceNode, "direction", "all")); - std::map<int, int> *mapList = itemInfo->addReplaceSprite( - parseSpriteName(removeSprite), direction); - - if (!mapList) - return; itemInfo->setRemoveSprites(); - for_each_xml_child_node(itemNode, replaceNode) + if (direction != -1) { - if (xmlStrEqual(itemNode->name, BAD_CAST "item")) + std::map<int, int> *mapList = itemInfo->addReplaceSprite( + parseSpriteName(removeSprite), direction); + if (!mapList) + return; + for_each_xml_child_node(itemNode, replaceNode) { - int from = XML::getProperty(itemNode, "from", 0); - int to = XML::getProperty(itemNode, "to", 1); - (*mapList)[from] = to; + if (xmlStrEqual(itemNode->name, BAD_CAST "item")) + { + int from = XML::getProperty(itemNode, "from", 0); + int to = XML::getProperty(itemNode, "to", 1); + (*mapList)[from] = to; + } + } + } + else + { + for_each_xml_child_node(itemNode, replaceNode) + { + if (xmlStrEqual(itemNode->name, BAD_CAST "item")) + { + int from = XML::getProperty(itemNode, "from", 0); + int to = XML::getProperty(itemNode, "to", 1); + for (int f = 0; f < 9; f ++) + { + std::map<int, int> *mapList = itemInfo->addReplaceSprite( + parseSpriteName(removeSprite), f); + if (!mapList) + continue; + (*mapList)[from] = to; + } + } } } } |