Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2004:
[Freeciv-Dev] Re: (PR#8999) RFC: removing partial tile drawing
Home

[Freeciv-Dev] Re: (PR#8999) RFC: removing partial tile drawing

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#8999) RFC: removing partial tile drawing
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 15 Jun 2004 19:37:52 -0700
Reply-to: rt@xxxxxxxxxxx

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

Jason Short wrote:

> However this means the partial tile method is no longer needed; it is 
> redundant since we use tricky buffering already.  Removing it cuts out 
> about 200 lines of code (some of which is comments) and simplifies the 
> logic substantially in some places.

And this is the patch to do it.

This could instead be done in steps - for instance one patch for each 
function.  However it is pretty straightforward.

jason

Index: client/citydlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/citydlg_common.c,v
retrieving revision 1.36
diff -u -r1.36 citydlg_common.c
--- client/citydlg_common.c     13 Jun 2004 16:53:34 -0000      1.36
+++ client/citydlg_common.c     16 Jun 2004 02:35:28 -0000
@@ -149,10 +149,7 @@
     if (is_isometric) {
       put_one_tile_iso(pcanvas, map_x, map_y,
                       canvas_x, canvas_y,
-                      0, 0, 0,
-                      NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT,
-                      UNIT_TILE_HEIGHT,
-                      D_FULL, TRUE);
+                      TRUE);
     } else {
       put_one_tile(pcanvas, map_x, map_y,
                   canvas_x, canvas_y, TRUE);
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.125
diff -u -r1.125 mapview_common.c
--- client/mapview_common.c     13 Jun 2004 16:53:34 -0000      1.125
+++ client/mapview_common.c     16 Jun 2004 02:35:28 -0000
@@ -874,7 +874,7 @@
   positions must be translated so it's drawn in the right location.
 ****************************************************************************/
 static bool get_tile_boundaries(enum direction8 dir,
-                               int inset, int width, enum draw_type draw,
+                               int inset, int width,
                                int *start_x, int *start_y,
                                int *end_x, int *end_y)
 {
@@ -919,11 +919,6 @@
    * adjustment and the overlap adjustment are both 1.
    */
 
-  if (!(draw & D_B) && !(draw & D_M)) {
-    /* Nothing drawable. */
-    return FALSE;
-  }
-
   if (is_isometric) {
     switch (dir) {
     case DIR8_NORTH:
@@ -932,48 +927,48 @@
       *end_x = W - HW / 2 - inset;
       *start_y = HH / 2 + inset + width;
       *end_y = (H - HH) / 2 + width;
-      return (draw & D_M_R) == D_M_R;
+      return TRUE;
     case DIR8_SOUTH:
       /* Bottom left. */
       *start_x = (W - HW) / 2;
       *end_x = HW / 2 + inset;
       *start_y = H - HH / 2 - inset - overlap;
       *end_y = (H + HH) / 2 - overlap;
-      return (draw & D_B_L) == D_B_L && (inset + overlap) > 0;
+      return inset + overlap > 0;
     case DIR8_EAST:
       /* Bottom right. */
       *start_x = W - HW / 2 - inset;
       *end_x = (W + HW) / 2;
       *start_y = (H + HH) / 2 - overlap;
       *end_y = H - HH / 2 - inset - overlap;
-      return (draw & D_B_R) == D_B_R && (inset + overlap) > 0;
+      return inset + overlap > 0;
     case DIR8_WEST:
       /* Top left. */
       *start_x = HW / 2 + inset;
       *end_x = (W - HW) / 2;
       *start_y = (H - HH) / 2 + width;
       *end_y = HH / 2 + inset + width;
-      return (draw & D_M_L) == D_M_L;
+      return TRUE;
     case DIR8_NORTHEAST:
       *start_x = *end_x = W - HW / 2 - inset - overlap;
-      *start_y = (draw & D_M_R) == D_M_R ? ((H - HH) / 2) : H / 2;
-      *end_y = (draw & D_B_R) == D_B_R ? ((H + HH) / 2) : H / 2;
-      return HH > 0 && (draw & D_R);
+      *start_y = (H - HH) / 2;
+      *end_y = (H + HH) / 2;
+      return HH > 0;
     case DIR8_SOUTHEAST:
-      *start_x = (draw & D_B_R) == D_B_R ? ((W + HW) / 2) : W / 2;
-      *end_x = (draw & D_B_L) == D_B_L ? ((W - HW) / 2) : W / 2;
+      *start_x = (W + HW) / 2;
+      *end_x = (W - HW) / 2;
       *start_y = *end_y = H - HH / 2 - inset - overlap;
-      return HW > 0 && (draw & D_B);
+      return HW > 0;
     case DIR8_SOUTHWEST:
       *start_x = *end_x = HW / 2 + inset + width;
-      *start_y = (draw & D_B_L) == D_B_L ? ((H + HH) / 2) : H / 2;
-      *end_y = (draw & D_M_L) == D_M_L ? ((H - HH) / 2) : H / 2;
-      return HH > 0 && (draw & D_L);
+      *start_y = (H + HH) / 2;
+      *end_y = (H - HH) / 2;
+      return HH > 0;
     case DIR8_NORTHWEST:
-      *start_x = (draw & D_M_L) == D_M_L ? ((W - HW) / 2) : W / 2;
-      *end_x = (draw & D_M_R) == D_M_R ? ((W + HW) / 2) : W / 2;
+      *start_x = (W - HW) / 2;
+      *end_x = (W + HW) / 2;
       *start_y = *end_y = HH / 2 + inset + width;
-      return HW > 0 && (draw & D_M);
+      return HW > 0;
     }
   } else {
     switch (dir) {
@@ -1031,7 +1026,7 @@
      * top of everything else, we don't have to worry about overlapping
      * tiles covering them up even in iso-view.  (See comments in
      * city_dialog_redraw_map and tile_draw_borders.) */
-    if (get_tile_boundaries(dir, 1, 1, D_FULL,
+    if (get_tile_boundaries(dir, 1, 1,
                            &start_x, &start_y, &end_x, &end_y)) {
       canvas_put_line(pcanvas, COLOR_STD_RED, LINE_NORMAL,
                      canvas_x + start_x, canvas_y + start_y,
@@ -1075,8 +1070,7 @@
 **************************************************************************/
 static void tile_draw_borders(struct canvas *pcanvas,
                              int map_x, int map_y,
-                             int canvas_x, int canvas_y,
-                             enum draw_type draw)
+                             int canvas_x, int canvas_y)
 {
   struct player *this_owner = map_get_owner(map_x, map_y), *adjc_owner;
   int start_x, start_y, end_x, end_y;
@@ -1096,7 +1090,7 @@
     adjc_dir_iterate(map_x, map_y, adjc_x, adjc_y, dir) {
       if ((dir == DIR8_WEST || dir == DIR8_NORTHWEST
           || dir == DIR8_NORTH || dir == DIR8_SOUTHWEST)
-         && get_tile_boundaries(dir, 0, BORDER_WIDTH, draw,
+         && get_tile_boundaries(dir, 0, BORDER_WIDTH,
                                  &start_x, &start_y, &end_x, &end_y)
          && tile_get_known(adjc_x, adjc_y) != TILE_UNKNOWN
          && this_owner != (adjc_owner = map_get_owner(adjc_x, adjc_y))) {
@@ -1118,7 +1112,7 @@
       return;
     }
     adjc_dir_iterate(map_x, map_y, adjc_x, adjc_y, dir) {
-      if (get_tile_boundaries(dir, 0, BORDER_WIDTH, draw,
+      if (get_tile_boundaries(dir, 0, BORDER_WIDTH,
                              &start_x, &start_y, &end_x, &end_y)
          && tile_get_known(adjc_x, adjc_y) != TILE_UNKNOWN
          && this_owner != (adjc_owner = map_get_owner(adjc_x, adjc_y))) {
@@ -1162,8 +1156,7 @@
        break;
       case DRAWN_GRID:
        /*** Grid (map grid, borders, coastline, etc.) ***/
-       tile_draw_grid(pcanvas, map_x, map_y, canvas_x, canvas_y,
-                      D_FULL, citymode);
+       tile_draw_grid(pcanvas, map_x, map_y, canvas_x, canvas_y, citymode);
        break;
       }
     }
@@ -1197,8 +1190,7 @@
 ****************************************************************************/
 static void tile_draw_map_grid(struct canvas *pcanvas,
                               int map_x, int map_y,
-                              int canvas_x, int canvas_y,
-                              enum draw_type draw)
+                              int canvas_x, int canvas_y)
 {
   enum direction8 dir;
 
@@ -1209,7 +1201,7 @@
   for (dir = 0; dir < 8; dir++) {
     int start_x, start_y, end_x, end_y, dx, dy;
 
-    if (get_tile_boundaries(dir, 0, 1, draw,
+    if (get_tile_boundaries(dir, 0, 1,
                            &start_x, &start_y, &end_x, &end_y)) {
       DIRSTEP(dx, dy, dir);
       canvas_put_line(pcanvas,
@@ -1228,8 +1220,7 @@
 ****************************************************************************/
 static void tile_draw_coastline(struct canvas *pcanvas,
                                int map_x, int map_y,
-                               int canvas_x, int canvas_y,
-                               enum draw_type draw)
+                               int canvas_x, int canvas_y)
 {
   enum tile_terrain_type t1 = map_get_terrain(map_x, map_y), t2;
 
@@ -1240,7 +1231,7 @@
   adjc_dir_iterate(map_x, map_y, adjc_x, adjc_y, dir) {
     int start_x, start_y, end_x, end_y;
 
-    if (get_tile_boundaries(dir, 0, 1, draw,
+    if (get_tile_boundaries(dir, 0, 1,
                            &start_x, &start_y, &end_x, &end_y)) {
       t2 = map_get_terrain(adjc_x, adjc_y);
       if (t2 != T_UNKNOWN && (is_ocean(t1) ^ is_ocean(t2))) {
@@ -1258,8 +1249,7 @@
 ****************************************************************************/
 static void tile_draw_selection(struct canvas *pcanvas,
                                int map_x, int map_y,
-                               int canvas_x, int canvas_y,
-                               enum draw_type draw, bool citymode)
+                               int canvas_x, int canvas_y, bool citymode)
 {
   const int inset = (is_isometric ? 0 : 1);
   enum direction8 dir;
@@ -1277,7 +1267,7 @@
      * In iso-view the inset doesn't work perfectly (see comments about
      * this elsewhere) so we draw without an inset.  This may cover up the
      * map grid if it is drawn. */
-    if (get_tile_boundaries(dir, inset, 1, draw,
+    if (get_tile_boundaries(dir, inset, 1,
                            &start_x, &start_y, &end_x, &end_y)) {
       if (map_get_tile(map_x, map_y)->client.hilite == HILITE_CITY
          || (is_isometric
@@ -1298,13 +1288,12 @@
 ****************************************************************************/
 void tile_draw_grid(struct canvas *pcanvas, int map_x, int map_y,
                        int canvas_x, int canvas_y,
-                   enum draw_type draw, bool citymode)
+                   bool citymode)
 {
-  tile_draw_map_grid(pcanvas, map_x, map_y, canvas_x, canvas_y, draw);
-  tile_draw_borders(pcanvas, map_x, map_y, canvas_x, canvas_y, draw);
-  tile_draw_coastline(pcanvas, map_x, map_y, canvas_x, canvas_y, draw);
-  tile_draw_selection(pcanvas, map_x, map_y, canvas_x, canvas_y,
-                     draw, citymode);
+  tile_draw_map_grid(pcanvas, map_x, map_y, canvas_x, canvas_y);
+  tile_draw_borders(pcanvas, map_x, map_y, canvas_x, canvas_y);
+  tile_draw_coastline(pcanvas, map_x, map_y, canvas_x, canvas_y);
+  tile_draw_selection(pcanvas, map_x, map_y, canvas_x, canvas_y, citymode);
 }
 
 /**************************************************************************
@@ -1312,62 +1301,21 @@
   The coordinates have not been normalized, and are not guaranteed to be
   real (we have to draw unreal tiles too).
 **************************************************************************/
-static void put_tile_iso(int map_x, int map_y, enum draw_type draw)
+static void put_tile_iso(int map_x, int map_y)
 {
   int canvas_x, canvas_y;
 
   if (map_to_canvas_pos(&canvas_x, &canvas_y, map_x, map_y)) {
-    int height, width, height_unit;
-    int offset_x, offset_y, offset_y_unit;
-
-    freelog(LOG_DEBUG, "putting (%d,%d) at (%d,%d), draw %x",
-           map_x, map_y, canvas_x, canvas_y, draw);
-
-    if ((draw & D_L) && (draw & D_R)) {
-      width = NORMAL_TILE_WIDTH;
-    } else {
-      width = NORMAL_TILE_WIDTH / 2;
-    }
-
-    if (draw & D_L) {
-      offset_x = 0;
-    } else {
-      offset_x = NORMAL_TILE_WIDTH / 2;
-    }
-
-    height = 0;
-    if (draw & D_M) {
-      height += NORMAL_TILE_HEIGHT / 2;
-    }
-    if (draw & D_B) {
-      height += NORMAL_TILE_HEIGHT / 2;
-    }
-
-    height_unit = height;
-    if (draw & D_T) {
-      height_unit += NORMAL_TILE_HEIGHT / 2;
-    }
-
-    offset_y = (draw & D_M) ? 0 : NORMAL_TILE_HEIGHT / 2;
-
-    if (draw & D_T) {
-      offset_y_unit = 0;
-    } else if (draw & D_M) {
-      offset_y_unit = NORMAL_TILE_HEIGHT / 2;
-    } else {
-      offset_y_unit = NORMAL_TILE_HEIGHT;
-    }
+    freelog(LOG_DEBUG, "putting (%d,%d) at (%d,%d)",
+           map_x, map_y, canvas_x, canvas_y);
 
     if (normalize_map_pos(&map_x, &map_y)) {
       put_one_tile_iso(mapview_canvas.store,
                       map_x, map_y, canvas_x, canvas_y,
-                      offset_x, offset_y, offset_y_unit,
-                      width, height, height_unit,
-                      draw, FALSE);
+                      FALSE);
     } else {
-      canvas_put_sprite(mapview_canvas.store, canvas_x, canvas_y,
-                       sprites.black_tile,
-                       offset_x, offset_y, width, height);
+      canvas_put_sprite_full(mapview_canvas.store, canvas_x, canvas_y,
+                            sprites.black_tile);
     }
   }
 }
@@ -1431,12 +1379,12 @@
   /* FIXME: we don't have to draw black (unknown) tiles since they're already
    * cleared. */
   if (is_isometric) {
-    gui_rect_iterate(gui_x0, gui_y0, width, height, map_x, map_y, draw) {
-      put_tile_iso(map_x, map_y, draw);
+    gui_rect_iterate(gui_x0, gui_y0, width, height, map_x, map_y) {
+      put_tile_iso(map_x, map_y);
     } gui_rect_iterate_end;
   } else {
     /* not isometric */
-    gui_rect_iterate(gui_x0, gui_y0, width, height, map_x, map_y, draw) {
+    gui_rect_iterate(gui_x0, gui_y0, width, height, map_x, map_y) {
       /*
        * We don't normalize until later because we want to draw
        * black tiles for unreal positions.
@@ -1447,9 +1395,8 @@
 
   /* Draw the goto lines on top of the whole thing. This is done last as
    * we want it completely on top. */
-  gui_rect_iterate(gui_x0, gui_y0, width, height, map_x, map_y, draw) {
-    if (((draw & D_B) || (draw & D_M))
-       && normalize_map_pos(&map_x, &map_y)) {
+  gui_rect_iterate(gui_x0, gui_y0, width, height, map_x, map_y) {
+    if (normalize_map_pos(&map_x, &map_y)) {
       adjc_dir_iterate(map_x, map_y, adjc_x, adjc_y, dir) {
        if (is_drawn_line(map_x, map_y, dir)) {
          draw_segment(map_x, map_y, dir);
@@ -1459,9 +1406,8 @@
   } gui_rect_iterate_end;
 
   /* Draw citymap overlays on top. */
-  gui_rect_iterate(gui_x0, gui_y0, width, height, map_x, map_y, draw) {
-    if (((draw & D_B) || (draw & D_M))
-       && normalize_map_pos(&map_x, &map_y)) {
+  gui_rect_iterate(gui_x0, gui_y0, width, height, map_x, map_y) {
+    if (normalize_map_pos(&map_x, &map_y)) {
       struct city *pcity = find_city_near_tile(map_x, map_y);
       int city_x, city_y, canvas_x2, canvas_y2;
 
@@ -1567,7 +1513,7 @@
   gui_rect_iterate(mapview_canvas.gui_x0 + canvas_x - dx / 2,
                   mapview_canvas.gui_y0 + canvas_y - dy,
                   width + dx, height + dy - NORMAL_TILE_HEIGHT,
-                  map_x, map_y, draw) {
+                  map_x, map_y) {
     int canvas_x, canvas_y;
     struct city *pcity;
 
Index: client/mapview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.h,v
retrieving revision 1.67
diff -u -r1.67 mapview_common.h
--- client/mapview_common.h     13 Jun 2004 16:53:34 -0000      1.67
+++ client/mapview_common.h     16 Jun 2004 02:35:29 -0000
@@ -42,91 +42,6 @@
 extern struct mapview_canvas mapview_canvas;
 extern struct overview overview;
 
-/* 
- * When drawing a tile (currently only in isometric mode), there are
- * 5 relevant bits: top, middle, bottom, left, and right.  A drawing area
- * is comprised of an OR-ing of these.  Note that if you must have a vertical
- * (D_T, D_M, D_B) and horizontal (D_L, D_R) element to get any actual
- * area.  There are therefore six parts to the tile:
- *
- *
- * Left:D_L Right:D_R
- *
- * -----------------
- * |       |       |
- * | D_T_L | D_T_R |  Top, above the actual tile : D_T
- * |       |       |
- * -----------------
- * |       |       |
- * | D_M_L | D_M_R |  Middle, upper half of the actual tile : D_M
- * |       |       |
- * -----------------
- * |       |       |
- * | D_B_L | D_B_R |  Bottom, lower half of the actual tile : D_B
- * |       |       |
- * -----------------
- *
- * The figure above shows the six drawing areas.  The tile itself
- * occupies the bottom four rectangles (if it is isometric it will
- * actually fill only half of each rectangle).  But the sprites for
- * the tile may extend up above it an additional NORMAL_TILE_HEIGHT/2
- * pixels.  To get the Painter's Algorithm (objects are then painted
- * from back-to-front) to work, sometimes we only draw some of these
- * rectangles.  For instance, in isometric view after drawing D_B_L
- * for one tile we have to draw D_M_R for the tile just down-left from
- * it, then D_T_L for the tile below it.
- *
- * This concept only applies to the isometric drawing code.  Non-isometric
- * code may pass around a draw_type variable but it's generally ignored.
- *
- * These values are used as a mask; see enum draw_type.
- */
-enum draw_part {
-  D_T = 1, /* Draw top. */
-  D_M = 2, /* Draw middle. */
-  D_B = 4, /* Draw bottom. */
-  D_L = 8, /* Draw left. */
-  D_R = 16 /* Draw right. */
-};
-
-/* 
- * As explained above, when drawing a tile we will sometimes only draw
- * parts of the tile.  This is an enumeration of which sets of
- * rectangles can be used together in isometric view.  If
- * non-isometric view were to use a similar system it would have a
- * smaller set of rectangles.
- *
- * Format (regexp): D_[TMB]+_[LR]+.
- *
- * Note that each of these sets of rectangles must itelf make up a
- * larger rectangle.  There are 18 such rectangles (C(3, 1) * C(4, 2)).
- * However not all of these rectangles are necessarily used.  The other
- * 14 possible bit combinations are not rectangles - 11 of them have no
- * area (D___, D__[LR]+, and D_[TMB]+_), and 3 of them are divided
- * (D_TB_[LR]+).
- */
-enum draw_type {
-  D_T_L = D_T | D_L,
-  D_T_R = D_T | D_R,
-  D_M_L = D_M | D_L,
-  D_M_R = D_M | D_R,
-  D_B_L = D_B | D_L,
-  D_B_R = D_B | D_R,
-  D_TM_L = D_T | D_M | D_L,
-  D_TM_R = D_T | D_M | D_R,
-  D_MB_L = D_M | D_B | D_L,
-  D_MB_R = D_M | D_B | D_R,
-  D_TMB_L = D_T | D_M | D_B | D_L,
-  D_TMB_R = D_T | D_M | D_B | D_R,
-  D_T_LR = D_T | D_L | D_R,
-  D_M_LR = D_M | D_L | D_R,
-  D_B_LR = D_B | D_L | D_R,
-  D_TM_LR = D_T | D_M | D_L | D_R,
-  D_MB_LR = D_M | D_B | D_L | D_R,
-  D_TMB_LR = D_T | D_M | D_B | D_L | D_R
-};
-#define D_FULL D_TMB_LR
-
 #define BORDER_WIDTH 2
 
 enum update_type {
@@ -154,7 +69,7 @@
  * 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, map_x, map_y, draw) \
+#define gui_rect_iterate(gui_x0, gui_y0, width, height, map_x, map_y)      \
 {                                                                          \
   int _gui_x0 = (gui_x0), _gui_y0 = (gui_y0);                              \
   int _width = (width), _height = (height);                                \
@@ -174,7 +89,6 @@
     int GRI_x1 = DIVIDE(_gui_x0 + _width + W - 1, W);                      \
     int GRI_y1 = DIVIDE(_gui_y0 + _height + H - 1, H);                     \
     int GRI_itr, GRI_x_itr, GRI_y_itr, map_x, map_y;                       \
-    enum draw_type draw;                                                   \
     int count;                                                             \
                                                                            \
     if (is_isometric) {                                                        
    \
@@ -192,28 +106,9 @@
        if ((GRI_x_itr + GRI_y_itr) % 2 != 0) {                             \
          continue;                                                         \
        }                                                                   \
-       draw = 0;                                                           \
-       if (GRI_x_itr > GRI_x0) {                                           \
-         draw |= D_L;                                                      \
-       }                                                                   \
-       if (GRI_x_itr < GRI_x1 - 1) {                                       \
-         draw |= D_R;                                                      \
-       }                                                                   \
-       if (GRI_y_itr > GRI_y0 && GRI_y_itr < GRI_y1 - 1) {                 \
-         draw |= D_M;                                                      \
-       }                                                                   \
-       if (GRI_y_itr > GRI_y0 + 1) {                                       \
-         draw |= D_T;                                                      \
-       }                                                                   \
-       if (GRI_y_itr < GRI_y1 - 2) {                                       \
-         draw |= D_B;                                                      \
-       }                                                                   \
-       assert((draw & (D_L | D_R)) && (draw & (D_T | D_M | D_B)));         \
-       assert((draw & D_M) || !((draw & D_T) && (draw & D_B)));            \
        map_x = (GRI_x_itr + GRI_y_itr) / 2;                                \
        map_y = (GRI_y_itr - GRI_x_itr) / 2;                                \
       } else {                                                             \
-       draw = D_FULL;                                                      \
        map_x = GRI_x_itr;                                                  \
        map_y = GRI_y_itr;                                                  \
       }
@@ -267,8 +162,7 @@
 void put_one_tile(struct canvas *pcanvas, int map_x, int map_y,
                  int canvas_x, int canvas_y, bool citymode);
 void tile_draw_grid(struct canvas *pcanvas, int map_x, int map_y,
-                   int canvas_x, int canvas_y,
-                   enum draw_type draw, bool citymode);
+                   int canvas_x, int canvas_y, bool citymode);
 
 void update_map_canvas(int canvas_x, int canvas_y, int width, int height);
 void update_map_canvas_visible(void);
Index: client/gui-gtk/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/mapview.c,v
retrieving revision 1.223
diff -u -r1.223 mapview.c
--- client/gui-gtk/mapview.c    10 Jun 2004 01:04:53 -0000      1.223
+++ client/gui-gtk/mapview.c    16 Jun 2004 02:35:36 -0000
@@ -65,10 +65,7 @@
                                         bool fog);
 static void pixmap_put_tile_iso(GdkDrawable *pm, int x, int y,
                                int canvas_x, int canvas_y,
-                               int citymode,
-                               int offset_x, int offset_y, int offset_y_unit,
-                               int width, int height, int height_unit,
-                               enum draw_type draw);
+                               int citymode);
 static void pixmap_put_black_tile_iso(GdkDrawable *pm,
                                      int canvas_x, int canvas_y,
                                      int offset_x, int offset_y,
@@ -395,10 +392,7 @@
 void put_one_tile_full(GdkDrawable *pm, int x, int y,
                       int canvas_x, int canvas_y, int citymode)
 {
-  pixmap_put_tile_iso(pm, x, y, canvas_x, canvas_y, citymode,
-                     0, 0, 0,
-                     NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT, UNIT_TILE_HEIGHT,
-                     D_FULL);
+  pixmap_put_tile_iso(pm, x, y, canvas_x, canvas_y, citymode);
 }
 
 /**************************************************************************
@@ -406,16 +400,11 @@
 **************************************************************************/
 void put_one_tile_iso(struct canvas *pcanvas,
                      int map_x, int map_y,
-                     int canvas_x, int canvas_y,
-                     int offset_x, int offset_y, int offset_y_unit,
-                     int width, int height, int height_unit,
-                     enum draw_type draw, bool citymode)
+                     int canvas_x, int canvas_y, bool citymode)
 {
   pixmap_put_tile_iso(pcanvas->pixmap,
                      map_x, map_y, canvas_x, canvas_y,
-                     citymode,
-                     offset_x, offset_y, offset_y_unit,
-                     width, height, height_unit, draw);
+                     citymode);
 }
 
 /**************************************************************************
@@ -948,10 +937,7 @@
 **************************************************************************/
 static void pixmap_put_tile_iso(GdkDrawable *pm, int x, int y,
                                int canvas_x, int canvas_y,
-                               int citymode,
-                               int offset_x, int offset_y, int offset_y_unit,
-                               int width, int height, int height_unit,
-                               enum draw_type draw)
+                               int citymode)
 {
   struct drawn_sprite tile_sprs[80];
   int count, i;
@@ -959,15 +945,12 @@
   enum color_std bg_color;
   struct canvas canvas_store = {pm};
 
-  if (!width || !(height || height_unit))
-    return;
-
   count = fill_tile_sprite_array(tile_sprs, &solid_bg, &bg_color,
                                 x, y, citymode);
 
   if (count == -1) { /* tile is unknown */
     pixmap_put_black_tile_iso(pm, canvas_x, canvas_y,
-                             offset_x, offset_y, width, height);
+                             0, 0, NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT);
     return;
   }
 
@@ -983,9 +966,9 @@
     gdk_gc_set_foreground(fill_bg_gc, colors_standard[bg_color]);
 
     gdk_draw_rectangle(pm, fill_bg_gc, TRUE,
-                      canvas_x+offset_x, canvas_y+offset_y,
-                      MIN(width, MAX(0, sprites.black_tile->width-offset_x)),
-                      MIN(height, MAX(0, 
sprites.black_tile->height-offset_y)));
+                      canvas_x, canvas_y,
+                      sprites.black_tile->width,
+                      sprites.black_tile->height);
     gdk_gc_set_clip_mask(fill_bg_gc, NULL);
     if (fog) {
       gdk_gc_set_clip_origin(fill_tile_gc, canvas_x, canvas_y);
@@ -994,9 +977,9 @@
       gdk_gc_set_stipple(fill_tile_gc, black50);
 
       gdk_draw_rectangle(pm, fill_tile_gc, TRUE,
-                        canvas_x+offset_x, canvas_y+offset_y,
-                        MIN(width, MAX(0, sprites.black_tile->width-offset_x)),
-                        MIN(height, MAX(0, 
sprites.black_tile->height-offset_y)));
+                        canvas_x, canvas_y,
+                        sprites.black_tile->width,
+                        sprites.black_tile->height);
       gdk_gc_set_clip_mask(fill_tile_gc, NULL);
     }
   }
@@ -1008,22 +991,21 @@
       switch (tile_sprs[i].style) {
       case DRAW_NORMAL:
        pixmap_put_drawn_sprite(pm, canvas_x, canvas_y, &tile_sprs[i],
-                               offset_x, offset_y, width, height,
+                               0, 0, NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT,
                                fog && tile_sprs[i].foggable);
        break;
       case DRAW_FULL:
        pixmap_put_drawn_sprite(pm, canvas_x,
                                canvas_y - NORMAL_TILE_HEIGHT / 2,
-                               &tile_sprs[i], offset_x, offset_y_unit,
-                               width, height_unit,
+                               &tile_sprs[i],
+                               0, 0, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT,
                                fog && tile_sprs[i].foggable);
        break;
       }
       break;
     case DRAWN_GRID:
       /*** Grid (map grid, borders, coastline, etc.) ***/
-      tile_draw_grid(&canvas_store, x, y, canvas_x, canvas_y,
-                    draw, citymode);
+      tile_draw_grid(&canvas_store, x, y, canvas_x, canvas_y, citymode);
       break;
     }
   }
Index: client/gui-gtk-2.0/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapview.c,v
retrieving revision 1.129
diff -u -r1.129 mapview.c
--- client/gui-gtk-2.0/mapview.c        10 Jun 2004 01:04:53 -0000      1.129
+++ client/gui-gtk-2.0/mapview.c        16 Jun 2004 02:35:50 -0000
@@ -66,10 +66,7 @@
                                         bool fog);
 static void pixmap_put_tile_iso(GdkDrawable *pm, int x, int y,
                                int canvas_x, int canvas_y,
-                               int citymode,
-                               int offset_x, int offset_y, int offset_y_unit,
-                               int width, int height, int height_unit,
-                               enum draw_type draw);
+                               int citymode);
 static void pixmap_put_black_tile_iso(GdkDrawable *pm,
                                      int canvas_x, int canvas_y,
                                      int offset_x, int offset_y,
@@ -411,10 +408,7 @@
 void put_one_tile_full(GdkDrawable *pm, int x, int y,
                       int canvas_x, int canvas_y, int citymode)
 {
-  pixmap_put_tile_iso(pm, x, y, canvas_x, canvas_y, citymode,
-                     0, 0, 0,
-                     NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT, UNIT_TILE_HEIGHT,
-                     D_FULL);
+  pixmap_put_tile_iso(pm, x, y, canvas_x, canvas_y, citymode);
 }
 
 /**************************************************************************
@@ -423,15 +417,11 @@
 void put_one_tile_iso(struct canvas *pcanvas,
                      int map_x, int map_y,
                      int canvas_x, int canvas_y,
-                     int offset_x, int offset_y, int offset_y_unit,
-                     int width, int height, int height_unit,
-                     enum draw_type draw, bool citymode)
+                     bool citymode)
 {
   pixmap_put_tile_iso(pcanvas->v.pixmap,
                      map_x, map_y, canvas_x, canvas_y,
-                     citymode,
-                     offset_x, offset_y, offset_y_unit,
-                     width, height, height_unit, draw);
+                     citymode);
 }
 
 /**************************************************************************
@@ -1011,10 +1001,7 @@
 **************************************************************************/
 static void pixmap_put_tile_iso(GdkDrawable *pm, int x, int y,
                                int canvas_x, int canvas_y,
-                               int citymode,
-                               int offset_x, int offset_y, int offset_y_unit,
-                               int width, int height, int height_unit,
-                               enum draw_type draw)
+                               int citymode)
 {
   struct drawn_sprite tile_sprs[80];
   int count, i;
@@ -1022,15 +1009,12 @@
   enum color_std bg_color;
   struct canvas canvas_store = {.type = CANVAS_PIXMAP, .v.pixmap = pm};
 
-  if (!width || !(height || height_unit))
-    return;
-
   count = fill_tile_sprite_array(tile_sprs, &solid_bg, &bg_color,
                                 x, y, citymode);
 
   if (count == -1) { /* tile is unknown */
     pixmap_put_black_tile_iso(pm, canvas_x, canvas_y,
-                             offset_x, offset_y, width, height);
+                             0, 0, NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT);
     return;
   }
 
@@ -1046,9 +1030,9 @@
     gdk_gc_set_foreground(fill_bg_gc, colors_standard[bg_color]);
 
     gdk_draw_rectangle(pm, fill_bg_gc, TRUE,
-                      canvas_x+offset_x, canvas_y+offset_y,
-                      MIN(width, MAX(0, sprites.black_tile->width-offset_x)),
-                      MIN(height, MAX(0, 
sprites.black_tile->height-offset_y)));
+                      canvas_x, canvas_y,
+                      sprites.black_tile->width,
+                      sprites.black_tile->height);
     gdk_gc_set_clip_mask(fill_bg_gc, NULL);
     if (fog) {
       gdk_gc_set_clip_origin(fill_tile_gc, canvas_x, canvas_y);
@@ -1057,9 +1041,9 @@
       gdk_gc_set_stipple(fill_tile_gc, black50);
 
       gdk_draw_rectangle(pm, fill_tile_gc, TRUE,
-                        canvas_x+offset_x, canvas_y+offset_y,
-                        MIN(width, MAX(0, sprites.black_tile->width-offset_x)),
-                        MIN(height, MAX(0, 
sprites.black_tile->height-offset_y)));
+                        canvas_x, canvas_y,
+                        sprites.black_tile->width,
+                        sprites.black_tile->height);
       gdk_gc_set_clip_mask(fill_tile_gc, NULL);
     }
   }
@@ -1071,22 +1055,21 @@
       switch (tile_sprs[i].style) {
       case DRAW_NORMAL:
        pixmap_put_drawn_sprite(pm, canvas_x, canvas_y, &tile_sprs[i],
-                               offset_x, offset_y, width, height,
+                               0, 0, NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT,
                                fog && tile_sprs[i].foggable);
        break;
       case DRAW_FULL:
        pixmap_put_drawn_sprite(pm, canvas_x,
                                canvas_y - NORMAL_TILE_HEIGHT / 2,
-                               &tile_sprs[i], offset_x, offset_y_unit,
-                               width, height_unit,
+                               &tile_sprs[i],
+                               0, 0, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT,
                                fog && tile_sprs[i].foggable);
        break;
       }
       break;
     case DRAWN_GRID:
       /*** Grid (map grid, borders, coastline, etc.) ***/
-      tile_draw_grid(&canvas_store, x, y, canvas_x, canvas_y,
-                    draw, citymode);
+      tile_draw_grid(&canvas_store, x, y, canvas_x, canvas_y, citymode);
       break;
     }
   }
Index: client/gui-stub/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-stub/dialogs.c,v
retrieving revision 1.13
diff -u -r1.13 dialogs.c
--- client/gui-stub/dialogs.c   17 May 2004 01:29:47 -0000      1.13
+++ client/gui-stub/dialogs.c   16 Jun 2004 02:35:50 -0000
@@ -69,8 +69,7 @@
   In the nation selection dialog, make already-taken nations unavailable.
   This information is contained in the packet_nations_used packet.
 **************************************************************************/
-void races_toggles_set_sensitive(int num_nations_used,
-                                Nation_Type_id * nations_used)
+void races_toggles_set_sensitive(bool *nations_used)
 {
   /* PORTME */
 }
Index: client/gui-stub/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-stub/mapview.c,v
retrieving revision 1.43
diff -u -r1.43 mapview.c
--- client/gui-stub/mapview.c   17 May 2004 07:16:43 -0000      1.43
+++ client/gui-stub/mapview.c   16 Jun 2004 02:35:50 -0000
@@ -213,9 +213,7 @@
 void put_one_tile_iso(struct canvas *pcanvas,
                      int map_x, int map_y,
                      int canvas_x, int canvas_y,
-                     int offset_x, int offset_y, int offset_y_unit,
-                     int width, int height, int height_unit,
-                     enum draw_type draw, bool citymode)
+                     bool citymode)
 {
   /* PORTME */
 }
@@ -319,9 +317,13 @@
 }
 
 /****************************************************************************
-  Draw in information about city workers on the mapview in the given color.
-****************************************************************************/
-void put_city_workers(struct city *pcity, int color)
+  Draw a single tile of the citymap onto the mapview.  The tile is drawn
+  as the given color with the given worker on it.  The exact method of
+  drawing is left up to the GUI.
+****************************************************************************/
+void put_city_worker(struct canvas *pcanvas,
+                    enum color_std color, enum city_tile_type worker,
+                    int canvas_x, int canvas_y)
 {
   /* PORTME */
 }
Index: client/gui-win32/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/mapview.c,v
retrieving revision 1.120
diff -u -r1.120 mapview.c
--- client/gui-win32/mapview.c  10 Jun 2004 01:04:53 -0000      1.120
+++ client/gui-win32/mapview.c  16 Jun 2004 02:35:50 -0000
@@ -66,10 +66,7 @@
                              int canvas_x, int canvas_y, int citymode);
 static void pixmap_put_tile_iso(HDC hdc, int x, int y,
                                 int canvas_x, int canvas_y,
-                                int citymode,
-                                int offset_x, int offset_y, int offset_y_unit,
-                                int width, int height, int height_unit,
-                                enum draw_type draw);
+                                int citymode);
 static void draw_rates(HDC hdc);
 
 
@@ -759,10 +756,7 @@
 void put_one_tile_full(HDC hdc, int x, int y,
                        int canvas_x, int canvas_y, int citymode)
 {
-  pixmap_put_tile_iso(hdc, x, y, canvas_x, canvas_y, citymode,
-                      0, 0, 0,
-                      NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT, UNIT_TILE_HEIGHT,
-                      D_FULL);
+  pixmap_put_tile_iso(hdc, x, y, canvas_x, canvas_y, citymode);
 }
 
 /**************************************************************************
@@ -771,9 +765,7 @@
 void put_one_tile_iso(struct canvas *pcanvas,
                      int map_x, int map_y,
                      int canvas_x, int canvas_y,
-                     int offset_x, int offset_y, int offset_y_unit,
-                     int width, int height, int height_unit,
-                     enum draw_type draw, bool citymode)
+                     bool citymode)
 {
   HDC hdc;
   HBITMAP old = NULL; /*Remove warning*/
@@ -786,10 +778,7 @@
     hdc = pcanvas->hdc;
   }
   pixmap_put_tile_iso(hdc, map_x, map_y,
-                     canvas_x, canvas_y, 0,
-                     offset_x, offset_y, offset_y_unit,
-                     width, height, height_unit,
-                     draw);
+                     canvas_x, canvas_y, 0);
   if (pcanvas->bitmap) {
     SelectObject(hdc, old);
     DeleteDC(hdc);
@@ -930,10 +919,7 @@
 **************************************************************************/
 static void pixmap_put_tile_iso(HDC hdc, int x, int y,
                                 int canvas_x, int canvas_y,
-                                int citymode,
-                                int offset_x, int offset_y, int offset_y_unit,
-                                int width, int height, int height_unit,
-                                enum draw_type draw)
+                                int citymode)
 {
   struct drawn_sprite tile_sprs[80];
   struct canvas canvas_store={hdc,NULL};
@@ -941,15 +927,12 @@
   bool fog, solid_bg, is_real;
   enum color_std bg_color;
 
-  if (!width || !(height || height_unit))
-    return;
-
   count = fill_tile_sprite_array(tile_sprs, &solid_bg, &bg_color,
                                 x, y, citymode);
 
   if (count == -1) { /* tile is unknown */
     pixmap_put_black_tile_iso(hdc, canvas_x, canvas_y,
-                              offset_x, offset_y, width, height);
+                             0, 0, NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT);
     return;
   }
   is_real = normalize_map_pos(&x, &y);
@@ -982,21 +965,20 @@
       switch (tile_sprs[i].style) {
       case DRAW_NORMAL:
        pixmap_put_drawn_sprite(hdc, canvas_x, canvas_y, &tile_sprs[i],
-                               offset_x, offset_y, width, height,
+                               0, 0, NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT,
                                fog && tile_sprs[i].foggable);
        break;
       case DRAW_FULL:
        pixmap_put_drawn_sprite(hdc,
                                canvas_x, canvas_y - NORMAL_TILE_HEIGHT / 2,
                                &tile_sprs[i],
-                               offset_x, offset_y_unit, width, height_unit,
+                               0, 0, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT,
                                fog && tile_sprs[i].foggable);
        break;
       }
     case DRAWN_GRID:
       /*** Grid (map grid, borders, coastline, etc.) ***/
-      tile_draw_grid(&canvas_store, x, y, canvas_x, canvas_y,
-                    draw, citymode);
+      tile_draw_grid(&canvas_store, x, y, canvas_x, canvas_y, citymode);
     }
   }
 }
Index: client/gui-xaw/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/mapview.c,v
retrieving revision 1.175
diff -u -r1.175 mapview.c
--- client/gui-xaw/mapview.c    10 Jun 2004 01:04:53 -0000      1.175
+++ client/gui-xaw/mapview.c    16 Jun 2004 02:35:51 -0000
@@ -377,11 +377,9 @@
   Draw some or all of a tile onto the canvas.
 **************************************************************************/
 void put_one_tile_iso(struct canvas *pcanvas,
-                     int map_x, int map_y,
-                     int canvas_x, int canvas_y,
-                     int offset_x, int offset_y, int offset_y_unit,
-                     int width, int height, int height_unit,
-                     enum draw_type draw, bool citymode)
+                     int map_x, int map_y,
+                     int canvas_x, int canvas_y,
+                     bool citymode)
 {
   /* PORTME */
   assert(0);
Index: client/include/mapview_g.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/include/mapview_g.h,v
retrieving revision 1.53
diff -u -r1.53 mapview_g.h
--- client/include/mapview_g.h  10 Jun 2004 01:04:53 -0000      1.53
+++ client/include/mapview_g.h  16 Jun 2004 02:35:51 -0000
@@ -39,10 +39,7 @@
 
 void put_one_tile_iso(struct canvas *pcanvas,
                      int map_x, int map_y,
-                     int canvas_x, int canvas_y,
-                     int offset_x, int offset_y, int offset_y_unit,
-                     int width, int height, int height_unit,
-                     enum draw_type draw, bool citymode);
+                     int canvas_x, int canvas_y, bool citymode);
 void canvas_put_sprite(struct canvas *pcanvas,
                       int canvas_x, int canvas_y, struct Sprite *sprite,
                       int offset_x, int offset_y, int width, int height);

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