mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-24 04:29:34 -04:00
fix P_SetMobjState stack (#150)
This commit is contained in:
parent
727a57cca3
commit
cfba708236
@ -58,10 +58,10 @@ boolean P_SetMobjState(mobj_t* mobj,statenum_t state)
|
||||
static int recursion; // detects recursion
|
||||
statenum_t i = state; // initial state
|
||||
boolean ret = true; // return value
|
||||
statenum_t tempstate[NUMSTATES]; // for use with recursion
|
||||
statenum_t* tempstate = NULL; // for use with recursion
|
||||
|
||||
if (recursion++) // if recursion detected,
|
||||
memset(seenstate=tempstate,0,sizeof tempstate); // clear state table
|
||||
seenstate = tempstate = calloc(NUMSTATES, sizeof(statenum_t)); // allocate state table
|
||||
|
||||
do
|
||||
{
|
||||
@ -98,6 +98,9 @@ boolean P_SetMobjState(mobj_t* mobj,statenum_t state)
|
||||
for (;(state=seenstate[i]);i=state-1)
|
||||
seenstate[i] = 0; // killough 4/9/98: erase memory of states
|
||||
|
||||
if (tempstate)
|
||||
free(tempstate);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user