mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 17:59:56 +00:00
Mark TileCachedRecastMeshManager member functions as const where possible
This commit is contained in:
parent
3c6f145753
commit
8ac8d56e8c
4 changed files with 12 additions and 12 deletions
|
@ -117,7 +117,7 @@ namespace DetourNavigator
|
|||
return result;
|
||||
}
|
||||
|
||||
std::shared_ptr<RecastMesh> RecastMeshManager::getMesh()
|
||||
std::shared_ptr<RecastMesh> RecastMeshManager::getMesh() const
|
||||
{
|
||||
TileBounds tileBounds = mTileBounds;
|
||||
tileBounds.mMin /= mSettings.mRecastScaleFactor;
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace DetourNavigator
|
|||
|
||||
std::optional<Cell> removeHeightfield(const osg::Vec2i& cellPosition);
|
||||
|
||||
std::shared_ptr<RecastMesh> getMesh();
|
||||
std::shared_ptr<RecastMesh> getMesh() const;
|
||||
|
||||
bool isEmpty() const;
|
||||
|
||||
|
|
|
@ -190,11 +190,11 @@ namespace DetourNavigator
|
|||
return result;
|
||||
}
|
||||
|
||||
std::shared_ptr<RecastMesh> TileCachedRecastMeshManager::getMesh(const TilePosition& tilePosition)
|
||||
std::shared_ptr<RecastMesh> TileCachedRecastMeshManager::getMesh(const TilePosition& tilePosition) const
|
||||
{
|
||||
const auto manager = [&] () -> std::shared_ptr<CachedRecastMeshManager>
|
||||
{
|
||||
const auto tiles = mTiles.lock();
|
||||
const auto tiles = mTiles.lockConst();
|
||||
const auto it = tiles->find(tilePosition);
|
||||
if (it == tiles->end())
|
||||
return nullptr;
|
||||
|
@ -205,7 +205,7 @@ namespace DetourNavigator
|
|||
return manager->getMesh();
|
||||
}
|
||||
|
||||
bool TileCachedRecastMeshManager::hasTile(const TilePosition& tilePosition)
|
||||
bool TileCachedRecastMeshManager::hasTile(const TilePosition& tilePosition) const
|
||||
{
|
||||
return mTiles.lockConst()->count(tilePosition);
|
||||
}
|
||||
|
@ -215,9 +215,9 @@ namespace DetourNavigator
|
|||
return mRevision;
|
||||
}
|
||||
|
||||
void TileCachedRecastMeshManager::reportNavMeshChange(const TilePosition& tilePosition, Version recastMeshVersion, Version navMeshVersion)
|
||||
void TileCachedRecastMeshManager::reportNavMeshChange(const TilePosition& tilePosition, Version recastMeshVersion, Version navMeshVersion) const
|
||||
{
|
||||
const auto tiles = mTiles.lock();
|
||||
const auto tiles = mTiles.lockConst();
|
||||
const auto it = tiles->find(tilePosition);
|
||||
if (it == tiles->end())
|
||||
return;
|
||||
|
|
|
@ -86,20 +86,20 @@ namespace DetourNavigator
|
|||
|
||||
std::optional<Cell> removeHeightfield(const osg::Vec2i& cellPosition);
|
||||
|
||||
std::shared_ptr<RecastMesh> getMesh(const TilePosition& tilePosition);
|
||||
std::shared_ptr<RecastMesh> getMesh(const TilePosition& tilePosition) const;
|
||||
|
||||
bool hasTile(const TilePosition& tilePosition);
|
||||
bool hasTile(const TilePosition& tilePosition) const;
|
||||
|
||||
template <class Function>
|
||||
void forEachTile(Function&& function)
|
||||
void forEachTile(Function&& function) const
|
||||
{
|
||||
for (auto& [tilePosition, recastMeshManager] : *mTiles.lock())
|
||||
for (auto& [tilePosition, recastMeshManager] : *mTiles.lockConst())
|
||||
function(tilePosition, *recastMeshManager);
|
||||
}
|
||||
|
||||
std::size_t getRevision() const;
|
||||
|
||||
void reportNavMeshChange(const TilePosition& tilePosition, Version recastMeshVersion, Version navMeshVersion);
|
||||
void reportNavMeshChange(const TilePosition& tilePosition, Version recastMeshVersion, Version navMeshVersion) const;
|
||||
|
||||
private:
|
||||
using TilesMap = std::map<TilePosition, std::shared_ptr<CachedRecastMeshManager>>;
|
||||
|
|
Loading…
Reference in a new issue