Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] (PR#10379) bug: gui_rect_iterate and hex tiles
Home

[Freeciv-Dev] (PR#10379) bug: gui_rect_iterate and hex tiles

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10379) bug: gui_rect_iterate and hex tiles
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 5 Oct 2004 13:30:23 -0700
Reply-to: rt@xxxxxxxxxxx

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

> [jdorje - Wed Sep 29 05:53:47 2004]:
> 
> gui_rect_iterate doesn't work well with hex tiles.  It will select some 
> extra non-overlapping tiles on the borders because it does not check 
> hex_width and hex_height.

I think this patch fixes it.  But the added complexity may not be worth
it.  The only advantage is that since fewer tiles are iterated over
drawing will go faster (particularly when scrolling).

jason

? diff
Index: client/mapview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.h,v
retrieving revision 1.79
diff -u -r1.79 mapview_common.h
--- client/mapview_common.h     1 Oct 2004 17:53:01 -0000       1.79
+++ client/mapview_common.h     5 Oct 2004 20:23:09 -0000
@@ -88,9 +88,10 @@
   if (_width > 0 && _height > 0) {                                         \
     int W = (is_isometric ? (NORMAL_TILE_WIDTH / 2) : NORMAL_TILE_WIDTH);   \
     int H = (is_isometric ? (NORMAL_TILE_HEIGHT / 2) : NORMAL_TILE_HEIGHT); \
-    int GRI_x0 = DIVIDE(_gui_x0, W), GRI_y0 = DIVIDE(_gui_y0, H);          \
-    int GRI_x1 = DIVIDE(_gui_x0 + _width + W - 1, W);                      \
-    int GRI_y1 = DIVIDE(_gui_y0 + _height + H - 1, H);                     \
+    int GRI_x0 = DIVIDE(_gui_x0 + hex_width / 2, W);                       \
+    int GRI_y0 = DIVIDE(_gui_y0 + hex_height / 2, H);                      \
+    int GRI_x1 = DIVIDE(_gui_x0 - hex_width / 2 + _width + W - 1, W);      \
+    int GRI_y1 = DIVIDE(_gui_y0 - hex_height / 2 + _height + H - 1, H);        
    \
     int GRI_itr, GRI_x_itr, GRI_y_itr, _map_x, _map_y;                     \
     int count;                                                             \
     struct tile *ptile;                                                        
    \

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#10379) bug: gui_rect_iterate and hex tiles, Jason Short <=