mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- SW: fixed some savegame issues:
* the saveable tables were initialized too late when reading in the actors. * the abort messages for the saveables did not show. We need to use I_FatalError here, plus some actor list modifications to make this work.
This commit is contained in:
parent
ae622274bd
commit
6db1ba47c2
4 changed files with 11 additions and 2 deletions
|
@ -664,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++)
|
||||
|
@ -680,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++;
|
||||
|
|
|
@ -142,6 +142,7 @@ static void RemoveActorStat(DCoreActor* actor)
|
|||
|
||||
auto prevp = prev ? &prev->nextStat : &firstEntry;
|
||||
auto nextp = next ? &next->prevStat : &lastEntry;
|
||||
if (*prevp == nullptr && *nextp == nullptr) return; // can happen during an aborted savegame load.
|
||||
|
||||
assert(*prevp == actor);
|
||||
assert(*nextp == actor);
|
||||
|
@ -285,6 +286,7 @@ static void RemoveActorSect(DCoreActor* actor)
|
|||
|
||||
auto prevp = prev ? &prev->nextSect : &firstEntry;
|
||||
auto nextp = next ? &next->prevSect : &lastEntry;
|
||||
if (*prevp == nullptr && *nextp == nullptr) return; // can happen during an aborted savegame load.
|
||||
assert(*prevp == actor);
|
||||
assert(*nextp == actor);
|
||||
|
||||
|
|
|
@ -1113,6 +1113,7 @@ void DSWActor::Serialize(FSerializer& arc)
|
|||
{
|
||||
Super::Serialize(arc);
|
||||
arc("hasuser", hasUser)
|
||||
("tempwall", tempwall)
|
||||
("owner", ownerActor);
|
||||
if (hasUser) arc("user", user); // only write if defined.
|
||||
}
|
||||
|
|
|
@ -140,6 +140,7 @@ int Saveable_RestoreCodeSym(savedcodesym *sym, void **ptr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
Saveable_Init();
|
||||
for (auto module : saveablemodules)
|
||||
{
|
||||
for (unsigned i = 0; i < module->numcode; i++)
|
||||
|
@ -151,7 +152,8 @@ int Saveable_RestoreCodeSym(savedcodesym *sym, void **ptr)
|
|||
}
|
||||
}
|
||||
}
|
||||
I_Error("Unknown code reference '%s' in savegame\n", sym->name.GetChars());
|
||||
// No way to recover. I_FatalError is the only chance to get an error message shown. :(
|
||||
I_FatalError("Unknown code reference '%s' in savegame\n", sym->name.GetChars());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -163,6 +165,7 @@ int Saveable_RestoreDataSym(saveddatasym *sym, void **ptr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
Saveable_Init();
|
||||
for (auto module : saveablemodules)
|
||||
{
|
||||
for (unsigned i = 0; i < module->numdata; i++)
|
||||
|
@ -174,7 +177,8 @@ int Saveable_RestoreDataSym(saveddatasym *sym, void **ptr)
|
|||
}
|
||||
}
|
||||
}
|
||||
I_Error("Unknown data reference '%s' in savegame\n", sym->name.GetChars());
|
||||
// No way to recover. I_FatalError is the only chance to get an error message shown. :(
|
||||
I_FatalError("Unknown data reference '%s' in savegame\n", sym->name.GetChars());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue