- Re-jigged DoJump() to not be recursive so that 0-tic A_Jump* loops are no longer

able to potentially blow up the stack.

SVN r3902 (scripting)
This commit is contained in:
Randy Heit 2012-10-23 03:19:17 +00:00
commit d0c91083bc
3 changed files with 19 additions and 1 deletions

View file

@ -610,7 +610,15 @@ static void DoJump(AActor *self, AActor *stateowner, FState *callingstate, FStat
}
else if (callingstate == self->state)
{
self->SetState(jumpto);
// Rather than using self->SetState(jumpto) to set the state,
// set the state directly. Since this function is only called by
// action functions, which are only called by SetState(), we
// know that somewhere above us in the stack, a SetState()
// call is waiting for us to return. We use the flag OF_StateChanged
// to cause it to bypass the normal next state mechanism and use
// the one we set here instead.
self->state = jumpto;
self->ObjectFlags |= OF_StateChanged;
}
else
{ // something went very wrong. This should never happen.