mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-21 20:11:12 +00:00
Merge branch 'fix-segfault-player-spawnmobj' into 'next'
Fix segfault when trying to spawn an MT_PLAYER from Lua See merge request STJr/SRB2!2276
This commit is contained in:
commit
5de350e028
2 changed files with 5 additions and 3 deletions
|
@ -653,7 +653,7 @@ static int lib_pSpawnMobj(lua_State *L)
|
|||
NOHUD
|
||||
INLEVEL
|
||||
NOSPAWNNULL
|
||||
LUA_PushUserdata(L, P_SpawnMobj(x, y, z, type), META_MOBJ);
|
||||
LUA_PushUserdata(L, P_SpawnMobj(x, y, z, type, NULL), META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -10760,7 +10760,8 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...)
|
|||
// when spawning MT_PLAYER, set mobj->player before calling MobjSpawn hook to prevent P_RemoveMobj from succeeding on player mobj.
|
||||
va_start(args, type);
|
||||
mobj->player = va_arg(args, player_t *);
|
||||
mobj->player->mo = mobj;
|
||||
if (mobj->player)
|
||||
mobj->player->mo = mobj;
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
@ -14302,7 +14303,8 @@ mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zo
|
|||
yofs = FixedMul(yofs, mobj->scale);
|
||||
zofs = FixedMul(zofs, mobj->scale);
|
||||
|
||||
newmobj = P_SpawnMobj(mobj->x + xofs, mobj->y + yofs, mobj->z + zofs, type);
|
||||
newmobj = P_SpawnMobj(mobj->x + xofs, mobj->y + yofs, mobj->z + zofs, type, NULL);
|
||||
|
||||
if (!newmobj)
|
||||
return NULL;
|
||||
|
||||
|
|
Loading…
Reference in a new issue