Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] map tiles in city dialog drawn in wrong order (PR#1044)
Home

[Freeciv-Dev] map tiles in city dialog drawn in wrong order (PR#1044)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] map tiles in city dialog drawn in wrong order (PR#1044)
From: andreas.beckmann@xxxxxxxxxxxxxxxxxxxx
Date: Wed, 31 Oct 2001 09:50:44 -0800 (PST)

Full_Name: Andreas Beckmann
Version: 1.12.1-devel (cvs)
Distribution: Built from source
Client: Gtk+
OS: Linux
Submission from: (NULL) (217.226.246.33)


Hi,

the map tiles in the city dialog are drawn in the wrong order, so they 
overlap each other in the wrong way and cut off some things, e.g the city
icon. (Tested with Gtk+ and standard isometrc tileset, others may be 
affected as well.)

This bug was introduced 2001-09-30 when the city_map_iterate macro was 
replaced with city_map_checked_iterate:
http://www.freeciv.org/lxr/source/client/gui-gtk/citydlg.c?v=cvs#L1768

city_map_checked_iterate uses city_map_iterate_outward which gives the 
wrong tile order.

The following patch should be treated as a workaound and give ideas.
It's not a fix.

I don't know whether city_map_iterate does what we want or the result
just "looks good".

Index: client/gui-gtk/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/citydlg.c,v
retrieving revision 1.100
diff -u -u -r1.100 citydlg.c
--- client/gui-gtk/citydlg.c    2001/10/30 11:29:33     1.100
+++ client/gui-gtk/citydlg.c    2001/10/31 17:30:36
@@ -1765,14 +1765,14 @@
      Furthermore, we don't have to redraw fog on the part of a fogged tile
      that overlaps another fogged tile, as on the main map, as no tiles in
      the city radius can be fogged. */
-  city_map_checked_iterate(pcity->x, pcity->y, x, y, map_x, map_y) {
+  city_map_checked_bottom_up_iterate(pcity->x, pcity->y, x, y, map_x, map_y) {
     if (tile_is_known(map_x, map_y)) {
       int canvas_x, canvas_y;
       city_get_canvas_xy(x, y, &canvas_x, &canvas_y);
       put_one_tile_full(pdialog->map_canvas_store, map_x, map_y,
                        canvas_x, canvas_y, 1);
     }
-  } city_map_checked_iterate_end;
+  } city_map_checked_bottom_up_iterate_end;
   /* We have to put the output afterwards or it will be covered. */
   city_map_checked_iterate(pcity->x, pcity->y, x, y, map_x, map_y) {
     if (tile_is_known(map_x, map_y)) {
Index: common/city.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.h,v
retrieving revision 1.93
diff -u -u -r1.93 city.h
--- common/city.h       2001/10/26 08:07:19     1.93
+++ common/city.h       2001/10/31 17:30:41
@@ -116,6 +116,22 @@
   } city_map_iterate_outwards_end    \
 }
 
+/*
+ * Iterate a city map in checked real map coordinates. The center of
+ * the city is given as a map position (x0,y0). cx and cy will be
+ * elements of [0,CITY_MAP_SIZE). mx and my will form the map position
+ * (mx,my). FIXME: fix this comment!
+*/
+#define city_map_checked_bottom_up_iterate(x0, y0, cx, cy, mx, my) {     \
+  city_map_iterate(cx, cy) {                          \
+    int mx, my;                                                \
+    if (base_city_map_to_map(&mx, &my, x0, y0, cx, cy)) {
+
+#define city_map_checked_bottom_up_iterate_end \
+    }                                \
+  } city_map_iterate_end\
+}
+
 /* Iterate a city radius: (dx,dy) centered on (0,0) */
 #define city_radius_iterate(dx, dy) \
   for (dy = -(int)(CITY_MAP_SIZE/2); dy<(int)(CITY_MAP_SIZE/2); dy++) \




[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] map tiles in city dialog drawn in wrong order (PR#1044), andreas . beckmann <=