mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-26 04:30:55 +00:00
Add a temporary limbo list for thinkers that need to be freed, in order to keep other lists clean, especially the mobj list.
Signed-off-by: Nev3r <apophycens@gmail.com>
This commit is contained in:
parent
fc9e141460
commit
a3174fb56f
2 changed files with 14 additions and 1 deletions
|
@ -62,6 +62,7 @@
|
|||
#define P_GetPlayerSpinHeight(player) FixedMul(player->spinheight, player->mo->scale)
|
||||
|
||||
typedef enum{
|
||||
THINK_LIMBO,
|
||||
THINK_POLYOBJ,
|
||||
THINK_MAIN,
|
||||
THINK_DYNSLOPE,
|
||||
|
|
14
src/p_tick.c
14
src/p_tick.c
|
@ -244,10 +244,23 @@ void P_RemoveThinkerDelayed(void *pthinker)
|
|||
//
|
||||
void P_RemoveThinker(thinker_t *thinker)
|
||||
{
|
||||
thinker_t *next = thinker->next;
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_InvalidateUserdata(thinker);
|
||||
#endif
|
||||
thinker->function.acp1 = P_RemoveThinkerDelayed;
|
||||
|
||||
if (currentthinker == thinker)
|
||||
currentthinker = thinker->prev;
|
||||
|
||||
// Remove thinker from its current list.
|
||||
(next->prev = thinker->prev)->next = next;
|
||||
|
||||
// Now add it to the limbo list
|
||||
thlist[THINK_LIMBO].prev->next = thinker;
|
||||
thinker->next = &thlist[THINK_LIMBO];
|
||||
thinker->prev = thlist[THINK_LIMBO].prev;
|
||||
thlist[THINK_LIMBO].prev = thinker;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -298,7 +311,6 @@ static inline void P_RunThinkers(void)
|
|||
size_t i;
|
||||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
{
|
||||
CONS_Printf("Running thinker list %d.\n", i);
|
||||
for (currentthinker = thlist[i].next; currentthinker != &thlist[i]; currentthinker = currentthinker->next)
|
||||
{
|
||||
if (currentthinker->function.acp1)
|
||||
|
|
Loading…
Reference in a new issue