From 3bae721fa894fe443d92207e2a9a51be57dadfdb Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 3 Feb 2025 14:42:44 +0100 Subject: [PATCH] try simplify blockthings iterator --- src/p_maputl.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index 159b985f5..23edf3d92 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -919,22 +919,17 @@ boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *)) return true; // Check interaction with the objects in the blockmap. - for (mobj = blocklinks[y*bmapwidth + x]; mobj; mobj = bnext) + for (mobj = blocklinks[y*bmapwidth + x]; mobj != NULL; mobj = bnext) { P_SetTarget(&bnext, mobj->bnext); // We want to note our reference to bnext here incase it is MF_NOTHINK and gets removed! + if (!func(mobj)) - { - P_SetTarget(&bnext, NULL); return false; - } - if (P_MobjWasRemoved(tmthing) // func just popped our tmthing, cannot continue. - || (bnext && P_MobjWasRemoved(bnext))) // func just broke blockmap chain, cannot continue. - { - P_SetTarget(&bnext, NULL); + + if (P_MobjWasRemoved(tmthing)) // func just popped our tmthing, cannot continue. return true; - } } - P_SetTarget(&bnext, NULL); + return true; }