Skip to content

Commit

Permalink
fix smell
Browse files Browse the repository at this point in the history
  • Loading branch information
mehah committed Nov 5, 2023
1 parent 2bd5bad commit 790b867
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/map/mapcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ std::shared_ptr<Tile> MapCache::getOrCreateTileFromCache(const std::unique_ptr<F
return floor->getTile(x, y);
}

std::unique_lock l(floor->mutex);
std::unique_lock l(floor->getMutex());

const uint8_t z = floor->getZ();

Expand Down
5 changes: 4 additions & 1 deletion src/map/mapcache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,13 @@ struct Floor {
return z;
}

mutable std::shared_mutex mutex;
auto &getMutex() const {
return mutex;
}

private:
std::pair<std::shared_ptr<Tile>, std::shared_ptr<BasicTile>> tiles[FLOOR_SIZE][FLOOR_SIZE] = {};
mutable std::shared_mutex mutex;
uint8_t z { 0 };
};

Expand Down

0 comments on commit 790b867

Please sign in to comment.