mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-26 04:11:18 +00:00
Merge branch 'reference-count-fixes' into 'master'
Fixes an issue where mobjs with shadows would never get freed, See merge request KartKrew/Kart-Public!314
This commit is contained in:
commit
a12aaf40ce
2 changed files with 7 additions and 3 deletions
|
@ -1034,7 +1034,10 @@ boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *))
|
||||||
{
|
{
|
||||||
P_SetTarget(&bnext, mobj->bnext); // We want to note our reference to bnext here incase it is MF_NOTHINK and gets removed!
|
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))
|
if (!func(mobj))
|
||||||
|
{
|
||||||
|
P_SetTarget(&bnext, NULL);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if (P_MobjWasRemoved(tmthing) // func just popped our tmthing, cannot continue.
|
if (P_MobjWasRemoved(tmthing) // func just popped our tmthing, cannot continue.
|
||||||
|| (bnext && P_MobjWasRemoved(bnext))) // func just broke blockmap chain, cannot continue.
|
|| (bnext && P_MobjWasRemoved(bnext))) // func just broke blockmap chain, cannot continue.
|
||||||
{
|
{
|
||||||
|
@ -1042,6 +1045,7 @@ boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
P_SetTarget(&bnext, NULL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9893,6 +9893,9 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(mobj->flags & MF_NOTHINK))
|
||||||
|
P_AddThinker(&mobj->thinker); // Needs to come before the shadow spawn, or else the shadow's reference gets forgotten
|
||||||
|
|
||||||
switch (mobj->type)
|
switch (mobj->type)
|
||||||
{
|
{
|
||||||
case MT_PLAYER:
|
case MT_PLAYER:
|
||||||
|
@ -9916,9 +9919,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(mobj->flags & MF_NOTHINK))
|
|
||||||
P_AddThinker(&mobj->thinker);
|
|
||||||
|
|
||||||
// Call action functions when the state is set
|
// Call action functions when the state is set
|
||||||
if (st->action.acp1 && (mobj->flags & MF_RUNSPAWNFUNC))
|
if (st->action.acp1 && (mobj->flags & MF_RUNSPAWNFUNC))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue