Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] (PR#8520) fill_tile_sprite_array should return a color, no
Home

[Freeciv-Dev] (PR#8520) fill_tile_sprite_array should return a color, no

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8520) fill_tile_sprite_array should return a color, not a player
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Apr 2004 14:45:37 -0700
Reply-to: rt@xxxxxxxxxxx

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

fill_tile_sprite_array returns a pplayer.  This is used to determine the 
background color if solid_bg is set.

Instead the middle-man should be cut out and fill_tile_sprite_array 
should just return the background color.

jason

Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.101
diff -u -r1.101 mapview_common.c
--- client/mapview_common.c     15 Apr 2004 19:36:00 -0000      1.101
+++ client/mapview_common.c     15 Apr 2004 21:45:44 -0000
@@ -993,18 +993,16 @@
 {
   struct drawn_sprite tile_sprs[80];
   bool solid_bg;
-  struct player *pplayer;
+  enum color_std bg_color;
   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, &pplayer);
+                                      &solid_bg, &bg_color);
     int i = 0;
 
     if (solid_bg) {
-      enum color_std color = pplayer ? player_color(pplayer)
-             : COLOR_STD_BACKGROUND;
-      canvas_put_rectangle(pcanvas, color, canvas_x, canvas_y,
+      canvas_put_rectangle(pcanvas, bg_color, canvas_x, canvas_y,
                           NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT);
     }
 
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.157
diff -u -r1.157 tilespec.c
--- client/tilespec.c   12 Apr 2004 17:15:06 -0000      1.157
+++ client/tilespec.c   15 Apr 2004 21:45:44 -0000
@@ -2270,7 +2270,7 @@
 ***********************************************************************/
 int fill_tile_sprite_array(struct drawn_sprite *sprs, int abs_x0, int abs_y0,
                           bool citymode, bool *solid_bg,
-                          struct player **pplayer)
+                          enum color_std *bg_color)
 {
   enum tile_terrain_type ttype, ttype_near[8];
   enum tile_special_type tspecial, tspecial_near[8];
@@ -2280,8 +2280,9 @@
   struct unit *pfocus;
   struct unit *punit;
   struct drawn_sprite *save_sprs = sprs;
+
   *solid_bg = FALSE;
-  *pplayer = NULL;
+  *bg_color = COLOR_STD_BACKGROUND;
 
   ptile=map_get_tile(abs_x0, abs_y0);
 
@@ -2300,13 +2301,13 @@
       sprs += fill_unit_sprite_array(sprs, punit, solid_bg,
                                     stacked, TRUE);
 
-      *pplayer = unit_owner(punit);
+      *bg_color = player_color(unit_owner(punit));
       return sprs - save_sprs;
     }
 
     if (pcity && draw_cities) {
       sprs += fill_city_sprite_array(sprs, pcity, solid_bg);
-      *pplayer = city_owner(pcity);
+      *bg_color = player_color(city_owner(pcity));
       return sprs - save_sprs;
     }
   }
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.60
diff -u -r1.60 tilespec.h
--- client/tilespec.h   12 Apr 2004 17:15:06 -0000      1.60
+++ client/tilespec.h   15 Apr 2004 21:45:44 -0000
@@ -56,7 +56,7 @@
                               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,
-                          struct player **pplayer);
+                          enum color_std *bg_color);
 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,

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8520) fill_tile_sprite_array should return a color, not a player, Jason Short <=