diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-09-13 00:49:42 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-09-13 00:49:42 +0300 |
commit | e71aed97c2d885c8113561c1e0cad91454adeb57 (patch) | |
tree | 0ff10712fa74fd8835cc3a978b088ee9937cb681 /src | |
parent | 7ae98a6a6626f47e613739812b75d2c42f16048e (diff) | |
download | mv-e71aed97c2d885c8113561c1e0cad91454adeb57.tar.gz mv-e71aed97c2d885c8113561c1e0cad91454adeb57.tar.bz2 mv-e71aed97c2d885c8113561c1e0cad91454adeb57.tar.xz mv-e71aed97c2d885c8113561c1e0cad91454adeb57.zip |
fix animaed tiles in csv map format.
Diffstat (limited to 'src')
-rw-r--r-- | src/resources/mapreader.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 7481ad948..4f39c80a3 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -538,7 +538,7 @@ bool MapReader::readBase64Layer(const XmlNodePtr childNode, Map *const map, } } - std::map<int, TileAnimation*> &tileAnimations + const std::map<int, TileAnimation*> &tileAnimations = map->getTileAnimations(); const bool hasAnimations = !tileAnimations.empty(); @@ -592,6 +592,10 @@ bool MapReader::readCsvLayer(const XmlNodePtr childNode, Map *const map, std::string csv(data); size_t oldPos = 0; + const std::map<int, TileAnimation*> &tileAnimations + = map->getTileAnimations(); + const bool hasAnimations = !tileAnimations.empty(); + while (oldPos != csv.npos) { const size_t pos = csv.find_first_of(",", oldPos); @@ -600,6 +604,16 @@ bool MapReader::readCsvLayer(const XmlNodePtr childNode, Map *const map, const int gid = atoi(csv.substr(oldPos, pos - oldPos).c_str()); setTile(map, layer, x, y, gid); + if (hasAnimations) + { + TileAnimationMapCIter it = tileAnimations.find(gid); + if (it != tileAnimations.end()) + { + TileAnimation *const ani = it->second; + if (ani) + ani->addAffectedTile(layer, x + y * w); + } + } x++; if (x == w) |