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

Bolesław Kulbabiński bolekk-guest at alioth.debian.org
Sat Jun 27 12:00:04 UTC 2009


Author: bolekk-guest
Date: 2009-06-27 12:00:03 +0000 (Sat, 27 Jun 2009)
New Revision: 1098

Modified:
   tuxmath/trunk/src/globals.h
   tuxmath/trunk/src/options.c
   tuxmath/trunk/src/setup.c
Log:
moved debug constants' declarations into options.c to enable compilation of generate_lesson without any unnecessary includes

Modified: tuxmath/trunk/src/globals.h
===================================================================
--- tuxmath/trunk/src/globals.h	2009-06-26 23:34:30 UTC (rev 1097)
+++ tuxmath/trunk/src/globals.h	2009-06-27 12:00:03 UTC (rev 1098)
@@ -44,10 +44,10 @@
 #define tmdprintf(...) 0
 #endif
 
-/* debug data (declared in setup.c) */
+/* debug data (declared in options.c) */
 extern int debug_status;
 
-/* bitmasks for debugging options (declared in setup.c) */
+/* bitmasks for debugging options (declared in options.c) */
 extern const int debug_setup;
 extern const int debug_fileops;
 extern const int debug_loaders;
@@ -61,6 +61,7 @@
 extern const int debug_sdl;
 extern const int debug_lessons;
 extern const int debug_highscore;
+extern const int debug_options;
 extern const int debug_all;
 
 /* debug macros */

Modified: tuxmath/trunk/src/options.c
===================================================================
--- tuxmath/trunk/src/options.c	2009-06-26 23:34:30 UTC (rev 1097)
+++ tuxmath/trunk/src/options.c	2009-06-27 12:00:03 UTC (rev 1098)
@@ -13,7 +13,7 @@
 
   Part of "Tux4Kids" Project
   http://www.tux4kids.com
-      
+
   August 26, 2001 - July 11, 2007
 */
 
@@ -30,6 +30,7 @@
 #include "fileops.h"
 #include "setup.h"
 #include "game.h"
+#include "globals.h"
 //#include "tuxmath.h"
 
 /* FIXME figure out what oper_override is supposed to do and make sure */
@@ -37,6 +38,26 @@
 
 //int opers[NUM_OPERS], range_enabled[NUM_Q_RANGES];
 
+/* global debug masks */
+int debug_status;
+
+/* bitmasks for debugging options */
+const int debug_setup          = 1 << 0;
+const int debug_fileops        = 1 << 1;
+const int debug_loaders        = 1 << 2;
+const int debug_titlescreen    = 1 << 3;
+const int debug_menu           = 1 << 4;
+const int debug_menu_parser    = 1 << 5;
+const int debug_game           = 1 << 6;
+const int debug_factoroids     = 1 << 7;
+const int debug_lan            = 1 << 8;
+const int debug_mathcards      = 1 << 9;
+const int debug_sdl            = 1 << 10;
+const int debug_lessons        = 1 << 11;
+const int debug_highscore      = 1 << 12;
+const int debug_options        = 1 << 13;
+const int debug_all            = ~0;
+
 /* extern'd constants */
 
 const char* const OPTION_TEXT[NUM_GLOBAL_OPTS+1] = {
@@ -59,8 +80,8 @@
   0,
   1
 };
-  
 
+
 /* file scope only now that accessor functions used: */
 static game_option_type* game_options;
 static global_option_type* global_options;
@@ -124,9 +145,8 @@
   game_options->num_cities = DEFAULT_NUM_CITIES;   /* MUST BE AN EVEN NUMBER! */
   game_options->max_city_colors = DEFAULT_MAX_CITY_COLORS;
 
-  #ifdef TUXMATH_DEBUG
-  print_game_options(stdout, 0);
-  #endif
+  DEBUGCODE(debug_options)
+    print_game_options(stdout, 0);
 
   return 1;
 }
@@ -151,7 +171,7 @@
     if (0 == strcasecmp(text, OPTION_TEXT[i]) )
       return i;
   }
-  tmdprintf("'%s' isn't a global option\n", text);
+  DEBUGMSG(debug_options, "'%s' isn't a global option\n", text);
   return -1;
 }
 
@@ -167,8 +187,7 @@
 {
   if (index < NUM_GLOBAL_OPTS)
     return global_options->iopts[index];
-    
-  tmdprintf("Invalid global option index: %d\n", index);
+  DEBUGMSG(debug_options, "Invalid global option index: %d\n", index);
   return 0;
 }
 
@@ -184,7 +203,7 @@
   if (index < NUM_GLOBAL_OPTS)
     global_options->iopts[index] = val;
   else
-    tmdprintf("Invalid global option index: %d\n", index);
+    DEBUGMSG(debug_options, "Invalid global option index: %d\n", index);
 }
   
 

Modified: tuxmath/trunk/src/setup.c
===================================================================
--- tuxmath/trunk/src/setup.c	2009-06-26 23:34:30 UTC (rev 1097)
+++ tuxmath/trunk/src/setup.c	2009-06-27 12:00:03 UTC (rev 1098)
@@ -88,25 +88,6 @@
 Mix_Music* musics[NUM_MUSICS];
 #endif
 
-/* global debug masks */
-int debug_status;
-
-/* bitmasks for debugging options */
-const int debug_setup          = 1 << 0;
-const int debug_fileops        = 1 << 1;
-const int debug_loaders        = 1 << 2;
-const int debug_titlescreen    = 1 << 3;
-const int debug_menu           = 1 << 4;
-const int debug_menu_parser    = 1 << 5;
-const int debug_game           = 1 << 6;
-const int debug_factoroids     = 1 << 7;
-const int debug_lan            = 1 << 8;
-const int debug_mathcards      = 1 << 9;
-const int debug_sdl            = 1 << 10;
-const int debug_lessons        = 1 << 11;
-const int debug_highscore      = 1 << 12;
-const int debug_all            = ~0;
-
 /* Local function prototypes: */
 void initialize_options(void);
 void handle_command_args(int argc, char* argv[]);




More information about the Tux4kids-commits mailing list