From 9c190cc7ca879b6b2cde6e47b130f699b4db450f Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sat, 17 Aug 2024 22:58:59 +0200 Subject: [PATCH] Recast: initialize tile cell occupy state Initialize it in the file. --- src/thirdparty/recast/Detour/Include/DetourNavMesh.h | 2 +- src/thirdparty/recast/Detour/Source/DetourNavMeshBuilder.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/thirdparty/recast/Detour/Include/DetourNavMesh.h b/src/thirdparty/recast/Detour/Include/DetourNavMesh.h index 0b87151c..82b4bdcf 100644 --- a/src/thirdparty/recast/Detour/Include/DetourNavMesh.h +++ b/src/thirdparty/recast/Detour/Include/DetourNavMesh.h @@ -302,7 +302,7 @@ struct dtCell float pos[3]; ///< The position of the cell. unsigned int polyIndex; ///< The index of the poly this cell is on. unsigned char pad; - unsigned char occupystate[4]; ///< The occupation state of this cell, -1 means not occupied. See [r5apex_ds + 0xEF86C9]. + unsigned char occupyState[4]; ///< The occupation state of this cell, -1 means not occupied. See [r5apex_ds + 0xEF86C9]. #if DT_NAVMESH_SET_VERSION >= 9 unsigned char data[27]; // TODO: reverse this, always appears 0. diff --git a/src/thirdparty/recast/Detour/Source/DetourNavMeshBuilder.cpp b/src/thirdparty/recast/Detour/Source/DetourNavMeshBuilder.cpp index 18cd0e62..e8bed244 100644 --- a/src/thirdparty/recast/Detour/Source/DetourNavMeshBuilder.cpp +++ b/src/thirdparty/recast/Detour/Source/DetourNavMeshBuilder.cpp @@ -1166,6 +1166,9 @@ bool dtCreateNavMeshData(dtNavMeshCreateParams* params, unsigned char** outData, rdVcopy(cell.pos, cellItem.pos); cell.polyIndex = cellItem.polyIndex; + + int* state = (int*)((uintptr_t)&cell.occupyState & ~0x3); + *state = -1; } #endif