mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Fix faulty references when spawning mobjs
This commit is contained in:
parent
dfd47733e2
commit
5c2821fb10
1 changed files with 3 additions and 0 deletions
|
@ -10882,6 +10882,9 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...)
|
|||
// increment mobj reference, so we don't get a dangling reference in case MobjSpawn calls P_RemoveMobj
|
||||
mobj->thinker.references++;
|
||||
|
||||
if (!(mobj->flags & MF_NOTHINK))
|
||||
P_AddThinker(THINK_MOBJ, &mobj->thinker);
|
||||
|
||||
// DANGER! This can cause P_SpawnMobj to return NULL!
|
||||
// Avoid using P_RemoveMobj on the newly created mobj in "MobjSpawn" Lua hooks!
|
||||
status = LUA_HookMobj(mobj, MOBJ_HOOK(MobjSpawn));
|
||||
|
|
Loading…
Reference in a new issue