Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2005:
[Freeciv-Dev] (PR#13240) Feature: colour overview by players colors
Home

[Freeciv-Dev] (PR#13240) Feature: colour overview by players colors

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13240) Feature: colour overview by players colors
From: "Egor Vyscrebentsov" <evyscr@xxxxxxxxx>
Date: Wed, 8 Jun 2005 11:48:58 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Good daytime!

At 2005-06-01 midnight, Katze on #freeciv-dev suggest to use players colors
(get_player_color()) in overview for players territory tiles.

I hope, attached patch implement this idea.

Thanks, evyscr.

Index: client/overview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/overview_common.c,v
retrieving revision 1.11
diff -u -r1.11 overview_common.c
--- client/overview_common.c    7 Jun 2005 16:18:53 -0000       1.11
+++ client/overview_common.c    8 Jun 2005 18:28:02 -0000
@@ -100,42 +100,47 @@
 /****************************************************************************
   Return color for overview map tile.
 ****************************************************************************/
-static enum color_std overview_tile_color(struct tile *ptile)
+static struct color *overview_tile_color(struct tile *ptile)
 {
   struct unit *punit;
   struct city *pcity;
+  struct player *pplayer;
 
   if (client_tile_get_known(ptile) == TILE_UNKNOWN) {
-    return COLOR_OVERVIEW_UNKNOWN;
+    return get_color(tileset, COLOR_OVERVIEW_UNKNOWN);
   } else if ((pcity = tile_get_city(ptile))) {
     if (pcity->owner == game.info.player_idx) {
-      return COLOR_OVERVIEW_MY_CITY;
+      return get_color(tileset, COLOR_OVERVIEW_MY_CITY);
     } else if (pplayers_allied(city_owner(pcity), game.player_ptr)) {
       /* Includes teams. */
-      return COLOR_OVERVIEW_ALLIED_CITY;
+      return get_color(tileset, COLOR_OVERVIEW_ALLIED_CITY);
     } else {
-      return COLOR_OVERVIEW_ENEMY_CITY;
+      return get_color(tileset, COLOR_OVERVIEW_ENEMY_CITY);
     }
   } else if ((punit = find_visible_unit(ptile))) {
     if (punit->owner == game.info.player_idx) {
-      return COLOR_OVERVIEW_MY_UNIT;
+      return get_color(tileset, COLOR_OVERVIEW_MY_UNIT);
     } else if (pplayers_allied(unit_owner(punit), game.player_ptr)) {
       /* Includes teams. */
-      return COLOR_OVERVIEW_ALLIED_UNIT;
+      return get_color(tileset, COLOR_OVERVIEW_ALLIED_UNIT);
     } else {
-      return COLOR_OVERVIEW_ENEMY_UNIT;
+      return get_color(tileset, COLOR_OVERVIEW_ENEMY_UNIT);
     }
   } else if (is_ocean(ptile->terrain)) {
     if (client_tile_get_known(ptile) == TILE_KNOWN_FOGGED && draw_fog_of_war) {
-      return COLOR_OVERVIEW_FOGGED_OCEAN;
+      return get_color(tileset, COLOR_OVERVIEW_FOGGED_OCEAN);
     } else {
-      return COLOR_OVERVIEW_OCEAN;
+      return get_color(tileset, COLOR_OVERVIEW_OCEAN);
     }
   } else {
     if (client_tile_get_known(ptile) == TILE_KNOWN_FOGGED && draw_fog_of_war) {
-      return COLOR_OVERVIEW_FOGGED_LAND;
+      return get_color(tileset, COLOR_OVERVIEW_FOGGED_LAND);
     } else {
-      return COLOR_OVERVIEW_LAND;
+      if ((pplayer = tile_get_owner(ptile)) != NULL) {
+       return get_player_color(tileset, pplayer);
+      } else {
+       return get_color(tileset, COLOR_OVERVIEW_LAND);
+      }
     }
   }
 }
@@ -340,8 +345,7 @@
          /* This tile is shown half on the left and half on the right
           * side of the overview.  So we have to draw it in two parts. */
          canvas_put_rectangle(overview.map,
-                              get_color(tileset,
-                                        overview_tile_color(ptile)),
+                              overview_tile_color(ptile),
                               overview_x - overview.width, overview_y,
                               OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT); 
        }     
@@ -352,8 +356,7 @@
       }
     } 
 
-    canvas_put_rectangle(overview.map,
-                        get_color(tileset, overview_tile_color(ptile)),
+    canvas_put_rectangle(overview.map, overview_tile_color(ptile),
                         overview_x, overview_y,
                         OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13240) Feature: colour overview by players colors, Egor Vyscrebentsov <=