mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-13 11:39:47 +00:00
Count navmesh cache key once in item size
Key is stored only in NavMeshTilesCache::Item, TileMap uses KeyView with a pointer to a vector.
This commit is contained in:
parent
88ca4a1db6
commit
489107c5ee
3 changed files with 13 additions and 13 deletions
apps/openmw_test_suite/detournavigator
components/detournavigator
|
@ -68,7 +68,7 @@ namespace
|
|||
{
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = cRecastMeshKeySize;
|
||||
const std::size_t maxSize = navMeshDataSize + 2 * navMeshKeySize;
|
||||
const std::size_t maxSize = navMeshDataSize + navMeshKeySize;
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const auto result = cache.set(mAgentHalfExtents, mTilePosition, mRecastMesh, mOffMeshConnections,
|
||||
|
@ -81,7 +81,7 @@ namespace
|
|||
{
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = cRecastMeshKeySize;
|
||||
const std::size_t maxSize = 2 * (navMeshDataSize + 2 * navMeshKeySize);
|
||||
const std::size_t maxSize = 2 * (navMeshDataSize + navMeshKeySize);
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
const auto anotherData = reinterpret_cast<unsigned char*>(dtAlloc(1, DT_ALLOC_PERM));
|
||||
NavMeshData anotherNavMeshData {anotherData, 1};
|
||||
|
@ -97,7 +97,7 @@ namespace
|
|||
{
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = cRecastMeshKeySize;
|
||||
const std::size_t maxSize = navMeshDataSize + 2 * navMeshKeySize;
|
||||
const std::size_t maxSize = navMeshDataSize + navMeshKeySize;
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
cache.set(mAgentHalfExtents, mTilePosition, mRecastMesh, mOffMeshConnections, std::move(mNavMeshData));
|
||||
|
@ -142,7 +142,7 @@ namespace
|
|||
{
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = cRecastMeshWithWaterKeySize;
|
||||
const std::size_t maxSize = navMeshDataSize + 2 * navMeshKeySize;
|
||||
const std::size_t maxSize = navMeshDataSize + navMeshKeySize;
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const std::vector<RecastMesh::Water> water {1, RecastMesh::Water {1, btTransform::getIdentity()}};
|
||||
|
@ -163,7 +163,7 @@ namespace
|
|||
{
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = cRecastMeshKeySize;
|
||||
const std::size_t maxSize = navMeshDataSize + 2 * navMeshKeySize;
|
||||
const std::size_t maxSize = navMeshDataSize + navMeshKeySize;
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const std::vector<RecastMesh::Water> water {1, RecastMesh::Water {1, btTransform::getIdentity()}};
|
||||
|
@ -182,7 +182,7 @@ namespace
|
|||
{
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = cRecastMeshWithWaterKeySize;
|
||||
const std::size_t maxSize = 2 * (navMeshDataSize + 2 * navMeshKeySize);
|
||||
const std::size_t maxSize = 2 * (navMeshDataSize + navMeshKeySize);
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const std::vector<RecastMesh::Water> leastRecentlySetWater {1, RecastMesh::Water {1, btTransform::getIdentity()}};
|
||||
|
@ -214,7 +214,7 @@ namespace
|
|||
{
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = cRecastMeshWithWaterKeySize;
|
||||
const std::size_t maxSize = 2 * (navMeshDataSize + 2 * navMeshKeySize);
|
||||
const std::size_t maxSize = 2 * (navMeshDataSize + navMeshKeySize);
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const std::vector<RecastMesh::Water> leastRecentlyUsedWater {1, RecastMesh::Water {1, btTransform::getIdentity()}};
|
||||
|
@ -258,7 +258,7 @@ namespace
|
|||
{
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = cRecastMeshKeySize;
|
||||
const std::size_t maxSize = 2 * (navMeshDataSize + 2 * navMeshKeySize);
|
||||
const std::size_t maxSize = 2 * (navMeshDataSize + navMeshKeySize);
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const std::vector<RecastMesh::Water> water {1, RecastMesh::Water {1, btTransform::getIdentity()}};
|
||||
|
@ -277,7 +277,7 @@ namespace
|
|||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize1 = cRecastMeshKeySize;
|
||||
const std::size_t navMeshKeySize2 = cRecastMeshWithWaterKeySize;
|
||||
const std::size_t maxSize = 2 * navMeshDataSize + 2 * navMeshKeySize1 + 2 * navMeshKeySize2;
|
||||
const std::size_t maxSize = 2 * navMeshDataSize + navMeshKeySize1 + navMeshKeySize2;
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const std::vector<RecastMesh::Water> anotherWater {1, RecastMesh::Water {1, btTransform::getIdentity()}};
|
||||
|
@ -306,7 +306,7 @@ namespace
|
|||
{
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = cRecastMeshKeySize;
|
||||
const std::size_t maxSize = navMeshDataSize + 2 * navMeshKeySize;
|
||||
const std::size_t maxSize = navMeshDataSize + navMeshKeySize;
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const std::vector<RecastMesh::Water> water {1, RecastMesh::Water {1, btTransform::getIdentity()}};
|
||||
|
@ -330,7 +330,7 @@ namespace
|
|||
{
|
||||
const std::size_t navMeshDataSize = 1;
|
||||
const std::size_t navMeshKeySize = cRecastMeshKeySize;
|
||||
const std::size_t maxSize = navMeshDataSize + 2 * navMeshKeySize;
|
||||
const std::size_t maxSize = navMeshDataSize + navMeshKeySize;
|
||||
NavMeshTilesCache cache(maxSize);
|
||||
|
||||
const std::vector<RecastMesh::Water> water {1, RecastMesh::Water {1, btTransform::getIdentity()}};
|
||||
|
|
|
@ -97,7 +97,7 @@ namespace DetourNavigator
|
|||
return Value();
|
||||
|
||||
auto navMeshKey = makeNavMeshKey(recastMesh, offMeshConnections);
|
||||
const auto itemSize = navMeshSize + 2 * navMeshKey.size();
|
||||
const auto itemSize = navMeshSize + navMeshKey.size();
|
||||
|
||||
if (itemSize > mFreeNavMeshDataSize + (mMaxNavMeshDataSize - mUsedNavMeshDataSize))
|
||||
return Value();
|
||||
|
|
|
@ -208,7 +208,7 @@ namespace DetourNavigator
|
|||
|
||||
static std::size_t getSize(const Item& item)
|
||||
{
|
||||
return static_cast<std::size_t>(item.mNavMeshData.mSize) + 2 * item.mNavMeshKey.size();
|
||||
return static_cast<std::size_t>(item.mNavMeshData.mSize) + item.mNavMeshKey.size();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue