diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/glk/archetype/archetype.cpp | 3 | ||||
-rw-r--r-- | engines/glk/glk.cpp | 2 | ||||
-rw-r--r-- | engines/glk/glk.h | 16 |
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; |