[Scummvm-git-logs] scummvm master -> 75d0456722b48679163aaf68ace7a41e669fff9a

dreammaster paulfgilbert at gmail.com
Tue Jul 14 02:34:47 UTC 2020


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:
75d0456722 GLK: Only allow GMM saves when sub-engines are waiting for input


Commit: 75d0456722b48679163aaf68ace7a41e669fff9a
    https://github.com/scummvm/scummvm/commit/75d0456722b48679163aaf68ace7a41e669fff9a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-07-13T19:32:37-07:00

Commit Message:
GLK: Only allow GMM saves when sub-engines are waiting for input

This avoids any issues from people trying to load or save
when their game is in the middle of a cutscene

Changed paths:
    engines/glk/glk.cpp
    engines/glk/glk.h
    engines/glk/quest/quest.h


diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp
index 673f28c78f..60a9753c32 100644
--- a/engines/glk/glk.cpp
+++ b/engines/glk/glk.cpp
@@ -159,6 +159,18 @@ Common::Error GlkEngine::run() {
 	return Common::kNoError;
 }
 
+bool GlkEngine::canLoadGameStateCurrently() {
+	// Only allow savegames by default when sub-engines are waiting for a line
+	Window *win = _windows->getFocusWindow();
+	return win && (win->_lineRequest || win->_lineRequestUni);
+}
+
+bool GlkEngine::canSaveGameStateCurrently() {
+	// Only allow savegames by default when sub-engines are waiting for a line
+	Window *win = _windows->getFocusWindow();
+	return win && (win->_lineRequest || win->_lineRequestUni);
+}
+
 Common::Error GlkEngine::loadGame() {
 	frefid_t ref = _streams->createByPrompt(fileusage_BinaryMode | fileusage_SavedGame,
 		filemode_Read, 0);
diff --git a/engines/glk/glk.h b/engines/glk/glk.h
index df85953bb3..dae30548ad 100644
--- a/engines/glk/glk.h
+++ b/engines/glk/glk.h
@@ -146,16 +146,12 @@ public:
 	/**
 	 * Returns true if a savegame can be loaded
 	 */
-	bool canLoadGameStateCurrently() override {
-		return true;
-	}
+	bool canLoadGameStateCurrently() override;
 
 	/**
 	 * Returns true if the game can be saved
 	 */
-	bool canSaveGameStateCurrently() override {
-		return true;
-	}
+	bool canSaveGameStateCurrently() override;
 
 	/**
 	 * Returns the language
diff --git a/engines/glk/quest/quest.h b/engines/glk/quest/quest.h
index 7304597d2c..588d9a7216 100644
--- a/engines/glk/quest/quest.h
+++ b/engines/glk/quest/quest.h
@@ -78,14 +78,14 @@ public:
 	 * Returns true if a savegame can be loaded
 	 */
 	bool canLoadGameStateCurrently() override {
-		return _runner != nullptr;
+		return _runner != nullptr && GlkAPI::canLoadGameStateCurrently();
 	}
 
 	/**
 	 * Returns true if the game can be saved
 	 */
 	bool canSaveGameStateCurrently() override {
-		return _runner != nullptr;
+		return _runner != nullptr && GlkAPI::canLoadGameStateCurrently();
 	}
 
 	/**




More information about the Scummvm-git-logs mailing list