[Scummvm-git-logs] scummvm master -> 01302b7473241f29a3bd58c0ca939c338cc99cb5

mgerhardy martin.gerhardy at gmail.com
Sat Jan 9 09:11:17 UTC 2021


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

Summary:
fded279bc7 TWINE: use gamestateflag method to access the data
01302b7473 TWINE: debug output for gamestateflags


Commit: fded279bc7a937f380e3a998de7daf8b37f7b977
    https://github.com/scummvm/scummvm/commit/fded279bc7a937f380e3a998de7daf8b37f7b977
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-09T10:05:27+01:00

Commit Message:
TWINE: use gamestateflag method to access the data

Changed paths:
    engines/twine/scene/gamestate.cpp


diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index 35483990a0..6df3d4fca2 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -226,7 +226,9 @@ bool GameState::saveGame(Common::WriteStream *file) {
 	file->writeString(playerName);
 	file->writeByte('\0');
 	file->writeByte(NUM_GAME_FLAGS);
-	file->write(_gameStateFlags, NUM_GAME_FLAGS);
+	for (uint8 i = 0; i < NUM_GAME_FLAGS; ++i) {
+		file->writeByte(hasGameFlag(i));
+	}
 	file->writeByte(_engine->_scene->currentSceneIdx);
 	file->writeByte(gameChapter);
 	file->writeByte((byte)_engine->_actor->heroBehaviour);


Commit: 01302b7473241f29a3bd58c0ca939c338cc99cb5
    https://github.com/scummvm/scummvm/commit/01302b7473241f29a3bd58c0ca939c338cc99cb5
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-09T10:10:45+01:00

Commit Message:
TWINE: debug output for gamestateflags

Changed paths:
    engines/twine/scene/gamestate.cpp
    engines/twine/scene/gamestate.h


diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index 6df3d4fca2..c401dcc7d3 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -50,7 +50,7 @@
 namespace TwinE {
 
 GameState::GameState(TwinEEngine *engine) : _engine(engine) {
-	Common::fill(&_gameStateFlags[0], &_gameStateFlags[NUM_GAME_FLAGS], 0);
+	clearGameFlags();
 	Common::fill(&inventoryFlags[0], &inventoryFlags[NUM_INVENTORY_ITEMS], 0);
 	Common::fill(&holomapFlags[0], &holomapFlags[NUM_LOCATIONS], 0);
 	playerName[0] = '\0';
@@ -75,7 +75,7 @@ void GameState::initGameStateVars() {
 		_engine->_scene->sceneFlags[i] = 0;
 	}
 
-	Common::fill(&_gameStateFlags[0], &_gameStateFlags[NUM_GAME_FLAGS], 0);
+	clearGameFlags();
 	Common::fill(&inventoryFlags[0], &inventoryFlags[NUM_INVENTORY_ITEMS], 0);
 
 	_engine->_scene->initSceneVars();
diff --git a/engines/twine/scene/gamestate.h b/engines/twine/scene/gamestate.h
index fd5c7d8ac2..78ebb5535d 100644
--- a/engines/twine/scene/gamestate.h
+++ b/engines/twine/scene/gamestate.h
@@ -135,13 +135,19 @@ public:
 		setGameFlag(item, 0);
 	}
 
+	void clearGameFlags() {
+		debug(2, "Clear all gameStateFlags");
+		Common::fill(&_gameStateFlags[0], &_gameStateFlags[NUM_GAME_FLAGS], 0);
+	}
+
 	inline uint8 hasGameFlag(uint8 index) const {
+		debug(3, "Query gameStateFlags[%u]=%u", index, _gameStateFlags[index]);
 		return _gameStateFlags[index];
 	}
 
 	inline void setGameFlag(uint8 index, uint8 value) {
-		_gameStateFlags[index] = value;
 		debug(2, "Set gameStateFlags[%u]=%u", index, value);
+		_gameStateFlags[index] = value;
 	}
 
 	/**




More information about the Scummvm-git-logs mailing list