- Fixed: FStateDefinitions::FinishStates() must ResolveGotoLabels before resolving labelled gotos. Otherwise, something like this fails:

Goto State1
    State1:
      Goto State2
    State2:
  because when "Goto State1" is processed, State1 is still pointing at the string "State2" rather than State2's state, so the goto will end up pointing at a string (which will soon be
  freed from memory) instead of at an actual state.

SVN r3784 (trunk)
This commit is contained in:
Randy Heit 2012-07-22 04:30:07 +00:00
parent 6bb6df483a
commit 22cc0544af

View file

@ -884,7 +884,6 @@ int FStateDefinitions::FinishStates (FActorInfo *actor, AActor *defaults)
{
FState *realstates = new FState[count];
int i;
int currange;
memcpy(realstates, &StateArray[0], count*sizeof(FState));
actor->OwnedStates = realstates;
@ -894,7 +893,10 @@ int FStateDefinitions::FinishStates (FActorInfo *actor, AActor *defaults)
// In the case new states are added these must be adjusted, too!
FixStatePointers(actor, StateLabels);
for(i = currange = 0; i < count; i++)
// Fix state pointers that are gotos
ResolveGotoLabels(actor, defaults, StateLabels);
for (i = 0; i < count; i++)
{
// resolve labels and jumps
switch (realstates[i].DefineFlags)
@ -921,9 +923,11 @@ int FStateDefinitions::FinishStates (FActorInfo *actor, AActor *defaults)
}
}
}
else
{
// Fix state pointers that are gotos
ResolveGotoLabels(actor, defaults, StateLabels);
}
return count;
}