summaryrefslogtreecommitdiff
path: root/src/doom/p_tick.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/doom/p_tick.c')
-rw-r--r--src/doom/p_tick.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/doom/p_tick.c b/src/doom/p_tick.c
index 22893500..c933cfe9 100644
--- a/src/doom/p_tick.c
+++ b/src/doom/p_tick.c
@@ -93,24 +93,26 @@ void P_AllocateThinker (thinker_t* thinker)
//
void P_RunThinkers (void)
{
- thinker_t* currentthinker;
+ thinker_t *currentthinker, *nextthinker;
currentthinker = thinkercap.next;
while (currentthinker != &thinkercap)
{
+ nextthinker = currentthinker->next;
+
if ( currentthinker->function.acv == (actionf_v)(-1) )
{
// time to remove it
currentthinker->next->prev = currentthinker->prev;
currentthinker->prev->next = currentthinker->next;
- Z_Free (currentthinker);
+ Z_Free(currentthinker);
}
else
{
if (currentthinker->function.acp1)
currentthinker->function.acp1 (currentthinker);
}
- currentthinker = currentthinker->next;
+ currentthinker = nextthinker;
}
}