From 96068d30d937c5529e730ac61fd1ba26f69d7706 Mon Sep 17 00:00:00 2001 From: Robert Špalek Date: Sun, 10 Jan 2010 01:25:37 +0000 Subject: Handle properly shouldQuit() svn-id: r47215 --- engines/draci/draci.cpp | 11 ++++++----- engines/draci/game.cpp | 4 ++-- engines/draci/game.h | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'engines') diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp index e098dc969e..ff3815ffb7 100644 --- a/engines/draci/draci.cpp +++ b/engines/draci/draci.cpp @@ -223,11 +223,6 @@ void DraciEngine::handleEvents() { while (_eventMan->pollEvent(event)) { switch (event.type) { - case Common::EVENT_QUIT: - case Common::EVENT_RTL: - _game->setQuit(true); - _script->endCurrentProgram(true); - break; case Common::EVENT_KEYDOWN: switch (event.kbd.keycode) { case Common::KEYCODE_RIGHT: @@ -310,6 +305,12 @@ void DraciEngine::handleEvents() { _mouse->handleEvent(event); } } + + // Handle EVENT_QUIT and EVENT_RTL. + if (shouldQuit()) { + _game->setQuit(true); + _script->endCurrentProgram(true); + } } DraciEngine::~DraciEngine() { diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 592863b12b..0e6c5e7b90 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -158,7 +158,7 @@ Game::Game(DraciEngine *vm) : _vm(vm), _walkingState(vm) { } void Game::start() { - while (!shouldQuit()) { + while (!gameShouldQuit()) { // Reset the flag allowing to run the scripts. _vm->_script->endCurrentProgram(false); @@ -453,7 +453,7 @@ void Game::advanceAnimationsAndTestLoopExit() { } // This returns true if we got a signal to quit the game - if (shouldQuit()) { + if (gameShouldQuit()) { setExitLoop(true); } diff --git a/engines/draci/game.h b/engines/draci/game.h index e2aa1dcced..cd1e5c5dd6 100644 --- a/engines/draci/game.h +++ b/engines/draci/game.h @@ -278,7 +278,7 @@ public: LoopStatus getLoopStatus() const { return _loopStatus; } LoopSubstatus getLoopSubstatus() const { return _loopSubstatus; } - bool shouldQuit() const { return _shouldQuit; } + bool gameShouldQuit() const { return _shouldQuit; } void setQuit(bool quit) { _shouldQuit = quit; } bool shouldExitLoop() const { return _shouldExitLoop; } void setExitLoop(bool exit) { _shouldExitLoop = exit; } -- cgit v1.2.3