mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-14 08:31:23 +00:00
Allow empty parameter lists for action functions without parameters
- Using A_Scream() in a state instead of A_Scream is now valid.
This commit is contained in:
parent
8c105ff3a0
commit
320fb9aec5
1 changed files with 55 additions and 56 deletions
|
@ -391,6 +391,8 @@ void ParseFunctionParameters(FScanner &sc, PClassActor *cls, TArray<FxExpression
|
||||||
const TArray<DWORD> ¶mflags = afd->Variants[0].ArgFlags;
|
const TArray<DWORD> ¶mflags = afd->Variants[0].ArgFlags;
|
||||||
int numparams = (int)params.Size();
|
int numparams = (int)params.Size();
|
||||||
int pnum = 0;
|
int pnum = 0;
|
||||||
|
bool zeroparm;
|
||||||
|
|
||||||
if (afd->Flags & VARF_Method)
|
if (afd->Flags & VARF_Method)
|
||||||
{
|
{
|
||||||
numparams--;
|
numparams--;
|
||||||
|
@ -401,11 +403,9 @@ void ParseFunctionParameters(FScanner &sc, PClassActor *cls, TArray<FxExpression
|
||||||
numparams -= 2;
|
numparams -= 2;
|
||||||
pnum += 2;
|
pnum += 2;
|
||||||
}
|
}
|
||||||
if (numparams > 0)
|
assert(numparams >= 0);
|
||||||
{
|
zeroparm = numparams == 0;
|
||||||
int v;
|
if (numparams > 0 && !(paramflags[pnum] & VARF_Optional))
|
||||||
|
|
||||||
if (!(paramflags[pnum] & VARF_Optional))
|
|
||||||
{
|
{
|
||||||
sc.MustGetStringName("(");
|
sc.MustGetStringName("(");
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,6 @@ void ParseFunctionParameters(FScanner &sc, PClassActor *cls, TArray<FxExpression
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (numparams > 0)
|
while (numparams > 0)
|
||||||
{
|
{
|
||||||
FxExpression *x;
|
FxExpression *x;
|
||||||
|
@ -428,7 +427,7 @@ void ParseFunctionParameters(FScanner &sc, PClassActor *cls, TArray<FxExpression
|
||||||
sc.ScriptError("You cannot use state jumps commands with a jump offset on multistate definitions\n");
|
sc.ScriptError("You cannot use state jumps commands with a jump offset on multistate definitions\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
v = sc.Number;
|
int v = sc.Number;
|
||||||
if (v < 0)
|
if (v < 0)
|
||||||
{
|
{
|
||||||
sc.ScriptError("Negative jump offsets are not allowed");
|
sc.ScriptError("Negative jump offsets are not allowed");
|
||||||
|
@ -469,15 +468,15 @@ void ParseFunctionParameters(FScanner &sc, PClassActor *cls, TArray<FxExpression
|
||||||
sc.MustGetStringName (",");
|
sc.MustGetStringName (",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sc.MustGetStringName(")");
|
if (zeroparm)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
sc.MustGetString();
|
if (!sc.CheckString(")"))
|
||||||
if (sc.Compare("("))
|
|
||||||
{
|
{
|
||||||
sc.ScriptError("You cannot pass parameters to '%s'\n", afd->SymbolName.GetChars());
|
sc.ScriptError("You cannot pass parameters to '%s'\n", afd->SymbolName.GetChars());
|
||||||
}
|
}
|
||||||
sc.UnGet();
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sc.MustGetStringName(")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue