[Scummvm-git-logs] scummvm master -> c4d2ce9e969acff6e41e2c4f7b1352c87e6645fe

dreammaster noreply at scummvm.org
Sat Aug 5 15:52:54 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c4d2ce9e96 SHERLOCK: RT: Sync sceneTripCounters on load/save


Commit: c4d2ce9e969acff6e41e2c4f7b1352c87e6645fe
    https://github.com/scummvm/scummvm/commit/c4d2ce9e969acff6e41e2c4f7b1352c87e6645fe
Author: PushmePullyu (127053144+PushmePullyu at users.noreply.github.com)
Date: 2023-08-05T08:52:51-07:00

Commit Message:
SHERLOCK: RT: Sync sceneTripCounters on load/save

Warning: This bumps the save version to 5.

Scripts can create triggers via TattooTalk::cmdSetSceneEntryFlag().
These will set a flag when a scene has been visited a specified number
of times and are stored in
Array<SceneTripEntry> TattooScene::_sceneTripCounters.

However, this array is neither reset nor synced when loading/saving.
As a result, savegames can be in a buggy/unwinnable state.

While previous savegames can still be loaded with this fix, they
will not be automatically repaired.

See #14435 for instructions to reproduce the bug.

Changed paths:
    engines/sherlock/saveload.h
    engines/sherlock/tattoo/tattoo_scene.cpp


diff --git a/engines/sherlock/saveload.h b/engines/sherlock/saveload.h
index 26ac804e801..1d3c57fd80d 100644
--- a/engines/sherlock/saveload.h
+++ b/engines/sherlock/saveload.h
@@ -35,7 +35,7 @@ namespace Sherlock {
 #define ONSCREEN_FILES_COUNT 5
 
 enum {
-	CURRENT_SAVEGAME_VERSION = 4,
+	CURRENT_SAVEGAME_VERSION = 5,
 	MINIMUM_SAVEGAME_VERSION = 4
 };
 
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp
index d56debfc4fb..f66828cad90 100644
--- a/engines/sherlock/tattoo/tattoo_scene.cpp
+++ b/engines/sherlock/tattoo/tattoo_scene.cpp
@@ -803,8 +803,22 @@ int TattooScene::findBgShape(const Common::Point &pt) {
 void TattooScene::synchronize(Serializer &s) {
 	TattooEngine &vm = *(TattooEngine *)_vm;
 	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
+	uint numSceneTripCounters = 0;
 	Scene::synchronize(s);
 
+	// Since save version 5: sync _sceneTripCounters
+	if (s.isSaving())
+		numSceneTripCounters = _sceneTripCounters.size();
+	s.syncAsUint32LE(numSceneTripCounters, 5);
+	if (s.isLoading())
+		_sceneTripCounters.resize(numSceneTripCounters);
+
+	for (auto &tripCounter : _sceneTripCounters) {
+		s.syncAsSint32LE(tripCounter._flag, 5);
+		s.syncAsSint32LE(tripCounter._sceneNumber, 5);
+		s.syncAsSint32LE(tripCounter._numTimes, 5);
+	}
+
 	if (s.isLoading()) {
 		// In case we were showing the intro prologue or the ending credits, stop them
 		vm._runningProlog = false;




More information about the Scummvm-git-logs mailing list