[Scummvm-cvs-logs] SF.net SVN: scummvm:[35734] scummvm/trunk/engines/agi/preagi_troll.cpp

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Mon Jan 5 01:51:54 CET 2009


Revision: 35734
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35734&view=rev
Author:   mthreepwood
Date:     2009-01-05 00:51:54 +0000 (Mon, 05 Jan 2009)

Log Message:
-----------
fix infinite loop when trying to quit in Troll's Tale

Modified Paths:
--------------
    scummvm/trunk/engines/agi/preagi_troll.cpp

Modified: scummvm/trunk/engines/agi/preagi_troll.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_troll.cpp	2009-01-04 20:37:24 UTC (rev 35733)
+++ scummvm/trunk/engines/agi/preagi_troll.cpp	2009-01-05 00:51:54 UTC (rev 35734)
@@ -203,7 +203,7 @@
 	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 @@
 		_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::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 @@
 	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::run() {
-	while (1) {
+	while (!_vm->shouldQuit()) {
 		intro();
-
 		gameLoop();
-
 		gameOver();
 	}
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list