aboutsummaryrefslogtreecommitdiff
path: root/engines/wage
diff options
context:
space:
mode:
authorEugene Sandulenko2017-08-29 09:33:14 +0200
committerEugene Sandulenko2017-08-29 09:33:44 +0200
commitb5c552b3bb7f6cd18c493dc23b678135c86a12e7 (patch)
tree13b61bfc26f5120117aaf4d6d3a421cca3e84236 /engines/wage
parent58fb345b3e56feb6f05bee0385e115f47bc00b81 (diff)
downloadscummvm-rg350-b5c552b3bb7f6cd18c493dc23b678135c86a12e7.tar.gz
scummvm-rg350-b5c552b3bb7f6cd18c493dc23b678135c86a12e7.tar.bz2
scummvm-rg350-b5c552b3bb7f6cd18c493dc23b678135c86a12e7.zip
WAGE: Quit gracefully when requested
Diffstat (limited to 'engines/wage')
-rw-r--r--engines/wage/script.cpp2
-rw-r--r--engines/wage/wage.cpp8
-rw-r--r--engines/wage/wage.h4
3 files changed, 9 insertions, 5 deletions
diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp
index 3405c8bf47..bff75d06bd 100644
--- a/engines/wage/script.cpp
+++ b/engines/wage/script.cpp
@@ -165,7 +165,7 @@ bool Script::execute(World *world, int loopCount, Common::String *inputText, Des
}
_data->seek(12);
- while (_data->pos() < _data->size()) {
+ while (_data->pos() < _data->size() && !_engine->_shouldQuit) {
printLine(_data->pos());
byte command = _data->readByte();
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 7f9fb073f5..ce47e3ebea 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -123,6 +123,8 @@ Common::Error WageEngine::run() {
if (!_world->loadWorld(_resManager))
return Common::kNoGameDataFoundError;
+ _shouldQuit = false;
+
_gui = new Gui(this);
_temporarilyHidden = true;
@@ -140,8 +142,6 @@ Common::Error WageEngine::run() {
processTurn(&input, NULL);
_temporarilyHidden = false;
- _shouldQuit = false;
-
while (!_shouldQuit) {
_debugger->onFrame();
@@ -445,6 +445,10 @@ void WageEngine::processTurnInternal(Common::String *textInput, Designed *clickI
regen();
Common::String input("look");
processTurnInternal(&input, NULL);
+
+ if (_shouldQuit)
+ return;
+
redrawScene();
_temporarilyHidden = false;
} else if (_loopCount == 1) {
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index d2c97adfa0..51a6951d9f 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -192,6 +192,8 @@ public:
bool _isGameOver;
bool _commandWasQuick;
+ bool _shouldQuit;
+
Common::String _inputText;
void playSound(Common::String soundName);
@@ -234,8 +236,6 @@ private:
Common::MacResManager *_resManager;
- bool _shouldQuit;
-
Audio::SoundHandle _soundHandle;
};