summaryrefslogtreecommitdiff
path: root/src/heretic/p_tick.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/heretic/p_tick.c')
-rw-r--r--src/heretic/p_tick.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/heretic/p_tick.c b/src/heretic/p_tick.c
index c93a211f..323cc1e6 100644
--- a/src/heretic/p_tick.c
+++ b/src/heretic/p_tick.c
@@ -110,11 +110,13 @@ 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 == (think_t) - 1)
{ // time to remove it
currentthinker->next->prev = currentthinker->prev;
@@ -126,7 +128,7 @@ void P_RunThinkers(void)
if (currentthinker->function)
currentthinker->function(currentthinker);
}
- currentthinker = currentthinker->next;
+ currentthinker = nextthinker;
}
}