From 69c1f70818aaf83f97bf7131cdf9423c0a75027f Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sat, 29 Jul 2017 18:20:45 +0200 Subject: MOHAWK: Riven: Let the gameloop gracefully end when quitting Prevents the quit confirmation dialog from being displayed at the end of the game's ending if it is enabled. Fixes #9943. --- engines/mohawk/riven.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'engines/mohawk/riven.cpp') diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index d3f9e61d9f..59a41f5258 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -58,6 +58,7 @@ MohawkEngine_Riven::MohawkEngine_Riven(OSystem *syst, const MohawkGameDescriptio _showHotspots = false; _activatedPLST = false; _activatedSLST = false; + _gameEnded = false; _extrasFile = nullptr; _stack = nullptr; _gfx = nullptr; @@ -186,7 +187,7 @@ Common::Error MohawkEngine_Riven::run() { } - while (!shouldQuit()) + while (!hasGameEnded()) doFrame(); return Common::kNoError; @@ -424,7 +425,7 @@ Common::SeekableReadStream *MohawkEngine_Riven::getExtrasResource(uint32 tag, ui void MohawkEngine_Riven::delay(uint32 ms) { uint32 startTime = _system->getMillis(); - while (_system->getMillis() < startTime + ms && !shouldQuit()) { + while (_system->getMillis() < startTime + ms && !hasGameEnded()) { doFrame(); } } @@ -497,6 +498,14 @@ bool MohawkEngine_Riven::canSaveGameStateCurrently() { return canLoadGameStateCurrently(); } +bool MohawkEngine_Riven::hasGameEnded() const { + return _gameEnded || shouldQuit(); +} + +void MohawkEngine_Riven::setGameEnded() { + _gameEnded = true; +} + bool ZipMode::operator== (const ZipMode &z) const { return z.name == name && z.id == id; } -- cgit v1.2.3