diff --git a/src/map/mapcache.cpp b/src/map/mapcache.cpp index c8ffc96e70f..e0e58e5f099 100644 --- a/src/map/mapcache.cpp +++ b/src/map/mapcache.cpp @@ -107,7 +107,7 @@ std::shared_ptr MapCache::getOrCreateTileFromCache(const std::unique_ptrgetTile(x, y); } - std::unique_lock l(floor->mutex); + std::unique_lock l(floor->getMutex()); const uint8_t z = floor->getZ(); diff --git a/src/map/mapcache.hpp b/src/map/mapcache.hpp index 00e4a8cca2f..6265e979fa4 100644 --- a/src/map/mapcache.hpp +++ b/src/map/mapcache.hpp @@ -107,10 +107,13 @@ struct Floor { return z; } - mutable std::shared_mutex mutex; + auto &getMutex() const { + return mutex; + } private: std::pair, std::shared_ptr> tiles[FLOOR_SIZE][FLOOR_SIZE] = {}; + mutable std::shared_mutex mutex; uint8_t z { 0 }; };