Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2005:
[Freeciv-Dev] (PR#13820) redraw overview when changing overview options
Home

[Freeciv-Dev] (PR#13820) redraw overview when changing overview options

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13820) redraw overview when changing overview options
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 30 Aug 2005 11:33:06 -0700
Reply-to: bugs@xxxxxxxxxxx

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

When you change the overview options the overview isn't redrawn 
automatically.  This patch fixes it.

-jason

Index: client/options.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/options.c,v
retrieving revision 1.141
diff -p -u -r1.141 options.c
--- client/options.c    25 Aug 2005 19:26:36 -0000      1.141
+++ client/options.c    30 Aug 2005 18:32:13 -0000
@@ -223,26 +223,29 @@ static client_option common_options[] = 
                  N_("Background layer"),
                  N_("The background layer of the overview shows just "
                     "ocean and land."), COC_OVERVIEW),
-  GEN_BOOL_OPTION(overview.layers[OLAYER_RELIEF],
-                 N_("Terrain relief map layer"),
-                 N_("The relief layer shows all terrains on the map."),
-                 COC_OVERVIEW),
-  GEN_BOOL_OPTION(overview.layers[OLAYER_BORDERS],
-                 N_("Borders layer"),
-                 N_("The borders layer of the overview shows which tiles "
-                    "are owned by each player."), COC_OVERVIEW),
-  GEN_BOOL_OPTION(overview.layers[OLAYER_UNITS],
-                 N_("Units layer"),
-                 N_("If enabled then units will be drawn on the overview."),
-                 COC_OVERVIEW),
-  GEN_BOOL_OPTION(overview.layers[OLAYER_CITIES],
-                 N_("Cities layer"),
-                 N_("If enabled then cities will be drawn on the overview."),
-                 COC_OVERVIEW),
-  GEN_BOOL_OPTION(overview.fog,
-                 N_("Overview fog of war"),
-                 N_("If enabled, fog of war is shown on the overview."),
-                 COC_OVERVIEW)
+  GEN_BOOL_OPTION_CB(overview.layers[OLAYER_RELIEF],
+                    N_("Terrain relief map layer"),
+                    N_("The relief layer shows all terrains on the map."),
+                    COC_OVERVIEW, overview_redraw_callback),
+  GEN_BOOL_OPTION_CB(overview.layers[OLAYER_BORDERS],
+                    N_("Borders layer"),
+                    N_("The borders layer of the overview shows which tiles "
+                       "are owned by each player."),
+                    COC_OVERVIEW, overview_redraw_callback),
+  GEN_BOOL_OPTION_CB(overview.layers[OLAYER_UNITS],
+                    N_("Units layer"),
+                    N_("If enabled then units will be "
+                       "drawn on the overview."),
+                    COC_OVERVIEW, overview_redraw_callback),
+  GEN_BOOL_OPTION_CB(overview.layers[OLAYER_CITIES],
+                    N_("Cities layer"),
+                    N_("If enabled then cities will be "
+                       "drawn on the overview."),
+                    COC_OVERVIEW, overview_redraw_callback),
+  GEN_BOOL_OPTION_CB(overview.fog,
+                    N_("Overview fog of war"),
+                    N_("If enabled, fog of war is shown on the overview."),
+                    COC_OVERVIEW, overview_redraw_callback)
 };
 #undef GEN_INT_OPTION
 #undef GEN_BOOL_OPTION
Index: client/overview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/overview_common.c,v
retrieving revision 1.17
diff -p -u -r1.17 overview_common.c
--- client/overview_common.c    29 Aug 2005 13:56:49 -0000      1.17
+++ client/overview_common.c    30 Aug 2005 18:32:13 -0000
@@ -454,3 +454,14 @@ void calculate_overview_dimensions(void)
 
   recursion--;
 }
+
+/****************************************************************************
+  Callback to be called when an overview option is changed.
+****************************************************************************/
+void overview_redraw_callback(struct client_option *option)
+{
+  /* This is called once for each option changed so it is slower than
+   * necessary.  If this becomes a problem it could be switched to use a
+   * queue system like the mapview drawing code does. */
+  refresh_overview_canvas();
+}
Index: client/overview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/overview_common.h,v
retrieving revision 1.7
diff -p -u -r1.7 overview_common.h
--- client/overview_common.h    2 Aug 2005 02:40:58 -0000       1.7
+++ client/overview_common.h    30 Aug 2005 18:32:13 -0000
@@ -18,6 +18,8 @@
 
 #include "canvas_g.h"
 
+#include "options.h"
+
 enum overview_layers {
   OLAYER_BACKGROUND,
   OLAYER_RELIEF,
@@ -66,4 +68,6 @@ void center_tile_overviewcanvas(void);
 
 void flush_dirty_overview(void);
 
+void overview_redraw_callback(struct client_option *option);
+
 #endif /* FC__OVERVIEW_COMMON_H */

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13820) redraw overview when changing overview options, Jason Short <=