From 6d6afda8835f996720cfc395fdb1e77daac3d473 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 1 Jun 2014 15:01:17 +0300 Subject: MADS: Properly set the scene revisited flag when loading a saved game --- engines/mads/game.cpp | 2 +- engines/mads/game_data.cpp | 14 +++++++++++++- engines/mads/game_data.h | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'engines/mads') diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index ed97dca746..ea87a1f4d1 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -477,7 +477,7 @@ void Game::synchronize(Common::Serializer &s, bool phase1) { _scene.synchronize(s); _objects.synchronize(s); - _visitedScenes.synchronize(s); + _visitedScenes.synchronize(s, _scene._nextSceneId); _player.synchronize(s); _screenObjects.synchronize(s); } else { diff --git a/engines/mads/game_data.cpp b/engines/mads/game_data.cpp index 0e2dcec70f..70e9e6c30b 100644 --- a/engines/mads/game_data.cpp +++ b/engines/mads/game_data.cpp @@ -46,9 +46,21 @@ bool VisitedScenes::exists(int sceneId) { return false; } -void VisitedScenes::synchronize(Common::Serializer &s) { +void VisitedScenes::synchronize(Common::Serializer &s, int sceneId) { SynchronizedList::synchronize(s); s.syncAsByte(_sceneRevisited); + + // If the scene hasn't been visited yet, remove it from the visited + // scenes list. It'll be readded to the list in add() above, from + // Game::sectionLoop() + if (s.isLoading() && !_sceneRevisited) { + for (uint i = 0; i < size(); ++i) { + if ((*this)[i] == sceneId) { + remove_at(i); + return; + } + } + } } } // End of namespace MADS diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h index f15cd1a8f0..65a9ae1553 100644 --- a/engines/mads/game_data.h +++ b/engines/mads/game_data.h @@ -52,7 +52,7 @@ public: /** * Synchronizes the list */ - void synchronize(Common::Serializer &s); + void synchronize(Common::Serializer &s, int sceneId); }; class SectionHandler { -- cgit v1.2.3