aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2016-01-30 02:29:52 +0100
committerMartin Kiewitz2016-01-30 02:29:52 +0100
commit125cec693f234a46e0386445c2e87b722597a8b9 (patch)
tree818b95f1850059d992f2eb414aab7bdaacf8566c
parent243c8612645e2dae2f4bbeb09d8e93e3960da5ff (diff)
downloadscummvm-rg350-125cec693f234a46e0386445c2e87b722597a8b9.tar.gz
scummvm-rg350-125cec693f234a46e0386445c2e87b722597a8b9.tar.bz2
scummvm-rg350-125cec693f234a46e0386445c2e87b722597a8b9.zip
AGI: do not allow load/save while in inner loop
load/saving via ScummVM menu Mixed up mother goose has an endless script loop, when no user name was entered, which means restoring while in there would result in us staying in the inner loop until the user entered something
-rw-r--r--engines/agi/detection.cpp32
1 files changed, 27 insertions, 5 deletions
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index 17358e0a40..641fe55a47 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -570,17 +570,39 @@ const ADGameDescription *AgiMetaEngine::fallbackDetect(const FileMap &allFilesXX
namespace Agi {
bool AgiBase::canLoadGameStateCurrently() {
- return (!(getGameType() == GType_PreAGI) && getflag(VM_FLAG_MENUS_WORK) && !_noSaveLoadAllowed);
+ if (!(getGameType() == GType_PreAGI)) {
+ if (getflag(VM_FLAG_MENUS_WORK)) {
+ if (!_noSaveLoadAllowed) {
+ if (!cycleInnerLoopIsActive()) {
+ // We can't allow to restore a game, while inner loop is active
+ // For example Mixed Up Mother Goose has an endless loop for user name input
+ // Which means even if we abort the inner loop, the game would keep on calling
+ // GetString() until something is entered. And this would of course also happen
+ // right after restoring a saved game.
+ return true;
+ }
+ }
+ }
+ }
+ return false;
}
bool AgiBase::canSaveGameStateCurrently() {
- bool promptEnabled = false;
-
if (getGameID() == GID_BC) // Technically in Black Cauldron we may save anytime
return true;
- promptEnabled = promptIsEnabled();
- return (!(getGameType() == GType_PreAGI) && getflag(VM_FLAG_MENUS_WORK) && !_noSaveLoadAllowed && promptEnabled);
+ if (!(getGameType() == GType_PreAGI)) {
+ if (getflag(VM_FLAG_MENUS_WORK)) {
+ if (!_noSaveLoadAllowed) {
+ if (!cycleInnerLoopIsActive()) {
+ if (promptIsEnabled()) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
}
int AgiEngine::agiDetectGame() {