commit 20abc8b8fab88933b0f57d4f06b52c42860a89d3
Author: Turo Lamminen <turol@iki.fi>
AuthorDate: Sat Jul 15 17:41:51 2023 +0300
Commit: Turo Lamminen <turol@users.noreply.github.com>
CommitDate: Mon Jul 17 21:24:23 2023 +0300
Add linked list consistency check to P_BlockThingsIterator
---
src/doom/p_maputl.c | 3 +++
src/heretic/p_maputl.c | 3 +++
src/hexen/p_maputl.c | 3 +++
src/strife/p_maputl.c | 2 ++
4 files changed, 11 insertions(+)
diff --git a/src/doom/p_maputl.c b/src/doom/p_maputl.c
index 585327a6..cb74c942 100644
--- a/src/doom/p_maputl.c
+++ b/src/doom/p_maputl.c
@@ -26,6 +26,7 @@
#include "m_bbox.h"
+#include "m_misc.h"
#include "doomdef.h"
#include "doomstat.h"
@@ -520,6 +521,8 @@ P_BlockThingsIterator
return true;
}
+ LINKED_LIST_CHECK_NO_CYCLE(mobj_t, blocklinks[y*bmapwidth+x], bnext);
+
for (mobj = blocklinks[y*bmapwidth+x] ;
mobj ;
mobj = mobj->bnext)
diff --git a/src/heretic/p_maputl.c b/src/heretic/p_maputl.c
index e2a71556..5150aaee 100644
--- a/src/heretic/p_maputl.c
+++ b/src/heretic/p_maputl.c
@@ -20,6 +20,7 @@
#include "doomdef.h"
#include "m_bbox.h"
+#include "m_misc.h"
#include "p_local.h"
@@ -463,6 +464,8 @@ boolean P_BlockThingsIterator(int x, int y, boolean(*func) (mobj_t *))
if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
return true;
+ LINKED_LIST_CHECK_NO_CYCLE(mobj_t, blocklinks[y*bmapwidth+x], bnext);
+
for (mobj = blocklinks[y * bmapwidth + x]; mobj; mobj = mobj->bnext)
if (!func(mobj))
return false;
diff --git a/src/hexen/p_maputl.c b/src/hexen/p_maputl.c
index d6c29c7e..1ed0aa96 100644
--- a/src/hexen/p_maputl.c
+++ b/src/hexen/p_maputl.c
@@ -18,6 +18,7 @@
#include "h2def.h"
#include "i_system.h"
#include "m_bbox.h"
+#include "m_misc.h"
#include "p_local.h"
static mobj_t *RoughBlockCheck(mobj_t * mo, int index);
@@ -494,6 +495,8 @@ boolean P_BlockThingsIterator(int x, int y, boolean(*func) (mobj_t *))
if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
return true;
+ LINKED_LIST_CHECK_NO_CYCLE(mobj_t, blocklinks[y*bmapwidth+x], bnext);
+
for (mobj = blocklinks[y * bmapwidth + x]; mobj; mobj = mobj->bnext)
if (!func(mobj))
return false;
diff --git a/src/strife/p_maputl.c b/src/strife/p_maputl.c
index e3984c77..78ae3471 100644
--- a/src/strife/p_maputl.c
+++ b/src/strife/p_maputl.c
@@ -26,6 +26,7 @@
#include "m_bbox.h"
+#include "m_misc.h"
#include "doomdef.h"
#include "doomstat.h"
@@ -543,6 +544,7 @@ P_BlockThingsIterator
return true;
}
+ LINKED_LIST_CHECK_NO_CYCLE(mobj_t, blocklinks[y*bmapwidth+x], bnext);
for (mobj = blocklinks[y*bmapwidth+x] ;
mobj ;