MADS: Properly set the scene revisited flag when loading a saved game

This commit is contained in:
Filippos Karapetis 2014-06-01 15:01:17 +03:00
parent 94160a28e3
commit 6d6afda883
3 changed files with 15 additions and 3 deletions

View File

@ -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 {

View File

@ -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

View File

@ -52,7 +52,7 @@ public:
/**
* Synchronizes the list
*/
void synchronize(Common::Serializer &s);
void synchronize(Common::Serializer &s, int sceneId);
};
class SectionHandler {