Skip to content

Commit

Permalink
WAGE: Graceful engine quitting
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Jan 3, 2016
1 parent d66c3a2 commit 562355e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions engines/wage/wage.cpp
Expand Up @@ -78,13 +78,18 @@ WageEngine::WageEngine(OSystem *syst, const ADGameDescription *desc) : Engine(sy

_commandWasQuick = false;

_shouldQuit = false;

debug("WageEngine::WageEngine()");
}

WageEngine::~WageEngine() {
debug("WageEngine::~WageEngine()");

DebugMan.clearAllDebugChannels();
delete _world;
delete _resManager;
delete _gui;
delete _rnd;
}

Expand Down Expand Up @@ -113,7 +118,9 @@ Common::Error WageEngine::run() {
processTurn(&input, NULL);
_temporarilyHidden = false;

while (true) {
_shouldQuit = false;

while (!_shouldQuit) {
processEvents();

_gui->draw();
Expand All @@ -138,7 +145,7 @@ void WageEngine::processEvents() {
while (_eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_QUIT:
error("Exiting");
_shouldQuit = true;
break;
case Common::EVENT_MOUSEMOVE:
_gui->mouseMove(event.mouse.x, event.mouse.y);
Expand Down
1 change: 1 addition & 0 deletions engines/wage/wage.h
Expand Up @@ -163,6 +163,7 @@ class WageEngine : public Engine {

bool _commandWasQuick;

bool _shouldQuit;
};

// Example console class
Expand Down

0 comments on commit 562355e

Please sign in to comment.