Skip to content
Snippets Groups Projects
Commit 940756ad authored by sphere's avatar sphere
Browse files

Merge branch 'fix-1219' into 'next'

Fix #1219

Closes #1219

See merge request STJr/SRB2!2391
parents 4018a7fa 7469a627
No related branches found
No related tags found
No related merge requests found
...@@ -1026,22 +1026,34 @@ boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean (*func)(line_t *)) ...@@ -1026,22 +1026,34 @@ boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean (*func)(line_t *))
// //
boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *)) boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *))
{ {
mobj_t *mobj; mobj_t *bnext = NULL;
blocknode_t *block; blocknode_t *block, *next = NULL;
if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight) if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
return true; return true;
// Check interaction with the objects in the blockmap. // Check interaction with the objects in the blockmap.
for (block = blocklinks[y*bmapwidth + x]; block; block = block->mnext) for (block = blocklinks[y*bmapwidth + x]; block; block = next)
{ {
mobj = block->mobj; next = block->mnext;
if (next)
P_SetTarget(&bnext, next->mobj); // We want to note our reference to bnext here in case it is MF_NOTHINK and gets removed!
if (!func(mobj)) if (!func(block->mobj))
{
P_SetTarget(&bnext, NULL);
return false; return false;
if (P_MobjWasRemoved(tmthing)) // func just broke blockmap chain, cannot continue. }
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);
return true; return true;
} }
}
P_SetTarget(&bnext, NULL);
return true; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment