diff options
author | Matthew Hoops | 2009-01-05 00:51:54 +0000 |
---|---|---|
committer | Matthew Hoops | 2009-01-05 00:51:54 +0000 |
commit | 6e434271fbd8d460dfbde9366294eaf98ac2a698 (patch) | |
tree | 74e1903cee2184da6e1a0a3e405d7f1f6c6aca20 /engines/agi | |
parent | 5ac9de093832a9d3a680ec3681a7f58107ba7114 (diff) | |
download | scummvm-rg350-6e434271fbd8d460dfbde9366294eaf98ac2a698.tar.gz scummvm-rg350-6e434271fbd8d460dfbde9366294eaf98ac2a698.tar.bz2 scummvm-rg350-6e434271fbd8d460dfbde9366294eaf98ac2a698.zip |
fix infinite loop when trying to quit in Troll's Tale
svn-id: r35734
Diffstat (limited to 'engines/agi')
-rw-r--r-- | engines/agi/preagi_troll.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp index 1806c35662..f6d3fffd24 100644 --- a/engines/agi/preagi_troll.cpp +++ b/engines/agi/preagi_troll.cpp @@ -203,7 +203,7 @@ void Troll::waitAnyKeyIntro() { Common::Event event; int iMsg = 0; - for (;;) { + while (!_vm->shouldQuit()) { while (_vm->_system->getEventManager()->pollEvent(event)) { switch(event.type) { case Common::EVENT_RTL: @@ -280,7 +280,7 @@ void Troll::tutorial() { _vm->setDefaultTextColor(0x0F); done = false; - while (!done) { + while (!done && !_vm->shouldQuit()) { getMenuSel(IDS_TRO_TUTORIAL_1, &iSel, IDI_TRO_MAX_OPTION); switch(iSel) { case IDI_TRO_SEL_OPTION_1: @@ -386,6 +386,11 @@ void Troll::intro() { } void Troll::gameOver() { + // We do a check to see if the game should quit. Without this, the game show the picture, plays the + // music, and then quits. So if the game is quitting, we shouldn't run the "game over" part. + if (_vm->shouldQuit()) + return; + char szMoves[40]; _vm->clearTextArea(); @@ -560,8 +565,8 @@ void Troll::gameLoop() { memset(_roomStates, 0, sizeof(_roomStates)); memset(_inventory, 0, sizeof(_inventory)); - - while (!done) { + + while (!done && !_vm->shouldQuit()) { *menu = 0; currentOption = 0; @@ -765,11 +770,9 @@ void Troll::init() { } void Troll::run() { - while (1) { + while (!_vm->shouldQuit()) { intro(); - gameLoop(); - gameOver(); } } |