- scriptified the declaration of AmbientSound

Most of the code is still native, but this means that PlayerPawn is the last remaining child of AActor.
This commit is contained in:
Christoph Oelckers 2019-01-02 01:04:50 +01:00
commit dc612703d5
4 changed files with 83 additions and 114 deletions

View file

@ -1118,7 +1118,7 @@ void ZCCCompiler::CompileAllFields()
// Create copies of the arrays which can be altered
auto Classes = this->Classes;
auto Structs = this->Structs;
TMap<PClass*, bool> HasNativeChildren;
TMap<FName, bool> HasNativeChildren;
// first step: Look for native classes with native children.
// These may not have any variables added to them because it'd clash with the native definitions.
@ -1134,7 +1134,7 @@ void ZCCCompiler::CompileAllFields()
if (ac->ParentClass != nullptr && ac->ParentClass->VMType == c->Type() && ac->Size != TentativeClass)
{
// Only set a marker here, so that we can print a better message when the actual fields get added.
HasNativeChildren.Insert(ac, true);
HasNativeChildren.Insert(c->Type()->TypeName, true);
break;
}
}
@ -1180,7 +1180,7 @@ void ZCCCompiler::CompileAllFields()
else
type->MetaSize = 0;
if (CompileFields(type->VMType, Classes[i]->Fields, nullptr, &Classes[i]->TreeNodes, false, !!HasNativeChildren.CheckKey(type)))
if (CompileFields(type->VMType, Classes[i]->Fields, nullptr, &Classes[i]->TreeNodes, false, !!HasNativeChildren.CheckKey(type->TypeName)))
{
// Remove from the list if all fields got compiled.
Classes.Delete(i--);
@ -1348,7 +1348,7 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArray<ZCC_VarDeclarator *
}
}
}
else if (hasnativechildren)
else if (hasnativechildren && !(varflags & VARF_Meta))
{
Error(field, "Cannot add field %s to %s. %s has native children which means it size may not change", FName(name->Name).GetChars(), type->TypeName.GetChars(), type->TypeName.GetChars());
}