From 0e8473906e856e83afbf31fec4376a8075ab2d5b Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 7 Jun 2020 15:00:32 +0300 Subject: [PATCH] - tighten rules for action functions called from Decorate FxVMFunctionCall (previously used to call action functions from Decorate) skipped self pointer compatibility checks https://forum.zdoom.org/viewtopic.php?t=68678 --- src/scripting/decorate/thingdef_states.cpp | 10 ++++------ src/scripting/thingdef.h | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/scripting/decorate/thingdef_states.cpp b/src/scripting/decorate/thingdef_states.cpp index e9481eee0..636d07d3c 100644 --- a/src/scripting/decorate/thingdef_states.cpp +++ b/src/scripting/decorate/thingdef_states.cpp @@ -476,7 +476,7 @@ FxExpression *ParseActions(FScanner &sc, FState state, FString statestring, Bagg // Otherwise, it's a sequence of actions. if (!sc.Compare("{")) { - FxVMFunctionCall *call = ParseAction(sc, state, statestring, bag); + FxExpression *call = ParseAction(sc, state, statestring, bag); endswithret = true; return new FxReturnStatement(call, sc); } @@ -560,14 +560,12 @@ FxExpression *ParseActions(FScanner &sc, FState state, FString statestring, Bagg // //========================================================================== -FxVMFunctionCall *ParseAction(FScanner &sc, FState state, FString statestring, Baggage &bag) +FxExpression* ParseAction(FScanner &sc, FState state, FString statestring, Baggage &bag) { - FxVMFunctionCall *call; - // Make the action name lowercase strlwr (sc.String); - call = DoActionSpecials(sc, state, bag); + FxExpression *call = DoActionSpecials(sc, state, bag); if (call != NULL) { return call; @@ -580,7 +578,7 @@ FxVMFunctionCall *ParseAction(FScanner &sc, FState state, FString statestring, B { FArgumentList args; ParseFunctionParameters(sc, bag.Info, args, afd, statestring, &bag.statedef); - call = new FxVMFunctionCall(new FxSelf(sc), afd, args, sc, false); + call = new FxFunctionCall(symname, NAME_None, args, sc); return call; } sc.ScriptError("Invalid parameter '%s'\n", sc.String); diff --git a/src/scripting/thingdef.h b/src/scripting/thingdef.h index 027d832fa..4acd0e905 100644 --- a/src/scripting/thingdef.h +++ b/src/scripting/thingdef.h @@ -196,7 +196,7 @@ void ParseStates(FScanner &sc, PClassActor *actor, AActor *defaults, Baggage &ba void ParseFunctionParameters(FScanner &sc, PClassActor *cls, TArray &out_params, PFunction *afd, FString statestring, FStateDefinitions *statedef); FxExpression *ParseActions(FScanner &sc, FState state, FString statestring, Baggage &bag, bool &endswithret); -class FxVMFunctionCall *ParseAction(FScanner &sc, FState state, FString statestring, Baggage &bag); +FxExpression *ParseAction(FScanner &sc, FState state, FString statestring, Baggage &bag); FName CheckCastKludges(FName in); void SetImplicitArgs(TArray *args, TArray *argflags, TArray *argnames, PContainerType *cls, uint32_t funcflags, int useflags); PFunction *CreateAnonymousFunction(PContainerType *containingclass, PType *returntype, int flags);