diff --git a/Mods/vcmi/Data/debug/cached.png b/Mods/vcmi/Data/debug/cached.png new file mode 100644 index 000000000..7f7dbefae Binary files /dev/null and b/Mods/vcmi/Data/debug/cached.png differ diff --git a/client/mapRenderer/MapRendererContext.cpp b/client/mapRenderer/MapRendererContext.cpp index ee1047b43..92ce4315a 100644 --- a/client/mapRenderer/MapRendererContext.cpp +++ b/client/mapRenderer/MapRendererContext.cpp @@ -113,6 +113,9 @@ size_t MapRendererContext::terrainImageIndex(size_t groupSize) const bool MapRendererContext::tileAnimated(const int3 & coordinates) const { + if (!isInMap(coordinates)) + return false; + if(movementAnimation) { auto objects = getObjects(coordinates); diff --git a/client/mapRenderer/MapViewCache.cpp b/client/mapRenderer/MapViewCache.cpp index b55becfcb..962cc9d70 100644 --- a/client/mapRenderer/MapViewCache.cpp +++ b/client/mapRenderer/MapViewCache.cpp @@ -66,7 +66,7 @@ void MapViewCache::updateTile(const std::shared_ptr & newCacheEntry.tileY = coordinates.y; newCacheEntry.checksum = mapRenderer->getTileChecksum(*context, coordinates); - if(cachedLevel == coordinates.z && oldCacheEntry == newCacheEntry) + if(cachedLevel == coordinates.z && oldCacheEntry == newCacheEntry && !context->tileAnimated(coordinates)) { // debug code to check caching - cached tiles will slowly fade to black //static const auto overlay = IImage::createFromFile("debug/cached"); @@ -132,7 +132,7 @@ void MapViewCache::render(const std::shared_ptr & con int cacheY = (terrainChecksum.shape()[1] + y) % terrainChecksum.shape()[1]; int3 tile(x, y, model->getLevel()); - if(lazyUpdate && tilesUpToDate[cacheX][cacheY] && !context->tileAnimated(tile)) + if(lazyUpdate && tilesUpToDate[cacheX][cacheY]) continue; Canvas source = getTile(tile);