aboutsummaryrefslogtreecommitdiff
path: root/engines/glk
diff options
context:
space:
mode:
authorPaul Gilbert2019-11-09 20:55:47 -0800
committerPaul Gilbert2019-11-11 18:20:30 -0800
commitf3b02a115fbacfffb76065df881d5cbaa28c17da (patch)
tree62adda057761e5bdcfe6470763858905314260fc /engines/glk
parentab5939ba443b31cbecb727825346a331a84856a7 (diff)
downloadscummvm-rg350-f3b02a115fbacfffb76065df881d5cbaa28c17da.tar.gz
scummvm-rg350-f3b02a115fbacfffb76065df881d5cbaa28c17da.tar.bz2
scummvm-rg350-f3b02a115fbacfffb76065df881d5cbaa28c17da.zip
GLK: ARCHETYPE: Cleaner exit when game is quit
Diffstat (limited to 'engines/glk')
-rw-r--r--engines/glk/archetype/archetype.cpp3
-rw-r--r--engines/glk/glk.cpp2
-rw-r--r--engines/glk/glk.h16
3 files changed, 18 insertions, 3 deletions
diff --git a/engines/glk/archetype/archetype.cpp b/engines/glk/archetype/archetype.cpp
index 395edd6753..f10fa06f0b 100644
--- a/engines/glk/archetype/archetype.cpp
+++ b/engines/glk/archetype/archetype.cpp
@@ -833,9 +833,8 @@ void Archetype::exec_stmt(StatementPtr the_stmt, ResultType &result, ContextType
if (the_stmt->_kind == ST_WRITE) {
g_vm->writeln();
} else if (the_stmt->_kind == ST_STOP) {
+ // End the game
g_vm->writeln();
- g_vm->writeln();
- g_vm->writeln("%f", VERSION_NUM);
g_vm->quitGame();
}
break;
diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp
index b546299cfa..5af9983ad9 100644
--- a/engines/glk/glk.cpp
+++ b/engines/glk/glk.cpp
@@ -46,7 +46,7 @@ namespace Glk {
GlkEngine *g_vm;
GlkEngine::GlkEngine(OSystem *syst, const GlkGameDescription &gameDesc) :
- _gameDescription(gameDesc), Engine(syst), _random("Glk"), _blorb(nullptr),
+ _gameDescription(gameDesc), Engine(syst), _random("Glk"), _quitFlag(false), _blorb(nullptr),
_clipboard(nullptr), _conf(nullptr), _debugger(nullptr), _events(nullptr), _pictures(nullptr),
_screen(nullptr), _selection(nullptr), _sounds(nullptr), _streams(nullptr), _windows(nullptr),
_copySelect(false), _terminated(false), _pcSpeaker(nullptr), _loadSaveSlot(-1),
diff --git a/engines/glk/glk.h b/engines/glk/glk.h
index 79e5425e81..8daa7ce5d7 100644
--- a/engines/glk/glk.h
+++ b/engines/glk/glk.h
@@ -80,6 +80,7 @@ protected:
int _loadSaveSlot;
Common::File _gameFile;
PCSpeaker *_pcSpeaker;
+ bool _quitFlag;
// Engine APIs
virtual Common::Error run();
@@ -241,6 +242,21 @@ public:
* Set a random number seed
*/
void setRandomNumberSeed(uint seed) { _random.setSeed(seed); }
+
+ /**
+ * Flags to quit the game
+ */
+ void quitGame() {
+ _quitFlag = true;
+ Engine::quitGame();
+ }
+
+ /**
+ * Returns true if the game should be quit
+ */
+ bool shouldQuit() const {
+ return _quitFlag || Engine::shouldQuit();
+ }
};
extern GlkEngine *g_vm;