summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/doom/p_tick.c4
-rw-r--r--src/heretic/p_tick.c4
-rw-r--r--src/hexen/p_tick.c9
-rw-r--r--src/strife/p_tick.c4
4 files changed, 11 insertions, 10 deletions
diff --git a/src/doom/p_tick.c b/src/doom/p_tick.c
index c933cfe9..5a93b80f 100644
--- a/src/doom/p_tick.c
+++ b/src/doom/p_tick.c
@@ -98,11 +98,10 @@ void P_RunThinkers (void)
currentthinker = thinkercap.next;
while (currentthinker != &thinkercap)
{
- nextthinker = currentthinker->next;
-
if ( currentthinker->function.acv == (actionf_v)(-1) )
{
// time to remove it
+ nextthinker = currentthinker->next;
currentthinker->next->prev = currentthinker->prev;
currentthinker->prev->next = currentthinker->next;
Z_Free(currentthinker);
@@ -111,6 +110,7 @@ void P_RunThinkers (void)
{
if (currentthinker->function.acp1)
currentthinker->function.acp1 (currentthinker);
+ nextthinker = currentthinker->next;
}
currentthinker = nextthinker;
}
diff --git a/src/heretic/p_tick.c b/src/heretic/p_tick.c
index 323cc1e6..ac1c9429 100644
--- a/src/heretic/p_tick.c
+++ b/src/heretic/p_tick.c
@@ -115,10 +115,9 @@ void P_RunThinkers(void)
currentthinker = thinkercap.next;
while (currentthinker != &thinkercap)
{
- nextthinker = currentthinker->next;
-
if (currentthinker->function == (think_t) - 1)
{ // time to remove it
+ nextthinker = currentthinker->next;
currentthinker->next->prev = currentthinker->prev;
currentthinker->prev->next = currentthinker->next;
Z_Free(currentthinker);
@@ -127,6 +126,7 @@ void P_RunThinkers(void)
{
if (currentthinker->function)
currentthinker->function(currentthinker);
+ nextthinker = currentthinker->next;
}
currentthinker = nextthinker;
}
diff --git a/src/hexen/p_tick.c b/src/hexen/p_tick.c
index c58d6e82..3d3dd389 100644
--- a/src/hexen/p_tick.c
+++ b/src/hexen/p_tick.c
@@ -91,17 +91,18 @@ static void RunThinkers(void)
currentthinker = thinkercap.next;
while (currentthinker != &thinkercap)
{
- nextthinker = currentthinker->next;
-
if (currentthinker->function == (think_t) - 1)
{ // Time to remove it
+ nextthinker = currentthinker->next;
currentthinker->next->prev = currentthinker->prev;
currentthinker->prev->next = currentthinker->next;
Z_Free(currentthinker);
}
- else if (currentthinker->function)
+ else
{
- currentthinker->function(currentthinker);
+ if (currentthinker->function)
+ currentthinker->function(currentthinker);
+ nextthinker = currentthinker->next;
}
currentthinker = nextthinker;
diff --git a/src/strife/p_tick.c b/src/strife/p_tick.c
index c0dd4786..3c6caa06 100644
--- a/src/strife/p_tick.c
+++ b/src/strife/p_tick.c
@@ -104,11 +104,10 @@ void P_RunThinkers (void)
currentthinker = thinkercap.next;
while (currentthinker != &thinkercap)
{
- nextthinker = currentthinker->next;
-
if ( currentthinker->function.acv == (actionf_v)(-1) )
{
// time to remove it
+ nextthinker = currentthinker->next;
currentthinker->next->prev = currentthinker->prev;
currentthinker->prev->next = currentthinker->next;
Z_Free (currentthinker);
@@ -117,6 +116,7 @@ void P_RunThinkers (void)
{
if (currentthinker->function.acp1)
currentthinker->function.acp1 (currentthinker);
+ nextthinker = currentthinker->next;
}
currentthinker = nextthinker;