1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-31 23:15:43 +00:00

Merge branch 'navmesh_fixes' into 'master'

Minor navmesh fixes

See merge request OpenMW/openmw!1114
This commit is contained in:
Alexei Dobrohotov 2021-08-09 17:22:59 +00:00
commit 0a73771f17
3 changed files with 7 additions and 2 deletions

View file

@ -495,6 +495,10 @@ namespace DetourNavigator
params.maxPolys = 1 << polysBits; params.maxPolys = 1 << polysBits;
NavMeshPtr navMesh(dtAllocNavMesh(), &dtFreeNavMesh); NavMeshPtr navMesh(dtAllocNavMesh(), &dtFreeNavMesh);
if (navMesh == nullptr)
throw NavigatorException("Failed to allocate navmesh");
const auto status = navMesh->init(&params); const auto status = navMesh->init(&params);
if (!dtStatusSucceed(status)) if (!dtStatusSucceed(status))

View file

@ -20,7 +20,7 @@ namespace DetourNavigator
struct NavMeshData struct NavMeshData
{ {
NavMeshDataValue mValue; NavMeshDataValue mValue;
int mSize; int mSize = 0;
NavMeshData() = default; NavMeshData() = default;

View file

@ -85,7 +85,8 @@ namespace DetourNavigator
out.setAttribute(frameNumber, "NavMesh CacheSize", stats.mNavMeshCacheSize); out.setAttribute(frameNumber, "NavMesh CacheSize", stats.mNavMeshCacheSize);
out.setAttribute(frameNumber, "NavMesh UsedTiles", stats.mUsedNavMeshTiles); out.setAttribute(frameNumber, "NavMesh UsedTiles", stats.mUsedNavMeshTiles);
out.setAttribute(frameNumber, "NavMesh CachedTiles", stats.mCachedNavMeshTiles); out.setAttribute(frameNumber, "NavMesh CachedTiles", stats.mCachedNavMeshTiles);
out.setAttribute(frameNumber, "NavMesh CacheHitRate", static_cast<double>(stats.mHitCount) / stats.mGetCount * 100.0); if (stats.mGetCount > 0)
out.setAttribute(frameNumber, "NavMesh CacheHitRate", static_cast<double>(stats.mHitCount) / stats.mGetCount * 100.0);
} }
void NavMeshTilesCache::removeLeastRecentlyUsed() void NavMeshTilesCache::removeLeastRecentlyUsed()