Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2003:
[Freeciv-Dev] (PR#2956) Proposal (with patch): abolish the flags_are_tra
Home

[Freeciv-Dev] (PR#2956) Proposal (with patch): abolish the flags_are_tra

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#2956) Proposal (with patch): abolish the flags_are_transparent flag
From: "esr@xxxxxxxxxxx via RT" <rt@xxxxxxxxxxxxxx>
Date: Fri, 31 Jan 2003 17:50:25 -0800
Reply-to: rt@xxxxxxxxxxxxxx

It defaults to "on".  I can't find a tileset anywhere that turns it off 
(and I've been looking through the up-to-date contrib ones).  If we nuke
it, we can get rid of a lot of grubby special-case code.   (I *like*
simplifying code.  Had you noticed that yet? :-))

Let it die.

Patch attached.
-- 
                <a href="http://www.catb.org/~esr/";>Eric S. Raymond</a>

Diffs between last version checked in and current workfile(s):

--- client/gui-gtk/citydlg.c.~1.153.~   2003-01-30 23:43:21.000000000 -0500
+++ client/gui-gtk/citydlg.c    2003-01-31 04:15:28.000000000 -0500
@@ -2052,10 +2052,9 @@
        ITERATOR_NEXT(myiter), i++) {
     punit = (struct unit *) ITERATOR_PTR(myiter);
 
-    if (flags_are_transparent)
-      gtk_pixcomm_clear(GTK_PIXCOMM
-                       (pdialog->overview.supported_unit_pixmaps[i]),
-                       FALSE);
+    gtk_pixcomm_clear(GTK_PIXCOMM
+                     (pdialog->overview.supported_unit_pixmaps[i]),
+                     FALSE);
 
     put_unit_gpixmap(punit,
                     GTK_PIXCOMM(pdialog->
@@ -2105,9 +2104,8 @@
        ITERATOR_NEXT(myiter), i++) {
     punit = (struct unit *) ITERATOR_PTR(myiter);
 
-    if (flags_are_transparent)
-      gtk_pixcomm_clear(GTK_PIXCOMM
-                       (pdialog->unit.supported_unit_pixmaps[i]), FALSE);
+    gtk_pixcomm_clear(GTK_PIXCOMM
+                     (pdialog->unit.supported_unit_pixmaps[i]), FALSE);
 
     put_unit_gpixmap(punit,
                     GTK_PIXCOMM(pdialog->unit.supported_unit_pixmaps[i]));
@@ -2198,10 +2196,9 @@
        ITERATOR_NEXT(myiter), i++) {
     punit = (struct unit *) ITERATOR_PTR(myiter);
 
-    if (flags_are_transparent)
-      gtk_pixcomm_clear(GTK_PIXCOMM
-                       (pdialog->overview.present_unit_pixmaps[i]),
-                       FALSE);
+    gtk_pixcomm_clear(GTK_PIXCOMM
+                     (pdialog->overview.present_unit_pixmaps[i]),
+                     FALSE);
 
     put_unit_gpixmap(punit,
                     GTK_PIXCOMM(pdialog->
@@ -2245,9 +2242,8 @@
        ITERATOR_NEXT(myiter), i++) {
     punit = (struct unit *) ITERATOR_PTR(myiter);
 
-    if (flags_are_transparent)
-      gtk_pixcomm_clear(GTK_PIXCOMM(pdialog->unit.present_unit_pixmaps[i]),
-                       FALSE);
+    gtk_pixcomm_clear(GTK_PIXCOMM(pdialog->unit.present_unit_pixmaps[i]),
+                     FALSE);
 
     put_unit_gpixmap(punit,
                     GTK_PIXCOMM(pdialog->unit.present_unit_pixmaps[i]));
--- client/gui-gtk/dialogs.c.~1.119.~   2003-01-27 17:53:00.000000000 -0500
+++ client/gui-gtk/dialogs.c    2003-01-31 04:15:39.000000000 -0500
@@ -1752,9 +1752,7 @@
     gtk_box_pack_start(GTK_BOX(hbox),unit_select_commands[i],
        FALSE, FALSE, 0);
 
-    if (flags_are_transparent) {
-       gtk_pixcomm_clear(GTK_PIXCOMM(pix), FALSE);
-    }
+    gtk_pixcomm_clear(GTK_PIXCOMM(pix), FALSE);
     put_unit_gpixmap(punit, GTK_PIXCOMM(pix));
 
     unit_select_labels[i]=gtk_label_new(buffer);
--- client/gui-gtk/mapview.c.~1.152.~   2003-01-29 17:57:45.000000000 -0500
+++ client/gui-gtk/mapview.c    2003-01-31 04:16:44.000000000 -0500
@@ -824,13 +824,7 @@
                           canvas_x, canvas_y,
                           UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
       } else {
-       if (flags_are_transparent) {
-         pixmap_put_overlay_tile(pm, canvas_x, canvas_y, sprites[0]);
-       } else {
-         gdk_draw_pixmap(pm, civ_gc, sprites[0]->pixmap,
-                         0, 0, canvas_x, canvas_y,
-                         sprites[0]->width, sprites[0]->height);
-       }
+       pixmap_put_overlay_tile(pm, canvas_x, canvas_y, sprites[0]);
        i++;
       }
 
--- client/gui-gtk-2.0/mapview.c.~1.40.~        2003-01-31 02:34:24.000000000 
-0500
+++ client/gui-gtk-2.0/mapview.c        2003-01-31 04:16:56.000000000 -0500
@@ -853,13 +853,7 @@
                           canvas_x, canvas_y,
                           UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
       } else {
-       if (flags_are_transparent) {
-         pixmap_put_overlay_tile(pm, canvas_x, canvas_y, sprites[0]);
-       } else {
-         gdk_draw_pixmap(pm, civ_gc, sprites[0]->pixmap,
-                         0, 0, canvas_x, canvas_y,
-                         sprites[0]->width, sprites[0]->height);
-       }
+       pixmap_put_overlay_tile(pm, canvas_x, canvas_y, sprites[0]);
        i++;
       }
 
--- client/gui-mui/graphics.c.~1.30.~   2003-01-10 21:49:09.000000000 -0500
+++ client/gui-mui/graphics.c   2003-01-31 04:17:11.000000000 -0500
@@ -869,8 +869,7 @@
     }
     else
     {
-      if (flags_are_transparent) put_sprite_overlay(rp, sprites[0], x1, y1);
-      else put_sprite(rp, sprites[0], x1, y1);
+      put_sprite_overlay(rp, sprites[0], x1, y1);
     }
 
     for (i = 1; i < count; i++)
--- client/gui-xaw/citydlg.c.~1.89.~    2003-01-29 00:00:05.000000000 -0500
+++ client/gui-xaw/citydlg.c    2003-01-31 04:17:27.000000000 -0500
@@ -1720,8 +1720,7 @@
     if(!adj_base && unitid && punit->id!=unitid)
       continue;
 
-    if (flags_are_transparent)
-      XawPixcommClear(pixcomm); /* STG */
+    XawPixcommClear(pixcomm); /* STG */
     put_unit_pixmap(punit,
                    XawPixcommPixmap(pixcomm), 
                    0, 0);
@@ -1782,8 +1781,7 @@
     if(!adj_base && unitid && punit->id!=unitid)
       continue;
 
-    if (flags_are_transparent)
-      XawPixcommClear(pixcomm); /* STG */
+    XawPixcommClear(pixcomm); /* STG */
     put_unit_pixmap(punit,
                    XawPixcommPixmap(pixcomm),
                    0, 0);
--- client/gui-xaw/dialogs.c.~1.78.~    2003-01-29 00:10:50.000000000 -0500
+++ client/gui-xaw/dialogs.c    2003-01-31 04:18:04.000000000 -0500
@@ -1650,6 +1650,7 @@
   int nargs;
   Widget unit_select_all_command, unit_select_close_command;
   Widget firstcolumn=0,column=0;
+  Pixel bg;
 
   XtSetSensitive(main_form, FALSE);
 
@@ -1662,11 +1663,8 @@
                                             formWidgetClass, 
                                             unit_select_dialog_shell, NULL);
 
-  if(flags_are_transparent)  {
-    Pixel bg;
-    XtVaGetValues(unit_select_form, XtNbackground, &bg, NULL);
-    XSetForeground(display, fill_bg_gc, bg);
-  }
+  XtVaGetValues(unit_select_form, XtNbackground, &bg, NULL);
+  XSetForeground(display, fill_bg_gc, bg);
 
   n = MIN(MAX_SELECT_UNITS, unit_list_size(&ptile->units));
   r = number_of_rows(n);
@@ -1698,10 +1696,8 @@
                                         NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT,
                                         display_depth);
 
-    if (flags_are_transparent) {
-      XFillRectangle(display, unit_select_pixmaps[i], fill_bg_gc,
-                    0, 0, NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT);
-    }
+    XFillRectangle(display, unit_select_pixmaps[i], fill_bg_gc,
+                  0, 0, NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT);
 
     put_unit_pixmap(punit, unit_select_pixmaps[i], 0, 0);
 
--- client/gui-xaw/gui_main.c.~1.76.~   2003-01-27 17:27:58.000000000 -0500
+++ client/gui-xaw/gui_main.c   2003-01-31 04:18:14.000000000 -0500
@@ -829,9 +829,7 @@
     unit_ids[idx] = punit ? punit->id : 0;
   }
   
-  if (flags_are_transparent || punit==NULL) {
-    XawPixcommClear(w);
-  }
+  XawPixcommClear(w);
   if (punit) {
     put_unit_pixmap(punit, XawPixcommPixmap(w), 0, 0);
     xaw_expose_now(w);
--- client/gui-xaw/mapview.c.~1.119.~   2003-01-29 17:57:46.000000000 -0500
+++ client/gui-xaw/mapview.c    2003-01-31 04:18:25.000000000 -0500
@@ -769,13 +769,7 @@
                     canvas_x, canvas_y,
                     NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT);
     } else {
-      if (flags_are_transparent) {
-       pixmap_put_overlay_tile(pm, canvas_x, canvas_y, sprites[0]);
-      } else {
-       XCopyArea(display, sprites[0]->pixmap, pm, civ_gc, 0, 0,
-                 sprites[0]->width, sprites[0]->height, 
-                 canvas_x, canvas_y);
-      }
+      pixmap_put_overlay_tile(pm, canvas_x, canvas_y, sprites[0]);
       i++;
     }
 
--- client/tilespec.c.~1.107.~  2003-01-31 04:23:49.000000000 -0500
+++ client/tilespec.c   2003-01-31 04:25:17.000000000 -0500
@@ -74,8 +74,6 @@
 char *city_names_font;
 char *city_productions_font_name;
 
-bool flags_are_transparent = TRUE;
-
 int num_tiles_explode_unit=0;
 
 static bool is_mountainous = FALSE;
@@ -446,9 +444,6 @@
                                 "tilespec.city_productions_font");
   city_productions_font_name = mystrdup(c);
 
-  flags_are_transparent =
-    secfile_lookup_bool(file, "tilespec.flags_are_transparent"); 
-
   c = secfile_lookup_str(file, "tilespec.main_intro_file");
   main_intro_filename = tilespec_gfx_filename(c);
   freelog(LOG_DEBUG, "intro file %s", main_intro_filename);
@@ -1155,7 +1150,6 @@
   *solid_bg = 0;
   if (!no_backdrop) {
     if(!solid_color_behind_units) {
-      /* will be the first sprite if flags_are_transparent == FALSE */
       *sprs++ = get_city_nation_flag_sprite(pcity);
     } else {
       *solid_bg = 1;
@@ -1283,7 +1277,6 @@
   } else {
     if (!no_backdrop) {
       if (!solid_color_behind_units) {
-       /* will be the first sprite if flags_are_transparent == FALSE */
        *sprs++ = get_unit_nation_flag_sprite(punit);
       } else {
        *solid_bg = 1;
@@ -1911,6 +1904,7 @@
   enum tile_terrain_type ttype, ttype_near[8];
   enum tile_special_type tspecial, tspecial_near[8];
 
+  int dummy;
   int dir;
   int tileno;
   struct tile *ptile;
@@ -1933,9 +1927,7 @@
   pcity=map_get_city(abs_x0, abs_y0);
   pfocus=get_unit_in_focus();
 
-  if(!flags_are_transparent || solid_color_behind_units) {
-    /* non-transparent flags -> just draw city or unit */
-
+  if(solid_color_behind_units) {
     punit = get_drawable_unit(abs_x0, abs_y0, citymode);
     if (punit && (draw_units || (draw_focus_unit && pfocus == punit))) {
       sprs += fill_unit_sprite_array(sprs, punit, solid_bg);
@@ -2071,25 +2063,20 @@
       *sprs++ = sprites.tx.darkness[tileno];
   }
 
-  if (flags_are_transparent) {
-    int dummy;
-    /* transparent flags -> draw city or unit last */
-
-    if (pcity && draw_cities) {
-      sprs+=fill_city_sprite_array(sprs, pcity, &dummy);
-    }
+  if (pcity && draw_cities) {
+    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))) {
-         no_backdrop = (pcity != NULL);
-         sprs += fill_unit_sprite_array(sprs, punit, &dummy);
-         no_backdrop=FALSE;
-         if (unit_list_size(&ptile->units)>1)  
-           *sprs++ = sprites.unit.stack;
-       }
+  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))) {
+       no_backdrop = (pcity != NULL);
+       sprs += fill_unit_sprite_array(sprs, punit, &dummy);
+       no_backdrop=FALSE;
+       if (unit_list_size(&ptile->units)>1)  
+         *sprs++ = sprites.unit.stack;
       }
     }
   }
--- client/tilespec.h.~1.37.~   2003-01-21 15:25:30.000000000 -0500
+++ client/tilespec.h   2003-01-31 04:15:00.000000000 -0500
@@ -259,8 +259,6 @@
 
 extern char *city_productions_font_name;
 
-extern bool flags_are_transparent;
-
 extern int num_tiles_explode_unit;
 
 #endif  /* FC__TILESPEC_H */
Index: data/isotrident.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isotrident.tilespec,v
retrieving revision 1.7
diff -u -r1.7 isotrident.tilespec
--- data/isotrident.tilespec    30 Jan 2003 18:40:53 -0000      1.7
+++ data/isotrident.tilespec    31 Jan 2003 10:06:25 -0000
@@ -30,9 +30,6 @@
 ; Font to use to draw city productions:
 city_productions_font = "6x13"
 
-; Should flags be drawn as transparent:  (else opaque)
-flags_are_transparent = 1
-
 ; These are special because they get freed and reloaded
 ; as required:
 main_intro_file    = "misc/intro"
Index: data/trident.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/trident.tilespec,v
retrieving revision 1.14
diff -u -r1.14 trident.tilespec
--- data/trident.tilespec       30 Jan 2003 18:40:53 -0000      1.14
+++ data/trident.tilespec       31 Jan 2003 10:06:33 -0000
@@ -30,9 +30,6 @@
 ; Font to use to draw city productions:
 city_productions_font = "6x13"
 
-; Should flags be drawn as transparent:  (else opaque)
-flags_are_transparent = 1
-
 ; These are special because they get freed and reloaded
 ; as required:
 main_intro_file    = "misc/intro"
Index: data/trident_shields.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/trident_shields.tilespec,v
retrieving revision 1.6
diff -u -r1.6 trident_shields.tilespec
--- data/trident_shields.tilespec       30 Jan 2003 18:40:53 -0000      1.6
+++ data/trident_shields.tilespec       31 Jan 2003 10:06:36 -0000
@@ -30,9 +30,6 @@
 ; Font to use to draw city productions:
 city_productions_font = "6x13"
 
-; Should flags be drawn as transparent:  (else opaque)
-flags_are_transparent = 1
-
 ; These are special because they get freed and reloaded
 ; as required:
 main_intro_file    = "misc/intro"
--- doc/README.graphics.~1.4.~  2003-01-31 04:11:03.000000000 -0500
+++ doc/README.graphics 2003-01-31 04:18:33.000000000 -0500
@@ -81,7 +81,6 @@
   -----------------
   is_isometric          : set to 1 for an iso-view tileset
   is_mountainous        : do hills and mountains blend together?
-  flags_are_transparent : 
 
   String lists (a comma-separated list of strings)
   ------------------------------------------------

End of diffs.

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#2956) Proposal (with patch): abolish the flags_are_transparent flag, esr@xxxxxxxxxxx via RT <=