- scriptified A_Mushroom to test something a bit more complex.

- fixed: FxMinusSign trashed local variables that were used with negation.
- fixed: FxConditional only handled ints and floats, but not pointers and strings.
- fixed: A 'no states in non-actors' error was triggered, even for classes without any states.
This commit is contained in:
Christoph Oelckers 2016-10-30 14:00:11 +01:00
commit f8ccda2dc8
15 changed files with 290 additions and 222 deletions

View file

@ -1490,6 +1490,7 @@ PType *ZCCCompiler::ResolveUserType(ZCC_BasicType *type, PSymbolTable *symt)
}
return type;
}
Error(type, "Unable to resolve %s as type.", FName(type->UserType->Id).GetChars());
return TypeError;
}
@ -2186,8 +2187,8 @@ static bool CheckRandom(ZCC_Expression *duration)
FxExpression *ZCCCompiler::SetupActionFunction(PClass *cls, ZCC_TreeNode *af)
{
// We have 3 cases to consider here:
// 1. An action function without parameters. This can be called directly
// 2. An action functon with parameters or a non-action function. This needs to be wrapped into a helper function to set everything up.
// 1. A function without parameters. This can be called directly
// 2. A functon with parameters. This needs to be wrapped into a helper function to set everything up.
// 3. An anonymous function.
// 1. and 2. are exposed through AST_ExprFunctionCall
@ -2236,9 +2237,10 @@ void ZCCCompiler::CompileStates()
{
for (auto c : Classes)
{
if (!c->Type()->IsDescendantOf(RUNTIME_CLASS(AActor)))
{
Error(c->cls, "%s: States can only be defined for actors.", c->Type()->TypeName.GetChars());
if (c->States.Size()) Error(c->cls, "%s: States can only be defined for actors.", c->Type()->TypeName.GetChars());
continue;
}
FString statename; // The state builder wants the label as one complete string, not separated into tokens.