- resorted some of thingdef.cpp's contents into more appropriate files.

- split FinishActor into several functions. While DECORATE can, ZSCRIPT cannot do all this in one go.
- split the state finalization into several class-specific virtual functions.
This commit is contained in:
Christoph Oelckers 2016-10-12 20:42:41 +02:00
parent b1a83bfd26
commit 59ed26c0b6
10 changed files with 286 additions and 220 deletions

View file

@ -69,6 +69,10 @@ void ZCCCompiler::ProcessClass(ZCC_Class *cnode, PSymbolTreeNode *treenode)
name << "nodes - " << FName(cnode->NodeName);
cls->TreeNodes.SetName(name);
if (!static_cast<PClassActor *>(cnode->Type)->SetReplacement(cnode->Replaces->Id))
{
Warn(cnode, "Replaced type '%s' not found for %s", FName(cnode->Replaces->Id).GetChars(), cnode->Type->TypeName.GetChars());
}
// Need to check if the class actually has a body.
if (node != nullptr) do
@ -1836,6 +1840,10 @@ void ZCCCompiler::InitDefaults()
content = static_cast<decltype(content)>(content->SiblingNext);
} while (content != d->Content);
}
if (bag.DropItemSet)
{
bag.Info->SetDropItems(bag.DropItemList);
}
}
}
}
@ -2239,5 +2247,13 @@ void ZCCCompiler::CompileStates()
st = static_cast<decltype(st)>(st->SiblingNext);
} while (st != s->Body);
}
try
{
static_cast<PClassActor *>(c->Type())->Finalize(statedef);
}
catch (CRecoverableError &err)
{
Error(c->cls, "%s", err.GetMessage());
}
}
}