[Scummvm-cvs-logs] CVS: scummvm/scumm scummvm.cpp,2.226,2.227 scumm.h,1.246,1.247 dialogs.cpp,1.53,1.54

Max Horn fingolfin at users.sourceforge.net
Sun Jun 8 05:12:04 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv8456/scumm

Modified Files:
	scummvm.cpp scumm.h dialogs.cpp 
Log Message:
added quit event

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.226
retrieving revision 2.227
diff -u -d -r2.226 -r2.227
--- scummvm.cpp	7 Jun 2003 14:02:07 -0000	2.226
+++ scummvm.cpp	8 Jun 2003 12:11:13 -0000	2.227
@@ -231,16 +231,14 @@
 	_objs = NULL;
 	_debugger = NULL;
 	_bundle = NULL;
-	_sound= NULL;
+	_sound = NULL;
 	memset(&res, 0, sizeof(res));
 	memset(&vm, 0, sizeof(vm));
 	_smushFrameRate = 0;
-	_insaneState = 0;
-	_videoFinished = 0;
-	_smushPlay = 0;
-#ifdef __PALM_OS__
+	_insaneState = false;
+	_videoFinished = false;
+	_smushPlay = false;
 	_quit = false;
-#endif
 	_newgui = NULL;
 	_pauseDialog = NULL;
 	_optionsDialog = NULL;
@@ -249,7 +247,7 @@
 	_fastMode = 0;
 	memset(&_rnd, 0, sizeof(RandomSource));
 	_gameId = 0;
-	memset(&gdi,0,sizeof(Gdi));
+	memset(&gdi, 0, sizeof(Gdi));
 	_actors = NULL;
 	_inventory = NULL;
 	_newNames = NULL;
@@ -1878,8 +1876,7 @@
 }
 
 void Scumm::shutDown() {
-	// FIXME: This is ugly
-	_system->quit();
+	_quit = true;
 }
 
 void Scumm::restart() {
@@ -2342,6 +2339,10 @@
 			_rightBtnPressed &= ~msDown;
 			break;
 		
+		case OSystem::EVENT_QUIT:
+			_quit = true;
+			break;
+		
 		default:
 			break;
 		}
@@ -2403,11 +2404,8 @@
 	int delta = 0;
 	int diff = _system->get_msecs();
 
-	for (;;) {
-#ifdef __PALM_OS__
-	if (_quit)	// palmfixme : need to check for autosave on exit
-		return;
-#endif
+	while (!_quit) {
+
 		updatePalette();
 		_system->update_screen();		
 
@@ -2418,6 +2416,11 @@
 
 		if (delta < 1)	// Ensure we don't get into a loop
 			delta = 1;  // by not decreasing sleepers.
+
+		if (_quit) {
+			// TODO: Maybe perform an autosave on exit?
+			// TODO: Also, we could optionally show a "Do you really want to quit?" dialog here
+		}
 	}
 }
 

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.246
retrieving revision 1.247
diff -u -d -r1.246 -r1.247
--- scumm.h	6 Jun 2003 23:55:00 -0000	1.246
+++ scumm.h	8 Jun 2003 12:11:13 -0000	1.247
@@ -354,9 +354,9 @@
 	void shutDown();
 	void setOptions(void);
 
-#ifdef __PALM_OS__
-	bool _quit;		// try to exit properly
-#endif
+	/** We keep running until this is set to true. */
+	bool _quit;
+
 	// GUI
 	NewGui *_newgui;
 

Index: dialogs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- dialogs.cpp	7 Jun 2003 00:49:35 -0000	1.53
+++ dialogs.cpp	8 Jun 2003 12:11:14 -0000	1.54
@@ -298,10 +298,8 @@
 		_scumm->optionsDialog();
 		break;
 	case kQuitCmd:
-#ifdef __PALM_OS__
+		_scumm->_quit = true;
 		close();
-#endif
-		_scumm->_system->quit();
 		break;
 	default:
 		ScummDialog::handleCommand(sender, cmd, data);





More information about the Scummvm-git-logs mailing list