[Scummvm-cvs-logs] CVS: scummvm/common gameDetector.cpp,1.116,1.117

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Thu Jul 3 23:55:16 CEST 2003


Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1:/tmp/cvs-serv5652/common

Modified Files:
	gameDetector.cpp 
Log Message:
Allow "no-" prefix to long command-line options, e.g. --no-aspect-ratio,
to invert their meanings. This is useful for overriding settings in the
config file.


Index: gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/gameDetector.cpp,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -d -r1.116 -r1.117
--- gameDetector.cpp	3 Jul 2003 22:06:13 -0000	1.116
+++ gameDetector.cpp	4 Jul 2003 06:54:47 -0000	1.117
@@ -83,6 +83,9 @@
 	"\t--multi-midi   - enable combination Adlib and native MIDI\n"
 	"\t--native-mt32  - true Roland MT-32 (disable GM emulation)\n"
 	"\t--aspect-ratio - enable aspect ratio correction\n"
+	"\n"
+	"The meaning of long options can be inverted by prefixing them with \"no-\",\n"
+	"e.g. \"--no-aspect-ratio\".\n"
 ;
 #endif
 // This contains a pointer to a list of all supported games.
@@ -312,6 +315,7 @@
 	char *current_option = NULL;
 	char *option = NULL;
 	char c;
+	bool long_option_value;
 	_save_slot = -1;
 
 	// Parse the arguments
@@ -451,15 +455,20 @@
 				exit(1);
 			case '-':
 				// Long options. Let the fun begin!
+				if (!strncmp(s, "no-", 3)) {
+					long_option_value = false;
+					s += 3;
+				} else
+					long_option_value = true;
 				if (!strcmp (s, "multi-midi")) {
-					_multi_midi = true;
-					g_config->setBool ("multi_midi", true);
+					_multi_midi = long_option_value;
+					g_config->setBool ("multi_midi", _multi_midi);
 				} else if (!strcmp (s, "native-mt32")) {
-					_native_mt32 = true;
-					g_config->setBool ("native_mt32", true);
+					_native_mt32 = long_option_value;
+					g_config->setBool ("native_mt32", _native_mt32);
 				} else if (!strcmp (s, "aspect-ratio")) {
-					_aspectRatio = true;
-					g_config->setBool ("aspect_ratio", true);
+					_aspectRatio = long_option_value;
+					g_config->setBool ("aspect_ratio", _aspectRatio);
 				} else {
 					goto ShowHelpAndExit;
 				}





More information about the Scummvm-git-logs mailing list