[Tux4kids-commits] r204 - tuxmath/trunk/src

tholy-guest at alioth.debian.org tholy-guest at alioth.debian.org
Mon Aug 20 12:06:05 UTC 2007


Author: tholy-guest
Date: 2007-08-20 12:06:04 +0000 (Mon, 20 Aug 2007)
New Revision: 204

Modified:
   tuxmath/trunk/src/options.c
   tuxmath/trunk/src/setup.c
Log:
Respect command-line switch --nosound by preventing options files from overwriting the use_sound option.


Modified: tuxmath/trunk/src/options.c
===================================================================
--- tuxmath/trunk/src/options.c	2007-08-20 11:34:14 UTC (rev 203)
+++ tuxmath/trunk/src/options.c	2007-08-20 12:06:04 UTC (rev 204)
@@ -430,7 +430,10 @@
 
 void Opts_SetUseSound(int val)
 {
-  game_options->use_sound = int_to_bool(val);
+  if (val == -1)
+    game_options->use_sound = val;
+  else if (game_options->use_sound != -1)
+    game_options->use_sound = int_to_bool(val);
 }
 
 
@@ -766,7 +769,7 @@
     fprintf(stderr, "\nOpts_UseSound(): game_options not valid!\n");
     return GAME_OPTS_INVALID;
   }
-  return game_options->use_sound;
+  return game_options->use_sound > 0;
 }
 
 
@@ -1089,7 +1092,7 @@
     fprintf(stderr, "\nOpts_UsingSound(): game_options not valid!\n");
     return GAME_OPTS_INVALID;
   }
-  return (game_options->use_sound && game_options->sound_hw_available);
+  return (game_options->use_sound>0 && game_options->sound_hw_available);
 }
 
 /********************************************************************/
@@ -1317,7 +1320,7 @@
   {
     fprintf (fp, "\n# Self-explanatory, default is 1:\n");
   }
-  fprintf(fp, "use_sound = %d\n", game_options->use_sound);
+  fprintf(fp, "use_sound = %d\n", game_options->use_sound>0);
 
   if(verbose)
   {

Modified: tuxmath/trunk/src/setup.c
===================================================================
--- tuxmath/trunk/src/setup.c	2007-08-20 11:34:14 UTC (rev 203)
+++ tuxmath/trunk/src/setup.c	2007-08-20 12:06:04 UTC (rev 204)
@@ -288,7 +288,7 @@
 	     strcmp(argv[i], "--quiet") == 0 ||
 	     strcmp(argv[i], "-q") == 0)
     {
-      Opts_SetUseSound(0);
+      Opts_SetUseSound(-1);  // prevent options files from overwriting
     }
     else if (strcmp(argv[i], "--version") == 0 ||
 	     strcmp(argv[i], "-v") == 0)




More information about the Tux4kids-commits mailing list