Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2005:
[Freeciv-Dev] (PR#12085) RFC: better iteration in gui_rect_iterate
Home

[Freeciv-Dev] (PR#12085) RFC: better iteration in gui_rect_iterate

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12085) RFC: better iteration in gui_rect_iterate
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 2 Feb 2005 15:13:21 -0800
Reply-to: bugs@xxxxxxxxxxx

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

Currently gui_rect_iterate iterates over tiles.

To be able to draw corner graphics (like civ3-style base terrain and 
civ3-style fog) and edge graphics (like gridline sprites or edge base 
terrain) it would be nice to iterate over corners and edges too.

The attached image shows the new grid.  The attached patch shows the 
interface.

-jason

PNG image

? newgrid.fig
? newgrid.png
? doc/isogrid.fig
Index: client/mapview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.h,v
retrieving revision 1.85
diff -u -r1.85 mapview_common.h
--- client/mapview_common.h     25 Dec 2004 20:38:14 -0000      1.85
+++ client/mapview_common.h     2 Feb 2005 23:10:39 -0000
@@ -67,6 +67,18 @@
   UPDATE_MAP_CANVAS_VISIBLE = 2
 };
 
+/* An edge is the border between two tiles.  This structure represents one
+ * edge.  The tiles are in unspecified order for the moment. */
+struct tile_edge {
+  struct tile *left, *right;
+};
+
+/* A corner is the endpoint of several edges.  At each corner 4 tiles will
+ * meet (3 in hex view).  Tiles are in clockwise order NESW. */
+struct tile_corner {
+  struct tile *tiles[4];
+};
+
 /*
  * Iterate over all map tiles that intersect with the given GUI rectangle.
  * The order of iteration is guaranteed to satisfy the painter's algorithm.
@@ -85,7 +97,8 @@
  * iso-view iteration is at
  * http://rt.freeciv.org/Ticket/Attachment/51374/37363/isogrid.png.
  */
-#define gui_rect_iterate(gui_x0, gui_y0, width, height, ptile)             \
+#define gui_rect_iterate(gui_x0, gui_y0, width, height,                        
    \
+                        ptile, pedge, pcorner)                             \
 {                                                                          \
   int _gui_x0 = (gui_x0), _gui_y0 = (gui_y0);                              \
   int _width = (width), _height = (height);                                \

image/xfig


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12085) RFC: better iteration in gui_rect_iterate, Jason Short <=