- let skip_super use the AActor assignment operator. The blanket memcpy it used was clobbering some data.

- moved the Finalize method from PClassActor to AActor. Now that defaults get their vtbl pointer initialized this will actually work.
This commit is contained in:
Christoph Oelckers 2017-02-07 18:12:38 +01:00
commit 776509e68a
10 changed files with 15 additions and 26 deletions

View file

@ -1155,7 +1155,7 @@ static void ParseActor(FScanner &sc, PNamespace *ns)
}
try
{
info->Finalize(bag.statedef);
GetDefaultByType(info)->Finalize(bag.statedef);
}
catch (CRecoverableError &err)
{

View file

@ -560,7 +560,7 @@ DEFINE_PROPERTY(skip_super, 0, Actor)
return;
}
memcpy ((void *)defaults, (void *)GetDefault<AActor>(), sizeof(AActor));
*defaults = *GetDefault<AActor>();
ResetBaggage (&bag, RUNTIME_CLASS(AActor));
}

View file

@ -2447,19 +2447,6 @@ void ZCCCompiler::CompileStates()
continue;
}
// Same here, hack in the DVMObject as they weren't in the list originally
// TODO: process them in a non hackish way obviously
if (c->Type()->bRuntimeClass == true && c->Type()->ParentClass->bRuntimeClass == false)
{
auto vmtype = static_cast<PClassActor *>(c->Type()->ParentClass);
if (vmtype->StateList == nullptr)
{
FStateDefinitions vmstates;
vmstates.MakeStateDefines(dyn_cast<PClassActor>(vmtype->ParentClass));
vmtype->Finalize(vmstates);
}
}
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));
@ -2658,7 +2645,7 @@ void ZCCCompiler::CompileStates()
}
try
{
static_cast<PClassActor *>(c->Type())->Finalize(statedef);
GetDefaultByType(c->Type())->Finalize(statedef);
}
catch (CRecoverableError &err)
{