- fixed: The states parser tried to simplify the head node for random duration but it has to simplify the two value nodes separately.

- added jump by index to ZScript.
This commit is contained in:
Christoph Oelckers 2016-11-05 00:39:00 +01:00
commit b6633bc489
6 changed files with 40 additions and 10 deletions

View file

@ -132,7 +132,7 @@ void SetImplicitArgs(TArray<PType *> *args, TArray<DWORD> *argflags, TArray<FNam
//
//==========================================================================
PFunction *CreateAnonymousFunction(PClass *containingclass, PType *returntype, int flags)
PFunction *CreateAnonymousFunction(PClass *containingclass, PType *returntype, int flags, int statecount)
{
TArray<PType *> rets(1);
TArray<PType *> args;
@ -143,6 +143,7 @@ PFunction *CreateAnonymousFunction(PClass *containingclass, PType *returntype, i
SetImplicitArgs(&args, &argflags, &argnames, containingclass, flags);
PFunction *sym = new PFunction(containingclass, NAME_None); // anonymous functions do not have names.
sym->StateCount = statecount;
sym->AddVariant(NewPrototype(rets, args), argflags, argnames, nullptr, flags);
return sym;
}
@ -201,7 +202,7 @@ void CreateDamageFunction(PClassActor *info, AActor *defaults, FxExpression *id,
else
{
auto dmg = new FxReturnStatement(new FxIntCast(id, true), id->ScriptPosition);
auto funcsym = CreateAnonymousFunction(info, TypeSInt32, VARF_Method);
auto funcsym = CreateAnonymousFunction(info, TypeSInt32, VARF_Method, 0);
defaults->DamageFunc = FunctionBuildList.AddFunction(funcsym, dmg, FStringf("%s.DamageFunction", info->TypeName.GetChars()), fromDecorate);
}
}