try simplify blockthings iterator
This commit is contained in:
1 parent
e0ae6aa85c
commit
3bae721fa8
1 file changed
+5
-10
+5
-10
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user