- partial scriptification of AInventory.

- scriptification of CustomInventory.
This commit is contained in:
Christoph Oelckers 2017-01-19 19:14:22 +01:00
commit 7c6542e595
10 changed files with 294 additions and 391 deletions

View file

@ -253,12 +253,16 @@ static void CheckForUnsafeStates(PClassActor *obj)
if (obj->Size == RUNTIME_CLASS(AWeapon)->Size) return; // This class cannot have user variables.
test = weaponstates;
}
else if (obj->IsDescendantOf(RUNTIME_CLASS(ACustomInventory)))
else
{
if (obj->Size == RUNTIME_CLASS(ACustomInventory)->Size) return; // This class cannot have user variables.
test = pickupstates;
auto citype = PClass::FindActor(NAME_CustomInventory);
if (obj->IsDescendantOf(citype))
{
if (obj->Size == citype->Size) return; // This class cannot have user variables.
test = pickupstates;
}
else return; // something else derived from AStateProvider. We do not know what this may be.
}
else return; // something else derived from AStateProvider. We do not know what this may be.
for (; *test != NAME_None; test++)
{
@ -338,7 +342,7 @@ static void CheckStates(PClassActor *obj)
{
CheckStateLabels(obj, weaponstates, SUF_WEAPON, "weapon sprites");
}
else if (obj->IsDescendantOf(RUNTIME_CLASS(ACustomInventory)))
else if (obj->IsDescendantOf(PClass::FindActor(NAME_CustomInventory)))
{
CheckStateLabels(obj, pickupstates, SUF_ITEM, "CustomInventory state chain");
}

View file

@ -2464,7 +2464,12 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
PFunction *virtsym = nullptr;
if (cls != nullptr && cls->ParentClass != nullptr) virtsym = dyn_cast<PFunction>(cls->ParentClass->Symbols.FindSymbol(FName(f->Name), true));
unsigned vindex = ~0u;
if (virtsym != nullptr) vindex = virtsym->Variants[0].Implementation->VirtualIndex;
if (virtsym != nullptr)
{
auto imp = virtsym->Variants[0].Implementation;
if (imp != nullptr) vindex = imp->VirtualIndex;
else Error(f, "Virtual base function %s not found in %s", FName(f->Name).GetChars(), cls->ParentClass->TypeName.GetChars());
}
if (!(f->Flags & ZCC_Native))
{