mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-31 21:50:48 +00:00
Merge branch 'fix-mobj-thinker-reference-corruption' into 'next'
Fix faulty references when spawning mobjs See merge request STJr/SRB2!2126
This commit is contained in:
commit
8bffe3e3a7
1 changed files with 3 additions and 3 deletions
|
@ -10869,9 +10869,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...)
|
|||
)))
|
||||
mobj->flags2 |= MF2_DONTRESPAWN;
|
||||
|
||||
if (!(mobj->flags & MF_NOTHINK))
|
||||
P_AddThinker(THINK_MOBJ, &mobj->thinker);
|
||||
|
||||
if (type == MT_PLAYER)
|
||||
{
|
||||
// when spawning MT_PLAYER, set mobj->player before calling MobjSpawn hook to prevent P_RemoveMobj from succeeding on player mobj.
|
||||
|
@ -10881,6 +10878,9 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...)
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
if (!(mobj->flags & MF_NOTHINK) || (titlemapinaction && mobj->type == MT_ALTVIEWMAN))
|
||||
P_AddThinker(THINK_MOBJ, &mobj->thinker);
|
||||
|
||||
// increment mobj reference, so we don't get a dangling reference in case MobjSpawn calls P_RemoveMobj
|
||||
mobj->thinker.references++;
|
||||
|
||||
|
|
Loading…
Reference in a new issue