Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2004:
[Freeciv-Dev] Re: (PR#7385) overview isn't updated
Home

[Freeciv-Dev] Re: (PR#7385) overview isn't updated

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7385) overview isn't updated
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Tue, 10 Feb 2004 11:09:07 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7385 >

On Mon, Feb 09, 2004 at 02:08:27AM -0800, Raimar Falke wrote:
> Alternative suggestions:
>  - a flag which is set every time the overview (backing store) is
>  updated and cleared when the backing store is copied to the screen

Untested patch for this attached.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "It is not yet possible to change operating system by writing
  to /proc/sys/kernel/ostype."              sysctl(2) man page

Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.74
diff -u -u -r1.74 mapview_common.c
--- client/mapview_common.c     2004/02/03 20:16:07     1.74
+++ client/mapview_common.c     2004/02/10 18:37:18
@@ -34,10 +34,17 @@
 struct canvas mapview_canvas;
 struct overview overview;
 
+/*
+ * Set to TRUE if the backing store is more recent than the version
+ * drawn into overview.window.
+ */
+static bool overview_dirty = FALSE;
+
 static void base_canvas_to_map_pos(int *map_x, int *map_y,
                                   int canvas_x, int canvas_y);
 static void center_tile_overviewcanvas(int map_x, int map_y);
 static void get_mapview_corners(int x[4], int y[4]);
+static void redraw_overview(void);
 
 /**************************************************************************
  Refreshes a single tile on the map canvas.
@@ -1464,6 +1471,7 @@
   needed_updates = UPDATE_NONE;
 
   flush_dirty();
+  redraw_overview();
 }
 
 /**************************************************************************
@@ -1519,6 +1527,10 @@
 {
   struct canvas_store *dest = overview.window;
 
+  if (!dest || !overview.store || !overview_dirty) {
+    return;
+  }
+
   {
     struct canvas_store *src = overview.store;
     int x = overview.map_x0 * OVERVIEW_TILE_WIDTH;
@@ -1548,6 +1560,8 @@
                   dest_x - src_x, dest_y - src_y);
     }
   }
+
+  overview_dirty = FALSE;
 }
 
 /**************************************************************************
@@ -1703,6 +1717,7 @@
   gui_put_rectangle(overview.store,
                    overview_tile_color(map_x, map_y), base_x, base_y,
                    OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
+  overview_dirty = TRUE;
 }
 
 /**************************************************************************

[Prev in Thread] Current Thread [Next in Thread]