mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-11 21:10:50 +00:00
- immediately abort loading a savegame if object deserialization fails.
If the loader is allowed to go on, these objects will be linked into game structures and may do unpredictable things before the loader has a chance to abort at the end.
This commit is contained in:
parent
1bed1a9c79
commit
7c7f3f04ae
3 changed files with 4 additions and 0 deletions
|
@ -957,6 +957,8 @@ void G_SerializeLevel(FSerializer &arc, bool hubload)
|
|||
DThinker::DestroyAllThinkers();
|
||||
interpolator.ClearInterpolations();
|
||||
arc.ReadObjects(hubload);
|
||||
// If there have been object deserialization errors we must absolutely not continue here because scripted objects can do unpredictable things.
|
||||
if (arc.mObjectErrors) I_Error("Failed to load savegame");
|
||||
}
|
||||
|
||||
arc("multiplayer", multiplayer);
|
||||
|
|
|
@ -1007,6 +1007,7 @@ void FSerializer::ReadObjects(bool hubtravel)
|
|||
{
|
||||
Printf(TEXTCOLOR_RED "Failed to restore all objects in savegame\n");
|
||||
mErrors++;
|
||||
mObjectErrors++;
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
|
|
|
@ -179,6 +179,7 @@ public:
|
|||
}
|
||||
|
||||
int mErrors = 0;
|
||||
int mObjectErrors = 0;
|
||||
};
|
||||
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, bool &value, bool *defval);
|
||||
|
|
Loading…
Reference in a new issue