Recast: initialize tile cell occupy state

Initialize it in the file.
This commit is contained in:
Kawe Mazidjatari 2024-08-17 22:58:59 +02:00
parent 8977b6ce04
commit 9c190cc7ca
2 changed files with 4 additions and 1 deletions

View File

@ -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.

View File

@ -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