From d00e93bdab779548413f49385bb13d1908d6f7e9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 14 Oct 2016 21:56:45 +0200 Subject: [PATCH] - 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. --- src/scripting/zscript/zcc_compile.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index f24bce20c..d034c51cc 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -2169,13 +2169,6 @@ void ZCCCompiler::CompileStates() } #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) { auto code = SetupActionFunction(static_cast(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); } } + + int count = statedef.AddStates(&state, sl->Frames->GetChars()); + if (count < 0) + { + Error(sl, "Invalid frame character string '%s'", sl->Frames->GetChars()); + count = -count; + } break; } case AST_StateGoto: