Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] (PR#8574) merge fill_tile_sprite_array[_iso]
Home

[Freeciv-Dev] (PR#8574) merge fill_tile_sprite_array[_iso]

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8574) merge fill_tile_sprite_array[_iso]
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 22 Apr 2004 18:36:09 -0700
Reply-to: rt@xxxxxxxxxxx

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

fill_tile_sprite_array and fill_tile_sprite_array_iso should be merged.

This isn't actually all that hard anymore.  A few of the sprites are 
drawn in a different order in non-iso view than they used to be.

As a side effect the solid_color_behind_units option now works in 
iso-view (although why anyone would use this option I don't know).

This patch probably isn't ready to be applied directly.  A few other 
steps (like PR#8573) should be done first.

-----

As a long-term goal I'd like the drawing function (in this case 
fill_tile_sprite_array) to take a list of flags for what to draw. 
Something like

enum draw_layer {
   DRAW_BACKDROP = 1,
   DRAW_FLAT_TERRAIN = 2,
   DRAW_3D_TERRAIN = 4
   DRAW_CITY = 8,
   DRAW_UNIT_STACK = 16,
   DRAW_UNIT = 32,
   DRAW_GOTO_LINES = 64
};

#define NUM_LAYERS 7

this enables the callers to do cool things, like having a popup to show 
the terrain on a particular tile, or to draw the city only.  Meanwhile 
the alternate drawing functions (fill_city_sprite_array, 
fill_unit_sprite_array) should be removed from the interface.  The same 
functionality can be achieved by passing the proper flags to this 
function.  Finally, since this makes all the callers (put_unit, 
put_one_tile) equivalent, these callers should be merged into a single 
function (taking the same list of flags) as well.

In addition to cutting down on code duplication, this will allow a 
layered drawing system without further duplication.  For instance 
update_map_canvas can have code like:

   for (layer = 0; layer < NUM_LAYERS; layer++) {
     gui_iterate(...) {
       enum draw_layer this_layer = 1 << layer;

       draw_element(..., this_layer);
     } gui_iterate_end;

which not only cuts out more code but also provides the layering we need.

And having an update_map_canvas that works in gui coordinates allows 
more efficient scrolling.  If we scroll 15 pixels to the left we don't 
have to update everything; we can copy all but 15 pixels of the canvas 
and do an update_map_canvas on the remaining 15 pixels.

jason

Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.103
diff -u -r1.103 mapview_common.c
--- client/mapview_common.c     20 Apr 2004 19:56:16 -0000      1.103
+++ client/mapview_common.c     23 Apr 2004 01:20:31 -0000
@@ -997,8 +997,8 @@
   bool is_real = normalize_map_pos(&map_x, &map_y);
 
   if (is_real && tile_get_known(map_x, map_y)) {
-    int count = fill_tile_sprite_array(tile_sprs, map_x, map_y, citymode,
-                                      &solid_bg, &bg_color);
+    int count = fill_tile_sprite_array(tile_sprs, &solid_bg, &bg_color,
+                                      map_x, map_y, citymode);
     int i = 0;
 
     if (solid_bg) {
@@ -1007,17 +1007,20 @@
     }
 
     for (i = 0; i < count; i++) {
-      if (tile_sprs[i].sprite) {
+      switch (tile_sprs[i].type) {
+      case DRAWN_SPRITE:
        canvas_put_sprite_full(pcanvas,
                               canvas_x + tile_sprs[i].offset_x,
                               canvas_y + tile_sprs[i].offset_y,
                               tile_sprs[i].sprite);
+       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);
+       break;
       }
     }
-
-    /*** Grid (map grid, borders, coastline, etc.) ***/
-    tile_draw_grid(pcanvas, map_x, map_y, canvas_x, canvas_y,
-                  D_FULL, citymode);
   } else {
     /* tile is unknown */
     canvas_put_rectangle(pcanvas, COLOR_STD_BLACK,
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.160
diff -u -r1.160 tilespec.c
--- client/tilespec.c   22 Apr 2004 21:07:32 -0000      1.160
+++ client/tilespec.c   23 Apr 2004 01:20:32 -0000
@@ -1446,62 +1446,6 @@
 #define ADD_SPRITE_SIMPLE(s) ADD_SPRITE(s, DRAW_NORMAL, TRUE, 0, 0)
 #define ADD_SPRITE_FULL(s) ADD_SPRITE(s, DRAW_FULL, TRUE, 0, 0)
 
-/**********************************************************************
-  Fill in the sprite array for the city
-***********************************************************************/
-static int fill_city_sprite_array(struct drawn_sprite *sprs,
-                                 struct city *pcity, bool *solid_bg)
-{
-  struct drawn_sprite *save_sprs = sprs;
-
-  *solid_bg = FALSE;
-
-  if (!solid_color_behind_units) {
-    ADD_SPRITE(get_city_nation_flag_sprite(pcity), DRAW_FULL, TRUE,
-              flag_offset_x, flag_offset_y);
-  } else {
-    *solid_bg = TRUE;
-  }
-
-  if (pcity->client.occupied) {
-    ADD_SPRITE_SIMPLE(get_city_occupied_sprite(pcity));
-  }
-
-  ADD_SPRITE_SIMPLE(get_city_sprite(pcity));
-
-  if (city_got_citywalls(pcity)) {
-    ADD_SPRITE_SIMPLE(get_city_wall_sprite(pcity));
-  }
-
-  if (map_has_special(pcity->x, pcity->y, S_POLLUTION)) {
-    ADD_SPRITE_SIMPLE(sprites.tx.pollution);
-  }
-  if (map_has_special(pcity->x, pcity->y, S_FALLOUT)) {
-    ADD_SPRITE_SIMPLE(sprites.tx.fallout);
-  }
-
-  if (pcity->client.unhappy) {
-    ADD_SPRITE_SIMPLE(sprites.city.disorder);
-  }
-
-  if (tile_get_known(pcity->x, pcity->y) == TILE_KNOWN_FOGGED
-      && draw_fog_of_war) {
-    ADD_SPRITE_SIMPLE(sprites.tx.fog);
-  }
-
-  /* Put the size sprites last, so that they are not obscured
-   * (and because they can be hard to read if fogged).
-   */
-  if (pcity->size >= 10) {
-    assert(pcity->size < 100);
-    ADD_SPRITE_SIMPLE(sprites.city.size_tens[pcity->size / 10]);
-  }
-
-  ADD_SPRITE_SIMPLE(sprites.city.size[pcity->size % 10]);
-
-  return sprs - save_sprs;
-}
-
 /**************************************************************************
   Assemble some data that is used in building the tile sprite arrays.
     (map_x, map_y) : the (normalized) map position
@@ -2146,68 +2090,89 @@
  4) mine
  5) huts
 ***********************************************************************/
-int fill_tile_sprite_array_iso(struct drawn_sprite *sprs,
-                              int x, int y, bool citymode, bool *solid_bg)
+int fill_tile_sprite_array(struct drawn_sprite *sprs,
+                          bool *solid_bg, enum color_std *bg_color,
+                          int map_x, int map_y, bool citymode)
 {
   enum tile_terrain_type ttype, ttype_near[8];
   enum tile_special_type tspecial, tspecial_near[8];
   int tileno, dir;
-  struct tile *ptile = map_get_tile(x, y);
+  struct tile *ptile = map_get_tile(map_x, map_y);
   struct city *pcity = ptile->city;
-  struct unit *punit = get_drawable_unit(x, y, citymode);
+  struct unit *punit = get_drawable_unit(map_x, map_y, citymode);
   struct unit *pfocus = get_unit_in_focus();
   struct drawn_sprite *save_sprs = sprs;
+  bool unit_only = FALSE, city_only = FALSE;
 
-  *solid_bg = FALSE;
-
-  if (tile_get_known(x, y) == TILE_UNKNOWN)
-    return -1;
+  if (tile_get_known(map_x, map_y) == TILE_UNKNOWN) {
+    *solid_bg = TRUE;
+    *bg_color = COLOR_STD_BLACK;
+    return 0;
+  }
 
-  build_tile_data(x, y, &ttype, &tspecial, ttype_near, tspecial_near);
+  /* Set up background color. */
+  *solid_bg = FALSE;
+  if (solid_color_behind_units) {
+    if (punit && (draw_units || (draw_focus_unit && pfocus == punit))) {
+      *solid_bg = unit_only = TRUE;
+      *bg_color = player_color(unit_owner(punit));
+    } else if (pcity && draw_cities) {
+      *solid_bg = city_only = TRUE;
+      *bg_color = player_color(city_owner(pcity));
+    }
+  } else if (!draw_terrain) {
+    *solid_bg = TRUE;
+    *bg_color = COLOR_STD_BACKGROUND;
+  }
 
-  sprs += fill_terrain_sprite_array(sprs, x, y, ttype_near);
+  build_tile_data(map_x, map_y,
+                 &ttype, &tspecial, ttype_near, tspecial_near);
 
-  if (is_ocean(ttype) && draw_terrain) {
-    for (dir = 0; dir < 4; dir++) {
-      if (contains_special(tspecial_near[DIR4_TO_DIR8[dir]], S_RIVER)) {
-       ADD_SPRITE_SIMPLE(sprites.tx.river_outlet[dir]);
+  /* Terrain and specials. */
+  if (!unit_only && !city_only) {
+    sprs += fill_terrain_sprite_array(sprs, map_x, map_y, ttype_near);
+
+    if (is_ocean(ttype) && draw_terrain) {
+      for (dir = 0; dir < 4; dir++) {
+       if (contains_special(tspecial_near[DIR4_TO_DIR8[dir]], S_RIVER)) {
+         ADD_SPRITE_SIMPLE(sprites.tx.river_outlet[dir]);
+       }
       }
     }
-  }
 
-  sprs += fill_irrigation_sprite_array(sprs, tspecial, tspecial_near,
-                                          pcity);
+    sprs += fill_irrigation_sprite_array(sprs, tspecial, tspecial_near,
+                                        pcity);
 
-  if (draw_terrain) {
-    /* Draw rivers on top of irrigation. */
-    if (contains_special(tspecial, S_RIVER)) {
-      tileno = INDEX_NSEW(contains_special(tspecial_near[DIR8_NORTH], S_RIVER)
-                         || is_ocean(ttype_near[DIR8_NORTH]),
-                         contains_special(tspecial_near[DIR8_SOUTH], S_RIVER)
-                         || is_ocean(ttype_near[DIR8_SOUTH]),
-                         contains_special(tspecial_near[DIR8_EAST], S_RIVER)
-                         || is_ocean(ttype_near[DIR8_EAST]),
-                         contains_special(tspecial_near[DIR8_WEST], S_RIVER)
-                         || is_ocean(ttype_near[DIR8_WEST]));
+    if (draw_terrain && contains_special(tspecial, S_RIVER)) {
+      /* Draw rivers on top of irrigation. */
+      tileno = INDEX_NSEW((contains_special(tspecial_near[DIR8_NORTH],
+                                           S_RIVER)
+                          || is_ocean(ttype_near[DIR8_NORTH])),
+                         (contains_special(tspecial_near[DIR8_SOUTH],
+                                           S_RIVER)
+                          || is_ocean(ttype_near[DIR8_SOUTH])),
+                         (contains_special(tspecial_near[DIR8_EAST],
+                                           S_RIVER)
+                          || is_ocean(ttype_near[DIR8_EAST])),
+                         (contains_special(tspecial_near[DIR8_WEST],
+                                           S_RIVER)
+                          || is_ocean(ttype_near[DIR8_WEST])));
       ADD_SPRITE_SIMPLE(sprites.tx.spec_river[tileno]);
     }
-  } else {
-    *solid_bg = TRUE;
-  }
   
-  sprs += fill_road_rail_sprite_array(sprs,
-                                     tspecial, tspecial_near, pcity);
+    sprs += fill_road_rail_sprite_array(sprs,
+                                       tspecial, tspecial_near, pcity);
 
-  if (draw_specials) {
-    if (contains_special(tspecial, S_SPECIAL_1)) {
-      ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->special[0]);
-    } else if (contains_special(tspecial, S_SPECIAL_2)) {
-      ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->special[1]);
+    if (draw_specials) {
+      if (contains_special(tspecial, S_SPECIAL_1)) {
+       ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->special[0]);
+      } else if (contains_special(tspecial, S_SPECIAL_2)) {
+       ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->special[1]);
+      }
     }
-  }
 
-  if (!is_ocean(ttype)) {
-    if (contains_special(tspecial, S_FORTRESS) && draw_fortress_airbase) {
+    if (draw_fortress_airbase && contains_special(tspecial, S_FORTRESS)
+       && sprites.tx.fortress_back) {
       ADD_SPRITE_SIMPLE(sprites.tx.fortress_back);
     }
 
@@ -2216,40 +2181,57 @@
       ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->mine);
     }
     
-    if (contains_special(tspecial, S_HUT) && draw_specials) {
+    if (draw_specials && contains_special(tspecial, S_HUT)) {
       ADD_SPRITE_SIMPLE(sprites.tx.village);
     }
   }
 
-  /* Add grid. */
-  sprs->type = DRAWN_GRID;
-  sprs++;
-
-  if (pcity && draw_cities) {
-    ADD_SPRITE(get_city_nation_flag_sprite(pcity),
-              DRAW_FULL, TRUE, flag_offset_x, flag_offset_y);
+  if (is_isometric) {
+    /* Add grid.  In classic view this is done later. */
+    sprs->type = DRAWN_GRID;
+    sprs++;
+  }
+
+  /* City, part 1. */
+  if (pcity && draw_cities && !unit_only) {
+    if (!solid_color_behind_units) {
+      ADD_SPRITE(get_city_nation_flag_sprite(pcity),
+                DRAW_FULL, TRUE, flag_offset_x, flag_offset_y);
+    }
     if (pcity->client.occupied) {
       ADD_SPRITE_FULL(get_city_occupied_sprite(pcity));
     }
     ADD_SPRITE_FULL(get_city_sprite(pcity));
+    if (!is_isometric && city_got_citywalls(pcity)) {
+      /* In iso-view the city wall is a part of the city sprite. */
+      ADD_SPRITE_SIMPLE(get_city_wall_sprite(pcity));
+    }
     if (pcity->client.unhappy) {
       ADD_SPRITE_FULL(sprites.city.disorder);
     }
   }
 
-  if (draw_fortress_airbase && contains_special(tspecial, S_AIRBASE)) {
-    ADD_SPRITE_FULL(sprites.tx.airbase);
-  }
+  if (!unit_only && !city_only) {
+    if (draw_fortress_airbase && contains_special(tspecial, S_AIRBASE)) {
+      ADD_SPRITE_FULL(sprites.tx.airbase);
+    }
 
-  if (draw_pollution && contains_special(tspecial, S_POLLUTION)) {
-    ADD_SPRITE_SIMPLE(sprites.tx.pollution);
+    if (draw_pollution && contains_special(tspecial, S_POLLUTION)) {
+      ADD_SPRITE_SIMPLE(sprites.tx.pollution);
+    }
+    if (draw_pollution && contains_special(tspecial, S_FALLOUT)) {
+      ADD_SPRITE_SIMPLE(sprites.tx.fallout);
+    }
   }
-  if (draw_pollution && contains_special(tspecial, S_FALLOUT)) {
-    ADD_SPRITE_SIMPLE(sprites.tx.fallout);
+
+  if (!is_isometric && draw_fog_of_war
+      && tile_get_known(map_x, map_y) == TILE_KNOWN_FOGGED) {
+    /* Fogging in non-iso is done this way. */
+    ADD_SPRITE_SIMPLE(sprites.tx.fog);
   }
 
   /* City size.  Drawing this under fog makes it hard to read. */
-  if (pcity && draw_cities) {
+  if (pcity && draw_cities && !unit_only) {
     if (pcity->size >= 10) {
       ADD_SPRITE(sprites.city.size_tens[pcity->size / 10], DRAW_FULL,
                 FALSE, 0, 0);
@@ -2258,164 +2240,25 @@
               FALSE, 0, 0);
   }
 
-  if (punit && (draw_units || (punit == pfocus && draw_focus_unit))) {
-    bool stacked = (unit_list_size(&map_get_tile(x, y)->units) > 1);
-    bool backdrop = !pcity;
-
-    sprs += fill_unit_sprite_array(sprs, punit, solid_bg, stacked, backdrop);
-  }
-
-  if (draw_fortress_airbase && contains_special(tspecial, S_FORTRESS)) {
-    ADD_SPRITE_FULL(sprites.tx.fortress);
-  }
-
-  return sprs - save_sprs;
-}
-
-/**********************************************************************
-  Fill in the sprite array for the tile at position (abs_x0,abs_y0)
-
-The sprites are drawn in the following order:
- 1) basic terrain type
- 2) river
- 3) irritation
- 4) road/railroad
- 5) specials
- 6) mine
- 7) hut
- 8) fortress
- 9) airbase
-10) pollution
-11) fallout
-12) FoW
-***********************************************************************/
-int fill_tile_sprite_array(struct drawn_sprite *sprs, int abs_x0, int abs_y0,
-                          bool citymode, bool *solid_bg,
-                          enum color_std *bg_color)
-{
-  enum tile_terrain_type ttype, ttype_near[8];
-  enum tile_special_type tspecial, tspecial_near[8];
-  int dir, tileno;
-  struct tile *ptile;
-  struct city *pcity;
-  struct unit *pfocus;
-  struct unit *punit;
-  struct drawn_sprite *save_sprs = sprs;
-
-  *solid_bg = FALSE;
-  *bg_color = COLOR_STD_BACKGROUND;
-
-  ptile=map_get_tile(abs_x0, abs_y0);
-
-  if (tile_get_known(abs_x0, abs_y0) == TILE_UNKNOWN) {
-    return 0;
-  }
-
-  pcity=map_get_city(abs_x0, abs_y0);
-  pfocus=get_unit_in_focus();
-
-  if (solid_color_behind_units) {
-    punit = get_drawable_unit(abs_x0, abs_y0, citymode);
-    if (punit && (draw_units || (draw_focus_unit && pfocus == punit))) {
-      bool stacked = (unit_list_size(&ptile->units) > 1);
-
-      sprs += fill_unit_sprite_array(sprs, punit, solid_bg,
-                                    stacked, TRUE);
-
-      *bg_color = player_color(unit_owner(punit));
-      return sprs - save_sprs;
-    }
-
-    if (pcity && draw_cities) {
-      sprs += fill_city_sprite_array(sprs, pcity, solid_bg);
-      *bg_color = player_color(city_owner(pcity));
-      return sprs - save_sprs;
-    }
-  }
-
-  build_tile_data(abs_x0, abs_y0, 
-                 &ttype, &tspecial, ttype_near, tspecial_near);
-
-  sprs += fill_terrain_sprite_array(sprs, abs_x0, abs_y0, ttype_near);
+  if (punit && !city_only
+      && (draw_units || (punit == pfocus && draw_focus_unit))) {
+    bool stacked = (unit_list_size(&map_get_tile(map_x, map_y)->units) > 1);
+    bool backdrop = !pcity && !unit_only;
+    bool dummy;
 
-  if (!draw_terrain) {
-    *solid_bg = TRUE;
+    sprs += fill_unit_sprite_array(sprs, punit, &dummy, stacked, backdrop);
   }
 
-  if (is_ocean(ttype) && draw_terrain) {
-    for (dir = 0; dir < 4; dir++) {
-      if (contains_special(tspecial_near[DIR4_TO_DIR8[dir]], S_RIVER)) {
-       ADD_SPRITE_SIMPLE(sprites.tx.river_outlet[dir]);
-      }
+  if (!unit_only && !city_only) {
+    if (draw_fortress_airbase && contains_special(tspecial, S_FORTRESS)) {
+      ADD_SPRITE_FULL(sprites.tx.fortress);
     }
   }
 
-  if (contains_special(tspecial, S_RIVER) && draw_terrain) {
-    tileno = INDEX_NSEW(contains_special(tspecial_near[DIR8_NORTH], S_RIVER)
-                       || is_ocean(ttype_near[DIR8_NORTH]),
-                       contains_special(tspecial_near[DIR8_SOUTH], S_RIVER)
-                       || is_ocean(ttype_near[DIR8_SOUTH]),
-                       contains_special(tspecial_near[DIR8_EAST], S_RIVER)
-                       || is_ocean(ttype_near[DIR8_EAST]),
-                       contains_special(tspecial_near[DIR8_WEST], S_RIVER)
-                       || is_ocean(ttype_near[DIR8_WEST]));
-    ADD_SPRITE_SIMPLE(sprites.tx.spec_river[tileno]);
-  }
-
-  sprs += fill_irrigation_sprite_array(sprs, tspecial, tspecial_near, pcity);
-  sprs += fill_road_rail_sprite_array(sprs, tspecial, tspecial_near, pcity);
-
-  if(draw_specials) {
-    if (contains_special(tspecial, S_SPECIAL_1))
-      ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->special[0]);
-    else if (contains_special(tspecial, S_SPECIAL_2))
-      ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->special[1]);
-  }
-
-  if (draw_mines && contains_special(tspecial, S_MINE)
-      && sprites.terrain[ttype]->mine) {
-    ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->mine);
-  }
-
-  if(contains_special(tspecial, S_HUT) && draw_specials) {
-    ADD_SPRITE_SIMPLE(sprites.tx.village);
-  }
-  if(contains_special(tspecial, S_FORTRESS) && draw_fortress_airbase) {
-    ADD_SPRITE_SIMPLE(sprites.tx.fortress);
-  }
-  if(contains_special(tspecial, S_AIRBASE) && draw_fortress_airbase) {
-    ADD_SPRITE_SIMPLE(sprites.tx.airbase);
-  }
-  if(contains_special(tspecial, S_POLLUTION) && draw_pollution) {
-    ADD_SPRITE_SIMPLE(sprites.tx.pollution);
-  }
-  if(contains_special(tspecial, S_FALLOUT) && draw_pollution) {
-    ADD_SPRITE_SIMPLE(sprites.tx.fallout);
-  }
-  if(tile_get_known(abs_x0,abs_y0) == TILE_KNOWN_FOGGED && draw_fog_of_war) {
-    ADD_SPRITE_SIMPLE(sprites.tx.fog);
-  }
-
-  if (pcity && draw_cities) {
-    bool dummy;
-
-    sprs += fill_city_sprite_array(sprs, pcity, &dummy);
-  }
-
-  punit = find_visible_unit(ptile);
-  if (punit) {
-    if (!citymode || punit->owner != game.player_idx) {
-      if ((!focus_unit_hidden || pfocus != punit) &&
-         (draw_units || (draw_focus_unit && !focus_unit_hidden
-                         && punit == pfocus))) {
-       bool dummy;
-       bool stacked = (unit_list_size(&ptile->units) > 1);
-       bool backdrop = !pcity;
-
-       sprs += fill_unit_sprite_array(sprs, punit, &dummy,
-                                      stacked, backdrop);
-      }
-    }
+  if (!is_isometric) {
+    /* Add grid.  In iso-view this is done earlier. */
+    sprs->type = DRAWN_GRID;
+    sprs++;
   }
 
   return sprs - save_sprs;
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.62
diff -u -r1.62 tilespec.h
--- client/tilespec.h   22 Apr 2004 21:07:32 -0000      1.62
+++ client/tilespec.h   23 Apr 2004 01:20:32 -0000
@@ -66,15 +66,11 @@
 
 /* Gfx support */
 
-int fill_tile_sprite_array_iso(struct drawn_sprite *sprs,
-                              int x, int y, bool citymode, bool *solid_bg);
-int fill_tile_sprite_array(struct drawn_sprite *sprs, int abs_x0, int abs_y0,
-                          bool citymode, bool *solid_bg,
-                          enum color_std *bg_color);
+int fill_tile_sprite_array(struct drawn_sprite *sprs,
+                          bool *solid_bg, enum color_std *bg_color,
+                          int map_x, int map_y, bool citymode);
 int fill_unit_sprite_array(struct drawn_sprite *sprs, struct unit *punit,
                           bool *solid_bg, bool stack, bool backdrop);
-int fill_city_sprite_array_iso(struct drawn_sprite *sprs,
-                              struct city *pcity);
 
 enum color_std player_color(struct player *pplayer);
 enum color_std overview_tile_color(int x, int y);
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.120
diff -u -r1.120 mapview.c
--- client/gui-gtk-2.0/mapview.c        22 Apr 2004 21:07:32 -0000      1.120
+++ client/gui-gtk-2.0/mapview.c        23 Apr 2004 01:20:32 -0000
@@ -1084,13 +1084,14 @@
   struct drawn_sprite tile_sprs[80];
   int count, i;
   bool solid_bg, fog;
+  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_iso(tile_sprs,
-                                    x, y, citymode, &solid_bg);
+  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,
@@ -1107,7 +1108,7 @@
   if (solid_bg) {
     gdk_gc_set_clip_origin(fill_bg_gc, canvas_x, canvas_y);
     gdk_gc_set_clip_mask(fill_bg_gc, sprites.black_tile->mask);
-    gdk_gc_set_foreground(fill_bg_gc, colors_standard[COLOR_STD_BACKGROUND]);
+    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,

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8574) merge fill_tile_sprite_array[_iso], Jason Short <=