- replaced more dyn_casts and checks for RUNTIME_CLASS(PClassActor)

It is preferable to use IsDescendantOf wherever possible if we ever want to be able to separate PClass from PType.
This commit is contained in:
Christoph Oelckers 2017-04-12 10:20:58 +02:00
commit 9c9b2ccf6d
13 changed files with 28 additions and 23 deletions

View file

@ -10982,7 +10982,7 @@ FxExpression *FxMultiNameState::Resolve(FCompileContext &ctx)
}
else if (names[0] == NAME_Super)
{
scope = dyn_cast<PClassActor>(clstype->ParentClass);
scope = ValidateActor(clstype->ParentClass);
}
else
{

View file

@ -582,7 +582,7 @@ static FState *CheckState(FScanner &sc, PClass *type)
FState *state = NULL;
sc.MustGetString();
PClassActor *info = dyn_cast<PClassActor>(type->ParentClass);
PClassActor *info = ValidateActor(type->ParentClass);
if (info != NULL)
{
@ -999,7 +999,7 @@ PClassActor *CreateNewActor(const FScriptPosition &sc, FName typeName, FName par
sc.Message(MSG_ERROR, "'%s' inherits from a class with the same name", typeName.GetChars());
break;
}
p = dyn_cast<PClassActor>(p->ParentClass);
p = ValidateActor(p->ParentClass);
}
if (parent == NULL)

View file

@ -1385,7 +1385,7 @@ void ZCCCompiler::CompileAllProperties()
bool ZCCCompiler::CompileProperties(PClass *type, TArray<ZCC_Property *> &Properties, FName prefix)
{
if (!type->IsKindOf(RUNTIME_CLASS(PClassActor)))
if (!type->IsDescendantOf(RUNTIME_CLASS(AActor)))
{
Error(Properties[0], "Properties can only be defined for actors");
return false;
@ -2850,7 +2850,7 @@ void ZCCCompiler::CompileStates()
FString statename; // The state builder wants the label as one complete string, not separated into tokens.
FStateDefinitions statedef;
statedef.MakeStateDefines(dyn_cast<PClassActor>(c->Type()->ParentClass));
statedef.MakeStateDefines(ValidateActor(c->Type()->ParentClass));
int numframes = 0;
for (auto s : c->States)