[Scummvm-cvs-logs] CVS: scummvm/gui launcher.cpp,1.97,1.98 message.cpp,1.19,1.20 message.h,1.13,1.14

Max Horn fingolfin at users.sourceforge.net
Wed Aug 11 14:51:07 CEST 2004


Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27413/gui

Modified Files:
	launcher.cpp message.cpp message.h 
Log Message:
Fix for bug #1007093 (GUI: removing game configuration from Launcher buggy); moral: either document how things work, or at least provide well named constants for certain return values... using the cheap way out here, i.e. method (b) :-)

Index: launcher.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/launcher.cpp,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- launcher.cpp	26 Jul 2004 18:11:55 -0000	1.97
+++ launcher.cpp	11 Aug 2004 21:49:57 -0000	1.98
@@ -581,7 +581,7 @@
 void LauncherDialog::removeGame(int item) {
 	MessageDialog alert("Do you really want to remove this game configuration?", "Yes", "No");
 	
-	if (alert.runModal() > 0) {
+	if (alert.runModal() == GUI::kMessageOK) {
 		// Remove the currently selected game from the list
 		assert(item >= 0);
 		ConfMan.removeGameDomain(_domains[item]);

Index: message.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/message.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- message.cpp	5 Feb 2004 11:59:05 -0000	1.19
+++ message.cpp	11 Aug 2004 21:49:57 -0000	1.20
@@ -142,11 +142,12 @@
 }
 
 void MessageDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+	// FIXME: It's a really bad thing that we use two arbitrary constants 
 	if (cmd == kOkCmd) {
-		setResult(1);
+		setResult(kMessageOK);
 		close();
 	} else if (cmd == kCancelCmd) {
-		setResult(2);
+		setResult(kMessageCancel);
 		close();
 	} else {
 		Dialog::handleCommand(sender, cmd, data);

Index: message.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/message.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- message.h	5 Feb 2004 00:19:54 -0000	1.13
+++ message.h	11 Aug 2004 21:49:57 -0000	1.14
@@ -26,6 +26,12 @@
 
 namespace GUI {
 
+enum {
+	kMessageOK = 1,
+	kMessageCancel = 0
+};
+
+
 /**
  * Simple message dialog ("alert box"): presents a text message in a dialog with up to two buttons.
  */





More information about the Scummvm-git-logs mailing list