summaryrefslogtreecommitdiff
path: root/src/resources/mapreader.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-06 20:59:54 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-07 08:09:07 +0000
commitf9a522c72db959b5d63061ed255735d0230fc7de (patch)
tree27580df342eeccd068cd7613884bccf9b8682634 /src/resources/mapreader.cpp
parent3ce39d2b497ab5356290a22b324181386af51c51 (diff)
downloadmana-f9a522c72db959b5d63061ed255735d0230fc7de.tar.gz
mana-f9a522c72db959b5d63061ed255735d0230fc7de.tar.bz2
mana-f9a522c72db959b5d63061ed255735d0230fc7de.tar.xz
mana-f9a522c72db959b5d63061ed255735d0230fc7de.zip
Fixed tile animations for CSV maps
The affected tiles were only tracked for base64-encoded layer data.
Diffstat (limited to 'src/resources/mapreader.cpp')
-rw-r--r--src/resources/mapreader.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index aba9f85d..8479cc6c 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -239,6 +239,9 @@ static void setTile(Map *map, MapLayer *layer, int x, int y, unsigned gid)
// Set regular tile on a layer
Image * const img = set ? set->get(gid - set->getFirstGid()) : nullptr;
layer->setTile(x, y, img);
+
+ if (TileAnimation *ani = map->getAnimationForGid(gid))
+ ani->addAffectedTile(layer, x + y * layer->getWidth());
}
else
{
@@ -371,12 +374,6 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
setTile(map, layer, x, y, gid);
- TileAnimation* ani = map->getAnimationForGid(gid);
- if (ani)
- {
- ani->addAffectedTile(layer, x + y * w);
- }
-
x++;
if (x == w)
{