Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2005:
[Freeciv-Dev] (PR#13047) rewrite color enum
Home

[Freeciv-Dev] (PR#13047) rewrite color enum

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13047) rewrite color enum
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 11 May 2005 14:25:45 -0700
Reply-to: bugs@xxxxxxxxxxx

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

This patch rewrites the color_std enumeration.  The new colors are
enumerated by task rather than by color (which was mixed in with task).

The idea is that colors should be defined in the tileset.  The author
should have control over each color used for each task.  Thus if you
need a new task you add a new entry to the enumeration even if the color
you want is already there somewhere.  This is opposed to the old method
of finding the closest-matching color, assuming it won't ever change,
and just using it.

The idea was inspired by the desire for more colors in the overview.

-jason

? colors.diff
? common/team.c
? common/team.h
Index: client/citydlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/citydlg_common.c,v
retrieving revision 1.78
diff -u -r1.78 citydlg_common.c
--- client/citydlg_common.c     10 May 2005 23:44:06 -0000      1.78
+++ client/citydlg_common.c     11 May 2005 21:23:18 -0000
@@ -173,7 +173,7 @@
                            struct canvas *pcanvas)
 {
   /* First make it all black. */
-  canvas_put_rectangle(pcanvas, get_color(COLOR_STD_BLACK), 0, 0,
+  canvas_put_rectangle(pcanvas, get_color(COLOR_MAPVIEW_UNKNOWN), 0, 0,
                       get_citydlg_canvas_width(),
                       get_citydlg_canvas_height());
 
Index: client/colors_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/colors_common.c,v
retrieving revision 1.2
diff -u -r1.2 colors_common.c
--- client/colors_common.c      11 May 2005 20:35:29 -0000      1.2
+++ client/colors_common.c      11 May 2005 21:23:18 -0000
@@ -29,31 +29,40 @@
   int r, g, b;
 };
 
-struct rgbtriple colors_standard_rgb[COLOR_STD_LAST] = {
-  {  0,   0,   0},  /* Black */
-  {255, 255, 255},  /* White */
-  {255,   0,   0},  /* Red */
-  {255, 255,   0},  /* Yellow */
-  {  0, 255, 200},  /* Cyan */
-  {  0, 200,   0},  /* Ground (green) */
-  {  0,   0, 200},  /* Ocean (blue) */
-  { 86,  86,  86},  /* Background (gray) */
+struct rgbtriple colors_standard_rgb[] = {
+
+  /* Mapview */
+  {  0,   0,   0},  /* unknown */
+  {255, 255, 255},  /* citytext */
+  {255,   0,   0},  /* citytext/blocked growth */
+  {  0, 255, 200},  /* goto */
+  {255, 255,   0},  /* selection */
+
+  /* Spaceship */
+  {  0,   0,   0},  /* background */
+
+  /* Overview */
+  {  0,   0,   0},  /* unknown */
+  {255, 255, 255},  /* my city */
+  {  0, 255, 200},  /* enemy city */
+  {255, 255,   0},  /* my unit */
+  {255,   0,   0},  /* enemy unit */
+  {  0,   0, 200},  /* ocean */
+  {  0,   0, 128},  /* fogged ocean */
+  {  0, 200,   0},  /* ground */
+  { 86,  86,  86},  /* fogged ground */
+  {255, 255, 255},  /* viewrect */
+
+  /* Reqtree */
+  {  0, 255, 200},  /* researching */
+  {  0, 200,   0},  /* known */
+  {255, 128, 128},  /* reachable goal */
+  {255,   0, 128},  /* unreachable goal */
+  {255, 255,   0},  /* reachable */
+  {255,   0,   0},  /* unreachable */
+  {  0,   0,   0},  /* background */
+  {  0,   0,   0},  /* text */
 
-  /* TODO: Rename these appropriately. */
-  {128,   0,   0},  /* race0 */
-  {128, 255, 255},  /* race1 */
-  {255,   0,   0},  /* race2 */
-  {255,   0, 128},  /* race3 */
-  {  0,   0, 128},  /* race4 */
-  {255,   0, 255},  /* race5 */
-  {255, 128,   0},  /* race6 */
-  {255, 255, 128},  /* race7 */
-  {255, 128, 128},  /* race8 */
-  {  0,   0, 255},  /* race9 */
-  {  0, 255,   0},  /* race10 */
-  {  0, 128, 128},  /* race11 */
-  {  0,  64,  64},  /* race12 */
-  {198, 198, 198},  /* race13 */
 };
 
 struct rgbtriple colors_player_rgb[] = {
@@ -73,7 +82,7 @@
   {198, 198, 198},  /* race13 */
 };
 
-static struct color *colors[COLOR_STD_LAST];
+static struct color *colors[COLOR_LAST];
 static struct color *player_colors[ARRAY_SIZE(colors_player_rgb)];
 
 static bool initted = FALSE;
@@ -91,7 +100,8 @@
   assert(!initted);
   initted = TRUE;
 
-  for (i = 0; i < COLOR_STD_LAST; i++) {
+  assert(ARRAY_SIZE(colors) == COLOR_LAST);
+  for (i = 0; i < COLOR_LAST; i++) {
     colors[i] = color_alloc(colors_standard_rgb[i].r,
                            colors_standard_rgb[i].g,
                            colors_standard_rgb[i].b);
@@ -114,7 +124,7 @@
   assert(initted);
   initted = FALSE;
 
-  for (i = 0; i < COLOR_STD_LAST; i++) {
+  for (i = 0; i < COLOR_LAST; i++) {
     color_free(colors[i]);
   }
   for (i = 0; i < ARRAY_SIZE(player_colors); i++) {
Index: client/colors_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/colors_common.h,v
retrieving revision 1.2
diff -u -r1.2 colors_common.h
--- client/colors_common.h      11 May 2005 20:35:29 -0000      1.2
+++ client/colors_common.h      11 May 2005 21:23:18 -0000
@@ -21,18 +21,40 @@
 
 struct color;
 
-enum color_std { 
-  COLOR_STD_BLACK, COLOR_STD_WHITE, COLOR_STD_RED,
-  COLOR_STD_YELLOW, COLOR_STD_CYAN,
-  COLOR_STD_GROUND, COLOR_STD_OCEAN,
-  COLOR_STD_BACKGROUND,
-  COLOR_STD_RACE0, COLOR_STD_RACE1, COLOR_STD_RACE2,
-  COLOR_STD_RACE3, COLOR_STD_RACE4, COLOR_STD_RACE5,
-  COLOR_STD_RACE6, COLOR_STD_RACE7, COLOR_STD_RACE8,
-  COLOR_STD_RACE9, COLOR_STD_RACE10, COLOR_STD_RACE11,
-  COLOR_STD_RACE12, COLOR_STD_RACE13,
+enum color_std {
+  /* Mapview colors */
+  COLOR_MAPVIEW_UNKNOWN, /* Black */
+  COLOR_MAPVIEW_CITYTEXT, /* white */
+  COLOR_MAPVIEW_CITYGROWTH_BLOCKED, /* red */
+  COLOR_MAPVIEW_GOTO, /* cyan */
+  COLOR_MAPVIEW_SELECTION, /* yellow */
 
-  COLOR_STD_LAST
+  /* Spaceship colors */
+  COLOR_SPACESHIP_BACKGROUND, /* black */
+
+  /* Overview colors */
+  COLOR_OVERVIEW_UNKNOWN, /* Black */
+  COLOR_OVERVIEW_MY_CITY, /* white */
+  COLOR_OVERVIEW_ENEMY_CITY, /* cyan */
+  COLOR_OVERVIEW_MY_UNIT, /* yellow */
+  COLOR_OVERVIEW_ENEMY_UNIT, /* red */
+  COLOR_OVERVIEW_OCEAN, /* ocean/blue */
+  COLOR_OVERVIEW_FOGGED_OCEAN, /* race4/dark blue */
+  COLOR_OVERVIEW_LAND, /* ground/green */
+  COLOR_OVERVIEW_FOGGED_LAND, /* background/gray */
+  COLOR_OVERVIEW_VIEWRECT, /* white */
+
+  /* Reqtree colors */
+  COLOR_REQTREE_RESEARCHING, /* cyan */
+  COLOR_REQTREE_KNOWN, /* ground/green */
+  COLOR_REQTREE_REACHABLE_GOAL, /* race8 */
+  COLOR_REQTREE_UNREACHABLE_GOAL, /* race3 */
+  COLOR_REQTREE_REACHABLE, /* yellow */
+  COLOR_REQTREE_UNREACHABLE, /* red */
+  COLOR_REQTREE_BACKGROUND, /* black */
+  COLOR_REQTREE_TEXT, /* black */
+
+  COLOR_LAST
 };
 
 void init_color_system(void);
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.237
diff -u -r1.237 mapview_common.c
--- client/mapview_common.c     11 May 2005 20:54:30 -0000      1.237
+++ client/mapview_common.c     11 May 2005 21:23:19 -0000
@@ -1119,7 +1119,7 @@
    *
    * Of course it's necessary to draw to the whole area to cover up any old
    * drawing that was done there. */
-  canvas_put_rectangle(mapview.store, get_color(COLOR_STD_BLACK),
+  canvas_put_rectangle(mapview.store, get_color(COLOR_MAPVIEW_UNKNOWN),
                       canvas_x, canvas_y, width, height);
 
   mapview_layer_iterate(layer) {
@@ -1339,19 +1339,19 @@
                    0, height1);
     canvas_put_sprite_full(pcanvas, occupy_rect.x, occupy_rect.y, occupy);
     canvas_put_text(pcanvas, name_rect.x, name_rect.y,
-                   FONT_CITY_NAME, get_color(COLOR_STD_WHITE), name);
+                   FONT_CITY_NAME, get_color(COLOR_MAPVIEW_CITYTEXT), name);
 
     canvas_put_rectangle(pcanvas, owner_color,
                         size_rect.x - border / 2, canvas_y,
                         size_rect.w + border, height1);
     canvas_put_text(pcanvas, size_rect.x, size_rect.y,
-                   FONT_CITY_NAME, get_color(COLOR_STD_WHITE), size);
+                   FONT_CITY_NAME, get_color(COLOR_MAPVIEW_CITYTEXT), size);
   }
   if (line2) {
     canvas_put_sprite_full(pcanvas, shield_rect.x, shield_rect.y,
                           citybar->shields);
     canvas_put_text(pcanvas, prod_rect.x, prod_rect.y,
-                   FONT_CITY_PROD, get_color(COLOR_STD_WHITE), prod);
+                   FONT_CITY_PROD, get_color(COLOR_MAPVIEW_CITYTEXT), prod);
     canvas_put_sprite_full(pcanvas, food_rect.x, food_rect.y, citybar->food);
     canvas_put_text(pcanvas, growth_rect.x, growth_rect.y,
                    FONT_CITY_PROD, get_color(growth_color), growth);
@@ -1412,7 +1412,7 @@
     total_height = MAX(name_rect.h, growth_rect.h);
     canvas_put_text(pcanvas,
                    canvas_x - total_width / 2, canvas_y,
-                   FONT_CITY_NAME, get_color(COLOR_STD_WHITE), name);
+                   FONT_CITY_NAME, get_color(COLOR_MAPVIEW_CITYTEXT), name);
     if (growth[0] != '\0') {
       canvas_put_text(pcanvas,
                      canvas_x - total_width / 2 + name_rect.w + extra_width,
@@ -1432,7 +1432,7 @@
     total_height = prod_rect.h;
 
     canvas_put_text(pcanvas, canvas_x - total_width / 2, canvas_y,
-                   FONT_CITY_PROD, get_color(COLOR_STD_WHITE), prod);
+                   FONT_CITY_PROD, get_color(COLOR_MAPVIEW_CITYTEXT), prod);
 
     canvas_y += total_height;
     *width = MAX(*width, total_width);
@@ -1578,7 +1578,7 @@
   map_to_gui_vector(tileset, &canvas_dx, &canvas_dy, DIR_DX[dir], DIR_DY[dir]);
 
   /* Draw the segment. */
-  canvas_put_line(mapview.store, get_color(COLOR_STD_CYAN), LINE_GOTO,
+  canvas_put_line(mapview.store, get_color(COLOR_MAPVIEW_GOTO), LINE_GOTO,
                  canvas_x, canvas_y, canvas_dx, canvas_dy);
 
   /* The actual area drawn will extend beyond the base rectangle, since
@@ -2105,13 +2105,13 @@
 
     if (turns <= 0) {
       /* A blocked or shrinking city has its growth status shown in red. */
-      *growth_color = COLOR_STD_RED;
+      *growth_color = COLOR_MAPVIEW_CITYGROWTH_BLOCKED;
     } else {
-      *growth_color = COLOR_STD_WHITE;
+      *growth_color = COLOR_MAPVIEW_CITYTEXT;
     }
   } else {
     growth_buffer[0] = '\0';
-    *growth_color = COLOR_STD_WHITE;
+    *growth_color = COLOR_MAPVIEW_CITYTEXT;
   }
 }
 
@@ -2245,7 +2245,7 @@
       canvas_free(mapview.tmp_store);
     }
     mapview.store = canvas_create(full_width, full_height);
-    canvas_put_rectangle(mapview.store, get_color(COLOR_STD_BLACK),
+    canvas_put_rectangle(mapview.store, get_color(COLOR_MAPVIEW_UNKNOWN),
                         0, 0, full_width, full_height);
 
     mapview.tmp_store = canvas_create(full_width, full_height);
@@ -2309,7 +2309,7 @@
   sprite = get_spaceship_sprite(t, SPACESHIP_HABITATION);
   get_sprite_dimensions(sprite, &w, &h);
 
-  canvas_put_rectangle(pcanvas, get_color(COLOR_STD_BLACK),
+  canvas_put_rectangle(pcanvas, get_color(COLOR_SPACESHIP_BACKGROUND),
                       0, 0, w * 7, h * 7);
 
   for (i = 0; i < NUM_SS_MODULES; i++) {
Index: client/overview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/overview_common.c,v
retrieving revision 1.8
diff -u -r1.8 overview_common.c
--- client/overview_common.c    10 May 2005 20:02:07 -0000      1.8
+++ client/overview_common.c    11 May 2005 21:23:19 -0000
@@ -106,30 +106,30 @@
   struct city *pcity;
 
   if (client_tile_get_known(ptile) == TILE_UNKNOWN) {
-    return COLOR_STD_BLACK;
+    return COLOR_OVERVIEW_UNKNOWN;
   } else if ((pcity = tile_get_city(ptile))) {
     if (pcity->owner == game.info.player_idx) {
-      return COLOR_STD_WHITE;
+      return COLOR_OVERVIEW_MY_CITY;
     } else {
-      return COLOR_STD_CYAN;
+      return COLOR_OVERVIEW_ENEMY_CITY;
     }
   } else if ((punit = find_visible_unit(ptile))) {
     if (punit->owner == game.info.player_idx) {
-      return COLOR_STD_YELLOW;
+      return COLOR_OVERVIEW_MY_UNIT;
     } else {
-      return COLOR_STD_RED;
+      return 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_STD_RACE4;
+      return COLOR_OVERVIEW_FOGGED_OCEAN;
     } else {
-      return COLOR_STD_OCEAN;
+      return COLOR_OVERVIEW_OCEAN;
     }
   } else {
     if (client_tile_get_known(ptile) == TILE_KNOWN_FOGGED && draw_fog_of_war) {
-      return COLOR_STD_BACKGROUND;
+      return COLOR_OVERVIEW_FOGGED_LAND;
     } else {
-      return COLOR_STD_GROUND;
+      return COLOR_OVERVIEW_LAND;
     }
   }
 }
@@ -176,7 +176,8 @@
     int dst_x = x[(i + 1) % 4];
     int dst_y = y[(i + 1) % 4];
 
-    canvas_put_line(overview.window, get_color(COLOR_STD_WHITE), LINE_NORMAL,
+    canvas_put_line(overview.window, get_color(COLOR_OVERVIEW_VIEWRECT),
+                   LINE_NORMAL,
                    src_x, src_y, dst_x - src_x, dst_y - src_y);
   }
 
@@ -394,7 +395,7 @@
   }
   overview.map = canvas_create(overview.width, overview.height);
   overview.window = canvas_create(overview.width, overview.height);
-  canvas_put_rectangle(overview.map, get_color(COLOR_STD_BLACK),
+  canvas_put_rectangle(overview.map, get_color(COLOR_OVERVIEW_UNKNOWN),
                       0, 0, overview.width, overview.height);
   update_map_canvas_scrollbars_size();
 
Index: client/reqtree.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/reqtree.c,v
retrieving revision 1.5
diff -u -r1.5 reqtree.c
--- client/reqtree.c    10 May 2005 23:44:06 -0000      1.5
+++ client/reqtree.c    11 May 2005 21:23:19 -0000
@@ -735,30 +735,30 @@
 {
   if (!node->is_dummy) {
     if (game.player_ptr->research->researching == node->tech) {
-      return COLOR_STD_CYAN;
+      return COLOR_REQTREE_RESEARCHING;
     }
     
     if (get_invention(game.player_ptr, node->tech) == TECH_KNOWN) {
-      return COLOR_STD_GROUND;
+      return COLOR_REQTREE_KNOWN;
     }
 
     if (is_tech_a_req_for_goal(game.player_ptr, node->tech,
                               game.player_ptr->research->tech_goal)
        || node->tech == game.player_ptr->research->tech_goal) {
       if (get_invention(game.player_ptr, node->tech) == TECH_REACHABLE) {
-       return COLOR_STD_RACE8;
+       return COLOR_REQTREE_REACHABLE_GOAL;
       } else {
-       return COLOR_STD_RACE3;
+       return COLOR_REQTREE_UNREACHABLE_GOAL;
       }
     }
 
     if (get_invention(game.player_ptr, node->tech) == TECH_REACHABLE) {
-      return COLOR_STD_YELLOW;
+      return COLOR_REQTREE_REACHABLE;
     }
 
-    return COLOR_STD_RED;
+    return COLOR_REQTREE_UNREACHABLE;
   } else {
-    return COLOR_STD_BLACK;
+    return COLOR_REQTREE_BACKGROUND;
   }
 
 }
@@ -786,7 +786,7 @@
       width = node->node_width;
       height = node->node_height;
 
-      canvas_put_rectangle(pcanvas, get_color(COLOR_STD_BLACK),
+      canvas_put_rectangle(pcanvas, get_color(COLOR_REQTREE_BACKGROUND),
                           startx, starty, width, height);
 
       if (!node->is_dummy) {
@@ -802,7 +802,7 @@
        canvas_put_text(pcanvas,
                        startx + (width - text_w) / 2,
                        starty + (height - text_h) / 2,
-                       FONT_REQTREE_TEXT, get_color(COLOR_STD_BLACK),
+                       FONT_REQTREE_TEXT, get_color(COLOR_REQTREE_TEXT),
                        text);
       }
 
@@ -815,7 +815,8 @@
        endx = dest_node->node_x;
        endy = dest_node->node_y + dest_node->node_height / 2;
 
-       canvas_put_line(pcanvas, get_color(COLOR_STD_BLACK), LINE_NORMAL,
+       canvas_put_line(pcanvas, get_color(COLOR_REQTREE_BACKGROUND),
+                       LINE_NORMAL,
                        startx, starty, endx - startx, endy - starty);
       }
     }
Index: client/gui-gtk-2.0/canvas.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/canvas.c,v
retrieving revision 1.5
diff -u -r1.5 canvas.c
--- client/gui-gtk-2.0/canvas.c 10 May 2005 20:02:07 -0000      1.5
+++ client/gui-gtk-2.0/canvas.c 11 May 2005 21:23:19 -0000
@@ -221,7 +221,8 @@
   if (pcanvas->type == CANVAS_PIXMAP) {
     gdk_gc_set_clip_origin(fill_tile_gc, canvas_x, canvas_y);
     gdk_gc_set_clip_mask(fill_tile_gc, sprite_get_mask(psprite));
-    gdk_gc_set_foreground(fill_tile_gc, &get_color(COLOR_STD_BLACK)->color);
+    gdk_gc_set_foreground(fill_tile_gc,
+                         &get_color(COLOR_MAPVIEW_UNKNOWN)->color);
     gdk_gc_set_stipple(fill_tile_gc, black50);
     gdk_gc_set_ts_origin(fill_tile_gc, canvas_x, canvas_y);
 
Index: client/gui-gtk-2.0/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_main.c,v
retrieving revision 1.123
diff -u -r1.123 gui_main.c
--- client/gui-gtk-2.0/gui_main.c       9 May 2005 18:42:19 -0000       1.123
+++ client/gui-gtk-2.0/gui_main.c       11 May 2005 21:23:19 -0000
@@ -943,9 +943,9 @@
 
   for (i = 0; i < 5; i++) {
     gtk_widget_modify_bg(GTK_WIDGET(overview_canvas), i,
-                        &get_color(COLOR_STD_BLACK)->color);
+                        &get_color(COLOR_OVERVIEW_UNKNOWN)->color);
     gtk_widget_modify_bg(GTK_WIDGET(map_canvas), i,
-                        &get_color(COLOR_STD_BLACK)->color);
+                        &get_color(COLOR_MAPVIEW_UNKNOWN)->color);
   }
 
   gtk_widget_add_events(map_canvas, GDK_EXPOSURE_MASK
Index: client/gui-gtk-2.0/gui_stuff.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_stuff.c,v
retrieving revision 1.22
diff -u -r1.22 gui_stuff.c
--- client/gui-gtk-2.0/gui_stuff.c      9 May 2005 18:42:19 -0000       1.22
+++ client/gui-gtk-2.0/gui_stuff.c      11 May 2005 21:23:19 -0000
@@ -681,9 +681,11 @@
 
       if (current != n) {
        GtkWidget *label = dlg->v.tab.label;
+       GdkColormap *cmap = gtk_widget_get_default_colormap();
+       GdkColor color = {.red = 255 << 8, .green = 0, .blue = 0};
 
-       gtk_widget_modify_fg(label, GTK_STATE_ACTIVE,
-                            &get_color(COLOR_STD_RED)->color);
+       gdk_rgb_find_color(cmap, &color);
+       gtk_widget_modify_fg(label, GTK_STATE_ACTIVE, &color);
       }
     }
     break;
@@ -729,9 +731,11 @@
 
       if (current != n) {
        GtkWidget *label = dlg->v.tab.label;
+       GdkColormap *cmap = gtk_widget_get_default_colormap();
+       GdkColor color = {.red = 0, .green = 0, .blue = 255 << 8};
 
-       gtk_widget_modify_fg(label, GTK_STATE_ACTIVE,
-                            &get_color(COLOR_STD_RACE9)->color);
+       gdk_rgb_find_color(cmap, &color);
+       gtk_widget_modify_fg(label, GTK_STATE_ACTIVE, &color);
       }
     }
     break;
Index: client/gui-gtk-2.0/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/helpdlg.c,v
retrieving revision 1.49
diff -u -r1.49 helpdlg.c
--- client/gui-gtk-2.0/helpdlg.c        11 May 2005 14:11:20 -0000      1.49
+++ client/gui-gtk-2.0/helpdlg.c        11 May 2005 21:23:20 -0000
@@ -187,7 +187,7 @@
   GValue        value = { 0, };
 
   if (advances[tech].req[0] == A_LAST && advances[tech].req[1] == A_LAST) {
-    bg = COLOR_STD_RED;
+    bg = COLOR_REQTREE_UNREACHABLE;
 
     gtk_tree_store_append(tstore, &l, parent);
     help_advances[tech] = TRUE;
@@ -205,11 +205,17 @@
     return;
   }
 
+  bg = COLOR_REQTREE_BACKGROUND;
   switch (get_invention(game.player_ptr, tech)) {
-  case TECH_UNKNOWN:         bg = COLOR_STD_RED;             break;
-  case TECH_KNOWN:           bg = COLOR_STD_GROUND;          break;
-  case TECH_REACHABLE:        bg = COLOR_STD_YELLOW;         break;
-  default:                   bg = COLOR_STD_WHITE;           break;
+  case TECH_UNKNOWN:
+    bg = COLOR_REQTREE_UNREACHABLE;
+    break;
+  case TECH_KNOWN:
+    bg = COLOR_REQTREE_KNOWN;
+    break;
+  case TECH_REACHABLE:
+    bg = COLOR_REQTREE_REACHABLE;
+    break;
   }
   turns_to_tech = num_unknown_techs_for_goal(game.player_ptr, tech);
 
Index: client/gui-gtk-2.0/mapctrl.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapctrl.c,v
retrieving revision 1.50
diff -u -r1.50 mapctrl.c
--- client/gui-gtk-2.0/mapctrl.c        2 May 2005 15:42:52 -0000       1.50
+++ client/gui-gtk-2.0/mapctrl.c        11 May 2005 21:23:20 -0000
@@ -48,9 +48,6 @@
 
 #include "mapctrl.h"
 
-/* Color to use to display the workers */
-int city_workers_color=COLOR_STD_WHITE;
-
 struct tmousepos { int x, y; };
 
 /**************************************************************************
Index: client/gui-gtk-2.0/mapctrl.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapctrl.h,v
retrieving revision 1.9
diff -u -r1.9 mapctrl.h
--- client/gui-gtk-2.0/mapctrl.h        3 Apr 2005 11:34:58 -0000       1.9
+++ client/gui-gtk-2.0/mapctrl.h        11 May 2005 21:23:20 -0000
@@ -30,7 +30,4 @@
 void center_on_unit(void);
 void popupinfo_popdown_callback(GtkWidget *w, gpointer data);
 
-/* Color to use to display the workers */
-extern int city_workers_color;
-
 #endif  /* FC__MAPCTRL_H */
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.174
diff -u -r1.174 mapview.c
--- client/gui-gtk-2.0/mapview.c        9 May 2005 18:42:19 -0000       1.174
+++ client/gui-gtk-2.0/mapview.c        11 May 2005 21:23:20 -0000
@@ -650,7 +650,8 @@
   if (fog) {
     gdk_gc_set_clip_origin(fill_tile_gc, canvas_x, canvas_y);
     gdk_gc_set_clip_mask(fill_tile_gc, sprite_get_mask(ssprite));
-    gdk_gc_set_foreground(fill_tile_gc, &get_color(COLOR_STD_BLACK)->color);
+    gdk_gc_set_foreground(fill_tile_gc,
+                         &get_color(COLOR_MAPVIEW_UNKNOWN)->color);
     gdk_gc_set_ts_origin(fill_tile_gc, canvas_x, canvas_y);
     gdk_gc_set_stipple(fill_tile_gc, black50);
 
@@ -741,7 +742,8 @@
 {
   GdkPoint points[5];
 
-  gdk_gc_set_foreground(civ_gc, &get_color(COLOR_STD_YELLOW)->color);
+  gdk_gc_set_foreground(civ_gc,
+                       &get_color(COLOR_MAPVIEW_SELECTION)->color);
 
   /* gdk_draw_rectangle() must start top-left.. */
   points[0].x = canvas_x;
Index: client/gui-gtk-2.0/plrdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/plrdlg.c,v
retrieving revision 1.60
diff -u -r1.60 plrdlg.c
--- client/gui-gtk-2.0/plrdlg.c 11 May 2005 20:35:29 -0000      1.60
+++ client/gui-gtk-2.0/plrdlg.c 11 May 2005 21:23:20 -0000
@@ -110,7 +110,7 @@
 
   pixmap = gdk_pixmap_new(root_window, width, height, -1);
 
-  gdk_gc_set_foreground(civ_gc, &get_color(COLOR_STD_BLACK)->color);
+  gdk_gc_set_foreground(civ_gc, &get_player_color(0)->color);
   gdk_draw_rectangle(pixmap, civ_gc, TRUE, 0, 0, width, height);
 
   gdk_gc_set_foreground(civ_gc, &get_player_color(plr)->color);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13047) rewrite color enum, Jason Short <=