SCI: Init the diff .#&$ EngineState::flags field in the constructor and when loading -- fixes many weird crashes upon loading (lesson to be learned: if you add fields to a class, then (a) init it in the construtor and (b) if the class support serializing, make sure the new field is handled when saving/loading :-)

svn-id: r40712
This commit is contained in:
Max Horn 2009-05-19 00:02:44 +00:00
parent 8add60bf8c
commit 091b347a7e
3 changed files with 10 additions and 6 deletions

View file

@ -251,7 +251,7 @@ void EngineState::saveLoadWithSerializer(Common::Serializer &s) {
s.syncAsSint32LE(savegame_version);
syncCStr(s, &game_version);
s.syncAsSint32LE(version);
s.skip(4); // Obsolete: Used to be version
// FIXME: Do in-place loading at some point, instead of creating a new EngineState instance from scratch.
if (s.isLoading()) {
@ -758,6 +758,9 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
// FIXME: Do in-place loading at some point, instead of creating a new EngineState instance from scratch.
retval = new EngineState();
retval->version = s->version;
retval->flags = s->flags;
retval->savegame_version = -1;
retval->gfx_state = s->gfx_state;