diff --git a/source/games/exhumed/src/freelistarray.h b/source/games/exhumed/src/freelistarray.h index f56fedd38..6e0cb4262 100644 --- a/source/games/exhumed/src/freelistarray.h +++ b/source/games/exhumed/src/freelistarray.h @@ -46,6 +46,7 @@ public: enum { count = size }; void Clear() { + memset(DataList, 0, sizeof(DataList)); freecount = size; for (int i = 0; i < size; i++) { @@ -61,6 +62,8 @@ public: void Release(int i) { + // Important: This must not clear the released objects because several + // linked list loops are written to access the 'next' field after the Release call! FreeList[freecount++] = i; } diff --git a/source/games/exhumed/src/lighting.cpp b/source/games/exhumed/src/lighting.cpp index b1c6f3027..a3d8953e5 100644 --- a/source/games/exhumed/src/lighting.cpp +++ b/source/games/exhumed/src/lighting.cpp @@ -539,6 +539,7 @@ loc_1868A: { nLastFlash = edi; } + pFlash->pActor = nullptr; sFlash.Release(nFlash); } } diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index b26c88bee..ec0d534dc 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -801,6 +801,7 @@ int GetUpAngle(DExhumedActor* pActor1, int nVal, DExhumedActor* pActor2, int ecx void InitPushBlocks() { nPushBlocks = 0; + memset(sBlockInfo, 0, sizeof(sBlockInfo)); } int GrabPushBlock()