- fixed order of state setup.

It looks like the setup of the action function and the adding of the states got inverted by something I tried, leaving the ActionFunc member empty on the real states.
This commit is contained in:
Christoph Oelckers 2016-10-14 21:56:45 +02:00
parent 52005214c1
commit d00e93bdab
1 changed files with 7 additions and 7 deletions

View File

@ -2169,13 +2169,6 @@ void ZCCCompiler::CompileStates()
} }
#endif #endif
int count = statedef.AddStates(&state, sl->Frames->GetChars());
if (count < 0)
{
Error(sl, "Invalid frame character string '%s'", sl->Frames->GetChars());
count = -count;
}
if (sl->Action != nullptr) if (sl->Action != nullptr)
{ {
auto code = SetupActionFunction(static_cast<PClassActor *>(c->Type()), sl->Action); auto code = SetupActionFunction(static_cast<PClassActor *>(c->Type()), sl->Action);
@ -2184,6 +2177,13 @@ void ZCCCompiler::CompileStates()
state.ActionFunc = FunctionBuildList.AddFunction(c->Type(), code, FStringf("%s.StateFunction.%d", c->Type()->TypeName.GetChars(), statedef.GetStateCount()), true); state.ActionFunc = FunctionBuildList.AddFunction(c->Type(), code, FStringf("%s.StateFunction.%d", c->Type()->TypeName.GetChars(), statedef.GetStateCount()), true);
} }
} }
int count = statedef.AddStates(&state, sl->Frames->GetChars());
if (count < 0)
{
Error(sl, "Invalid frame character string '%s'", sl->Frames->GetChars());
count = -count;
}
break; break;
} }
case AST_StateGoto: case AST_StateGoto: