Fix some undefined behavior

git-svn-id: https://svn.eduke32.com/eduke32@7950 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-08-12 03:15:14 +00:00 committed by Christoph Oelckers
parent 2ef83e4a71
commit d404f010c9

View file

@ -158,8 +158,12 @@ static inline void VM_DummySprite(void)
static FORCE_INLINE int32_t VM_EventInlineInternal__(int const &eventNum, int const &spriteNum, int const &playerNum,
int const playerDist = -1, int32_t returnValue = 0)
{
vmstate_t const newVMstate = { spriteNum, playerNum, playerDist, 0, &sprite[spriteNum],
&actor[spriteNum].t_data[0], g_player[playerNum].ps, &actor[spriteNum] };
vmstate_t const newVMstate = { spriteNum, playerNum, playerDist, 0,
&sprite[spriteNum&(MAXSPRITES-1)],
&actor[spriteNum&(MAXSPRITES-1)].t_data[0],
g_player[playerNum&(MAXPLAYERS-1)].ps,
&actor[spriteNum&(MAXSPRITES-1)] };
auto &globalReturn = aGameVars[g_returnVarID].global;
struct