Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] (PR#12718) Add new client option for debug info
Home

[Freeciv-Dev] (PR#12718) Add new client option for debug info

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12718) Add new client option for debug info
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Tue, 5 Apr 2005 04:05:24 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12718 >

This patch adds a new client option to show debug info in the client. The
reason for this is that it is a bit much to require people who want to
write a modpack to recompile their client to get info such as x,y
coordinates and city IDs.

However, this should probably be combined with the civworld-in-client
idea.

  - Per

Index: client/options.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/options.c,v
retrieving revision 1.124
diff -u -r1.124 options.c
--- client/options.c    15 Feb 2005 16:40:40 -0000      1.124
+++ client/options.c    5 Apr 2005 11:03:01 -0000
@@ -74,6 +74,7 @@
 bool popup_new_cities = TRUE;
 bool keyboardless_goto = TRUE;
 bool show_task_icons = TRUE;
+bool debug_mode = FALSE;
 
 /* This option is currently set by the client - not by the user. */
 bool update_city_text_in_refresh_tile = TRUE;
@@ -198,7 +199,12 @@
                  COC_INTERFACE),
   GEN_BOOL_OPTION(popup_new_cities, N_("Pop up city dialog for new cities"),
                  N_("If this option is set then a newly-founded city will "
-                    "havce its city dialog popped up automatically."),
+                    "have its city dialog popped up automatically."),
+                 COC_INTERFACE),
+  GEN_BOOL_OPTION(debug_mode, N_("Show extra debug and modpack information"),
+                 N_("If this option is set then extra information will appear  
"
+                    "in various places that is relevant for debugging or for "
+                    "writing modpacks."),
                  COC_INTERFACE),
 };
 #undef GEN_INT_OPTION
Index: client/options.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/options.h,v
retrieving revision 1.48
diff -u -r1.48 options.h
--- client/options.h    9 Feb 2005 16:23:12 -0000       1.48
+++ client/options.h    5 Apr 2005 11:03:01 -0000
@@ -49,6 +49,7 @@
 extern bool update_city_text_in_refresh_tile;
 extern bool keyboardless_goto;
 extern bool show_task_icons;
+extern bool debug_mode;
 
 enum client_option_type {
   COT_BOOL,
Index: client/text.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/text.c,v
retrieving revision 1.31
diff -u -r1.31 text.c
--- client/text.c       5 Apr 2005 09:24:29 -0000       1.31
+++ client/text.c       5 Apr 2005 11:03:01 -0000
@@ -30,6 +30,7 @@
 
 #include "control.h"
 #include "goto.h"
+#include "options.h"
 #include "text.h"
 
 /*
@@ -145,10 +146,10 @@
      Q_("?city:Friendly(team)")};
   INIT;
 
-#ifdef DEBUG
-  add_line(_("Location: (%d, %d) [%d]"), 
-          ptile->x, ptile->y, ptile->continent); 
-#endif /*DEBUG*/
+  if (debug_mode) {
+    add_line(_("Location: (%d, %d) [%d]"), 
+            ptile->x, ptile->y, ptile->continent); 
+  }
   add_line(_("Terrain: %s"),  map_get_tile_info_text(ptile));
   add_line(_("Food/Prod/Trade: %s"),
           map_get_tile_fpt_text(ptile));
@@ -395,9 +396,9 @@
   }
 
   add_line("%s", get_nearest_city_text(pcity_near, pcity_near_dist));
-#ifdef DEBUG
-  add_line("Unit ID: %d", punit->id);
-#endif
+  if (debug_mode) {
+    add_line("Unit ID: %d", punit->id);
+  }
 
   RETURN;
 }
@@ -521,9 +522,9 @@
     } else {
       add_line(" ");
     }
-#ifdef DEBUG
-    add_line("(Unit ID %d)", punit->id);
-#endif
+    if (debug_mode) {
+      add_line("(Unit ID %d)", punit->id);
+    }
   } else {
     add("\n\n\n");
   }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12718) Add new client option for debug info, Per I. Mathisen <=