Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: buglet with map_canvas_store_twidth
Home

[Freeciv-Dev] Re: buglet with map_canvas_store_twidth

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: buglet with map_canvas_store_twidth
From: Jason Dorje Short <jshort@xxxxxxxxxxxxx>
Date: Fri, 24 Aug 2001 20:43:30 -0400

Jason Dorje Short wrote:
> 
> In mapview.c in the gtk client y is iterated over the width of the map
> view.  It seems clear that this should be iterated over the height
> instead:
> 
> http://www.freeciv.org/lxr/source/client/gui-gtk/mapview.c?v=cvs#L1554

The attached patch fixes this in four places.

The for(...) loop causes city names not to be drawn properly as the code
is now.  This patch fixes it.  The other three corrections are to code
that is never actually used - the return value of get_canvas_xy is never
checked in non-isomorphic mode - but it's surely safer to fix the typo
now.

jason
Index: client/gui-gtk/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/mapview.c,v
retrieving revision 1.90
diff -u -r1.90 mapview.c
--- client/gui-gtk/mapview.c    2001/08/24 07:12:45     1.90
+++ client/gui-gtk/mapview.c    2001/08/25 00:39:03
@@ -310,7 +310,7 @@
     return *canvas_x >= 0
       && *canvas_x < map_canvas_store_twidth*NORMAL_TILE_WIDTH
       && *canvas_y >= 0
-      && *canvas_y < map_canvas_store_twidth*NORMAL_TILE_HEIGHT;
+      && *canvas_y < map_canvas_store_theight*NORMAL_TILE_HEIGHT;
   }
 }
 
@@ -1551,7 +1551,7 @@
     int x1, y1;
     for (x1 = 0; x1 < map_canvas_store_twidth; x1++) {
       x = (map_view_x0 + x1) % map.xsize;
-      for (y1 = 0; y1 < map_canvas_store_twidth; y1++) {
+      for (y1 = 0; y1 < map_canvas_store_theight; y1++) {
        y = map_view_y0 + y1;
        if (normalize_map_pos(&x, &y)) {
          show_desc_at_tile(x, y);
Index: client/gui-mui/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/mapview.c,v
retrieving revision 1.28
diff -u -r1.28 mapview.c
--- client/gui-mui/mapview.c    2001/08/05 14:44:59     1.28
+++ client/gui-mui/mapview.c    2001/08/25 00:39:04
@@ -452,7 +452,7 @@
     return *canvas_x >= 0
       && *canvas_x < map_canvas_store_twidth*NORMAL_TILE_WIDTH
       && *canvas_y >= 0
-      && *canvas_y < map_canvas_store_twidth*NORMAL_TILE_HEIGHT;
+      && *canvas_y < map_canvas_store_theight*NORMAL_TILE_HEIGHT;
   }
 }
 
Index: client/gui-xaw/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/mapview.c,v
retrieving revision 1.75
diff -u -r1.75 mapview.c
--- client/gui-xaw/mapview.c    2001/08/24 07:04:45     1.75
+++ client/gui-xaw/mapview.c    2001/08/25 00:39:05
@@ -104,7 +104,7 @@
   return *canvas_x >= 0
     && *canvas_x < map_canvas_store_twidth*NORMAL_TILE_WIDTH
     && *canvas_y >= 0
-    && *canvas_y < map_canvas_store_twidth*NORMAL_TILE_HEIGHT;
+    && *canvas_y < map_canvas_store_theight*NORMAL_TILE_HEIGHT;
 }
 
 /**************************************************************************

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