- Backend update from Raze.

This is mainly code cleanup from setting the compiler to a stricter warning level.
This commit is contained in:
Christoph Oelckers 2021-12-29 10:25:31 +01:00
commit 1c517d19fa
102 changed files with 493 additions and 590 deletions

View file

@ -290,6 +290,28 @@ bool FSerializer::BeginObject(const char *name)
//
//==========================================================================
bool FSerializer::HasObject(const char* name)
{
if (isReading())
{
auto val = r->FindKey(name);
if (val != nullptr)
{
if (val->IsObject())
{
return true;
}
}
}
return false;
}
//==========================================================================
//
//
//
//==========================================================================
void FSerializer::EndObject()
{
if (isWriting())
@ -619,7 +641,6 @@ void FSerializer::ReadObjects(bool hubtravel)
if (BeginObject(nullptr))
{
FString clsname; // do not deserialize the class type directly so that we can print appropriate errors.
int pindex = -1;
Serialize(*this, "classtype", clsname, nullptr);
PClass *cls = PClass::FindClass(clsname);
@ -643,6 +664,7 @@ void FSerializer::ReadObjects(bool hubtravel)
if (!founderrors)
{
// Reset to start;
unsigned size = r->mObjects.Size();
r->mObjects.Last().mIndex = 0;
for (unsigned i = 0; i < r->mDObjects.Size(); i++)
@ -652,7 +674,6 @@ void FSerializer::ReadObjects(bool hubtravel)
{
if (obj != nullptr)
{
int pindex = -1;
try
{
obj->SerializeUserVars(*this);
@ -660,6 +681,7 @@ void FSerializer::ReadObjects(bool hubtravel)
}
catch (CRecoverableError &err)
{
r->mObjects.Clamp(size); // close all inner objects.
// In case something in here throws an error, let's continue and deal with it later.
Printf(TEXTCOLOR_RED "'%s'\n while restoring %s\n", err.GetMessage(), obj ? obj->GetClass()->TypeName.GetChars() : "invalid object");
mErrors++;