Recast: fix off-mesh connection remap during prune

Off-mesh connections were not properly mapped to their polygon instance, causing
a heap buffer overflow.
This commit is contained in:
Kawe Mazidjatari 2024-10-18 15:48:57 +02:00
parent d9db7d3d15
commit 49907272fb

View File

@ -1362,19 +1362,13 @@ bool dtUpdateNavMeshData(dtNavMesh* nav, const unsigned int tileIndex)
if (!(poly.flags & DT_POLYFLAGS_JUMP_LINKED))
continue;
for (int c = 0; c < header->offMeshConCount; c++)
{
const dtOffMeshConnection& conn = tile->offMeshCons[c];
const int conIdx = i-header->offMeshBase;
if (conn.poly != i)
continue;
const dtOffMeshConnection& conn = tile->offMeshCons[conIdx];
rdAssert(conn.poly == i);
oldOffMeshConnIdMap[c] = offMeshConCount;
newOffMeshConnIdMap[offMeshConCount] = c;
offMeshConCount++;
break;
}
oldOffMeshConnIdMap[offMeshConCount] = conIdx;
newOffMeshConnIdMap[conIdx] = offMeshConCount++;
}
else
{