Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2004:
[Freeciv-Dev] (PR#8903) separate sprites for tax icons
Home

[Freeciv-Dev] (PR#8903) separate sprites for tax icons

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8903) separate sprites for tax icons
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 3 Jun 2004 23:08:31 -0700
Reply-to: rt@xxxxxxxxxxx

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

Currently the sprites used for the tax icons on the panel are taken from 
the citizen sprites (the entertainer sprite is used for luxury, etc.). 
This is unnecessary and isn't extensible (see PR#8877).

This patch adds new sprite tags for these graphics.  The tags take names 
like s.tax_science (is this good?).  Trident and isotrident are updated. 
  I updated the GTK2, GTK, XAW, Win32, and MUI client.  The first 3 were 
tested.

jason

Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.172
diff -u -r1.172 tilespec.c
--- client/tilespec.c   1 Jun 2004 19:10:31 -0000       1.172
+++ client/tilespec.c   4 Jun 2004 06:04:39 -0000
@@ -974,6 +974,10 @@
     SET_SPRITE(dither_tile, "t.dither_tile");
   }
 
+  SET_SPRITE(tax_luxury, "s.tax_luxury");
+  SET_SPRITE(tax_science, "s.tax_science");
+  SET_SPRITE(tax_gold, "s.tax_gold");
+
   /* Load the citizen sprite graphics. */
   for (i = 0; i < NUM_TILES_CITIZEN; i++) {
     my_snprintf(buffer, sizeof(buffer), "citizen.%s", get_citizen_name(i));
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.68
diff -u -r1.68 tilespec.h
--- client/tilespec.h   1 Jun 2004 19:10:32 -0000       1.68
+++ client/tilespec.h   4 Jun 2004 06:04:39 -0000
@@ -141,6 +141,9 @@
     *treaty_thumb[2],     /* 0=disagree, 1=agree */
     *right_arrow,
 
+    /* The panel sprites for showing tax % allocations. */
+    *tax_luxury, *tax_science, *tax_gold,
+
     *black_tile,      /* only used for isometric view */
     *dither_tile;     /* only used for isometric view */
 
Index: client/gui-gtk/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/gui_main.c,v
retrieving revision 1.148
diff -u -r1.148 gui_main.c
--- client/gui-gtk/gui_main.c   15 Apr 2004 19:36:01 -0000      1.148
+++ client/gui-gtk/gui_main.c   4 Jun 2004 06:04:39 -0000
@@ -613,7 +613,8 @@
 
   /* citizens for taxrates */
   for (i = 0; i < 10; i++) {
-    enum citizen_type c = i < 5 ? CITIZEN_SCIENTIST : CITIZEN_TAXMAN;
+    struct Sprite *s = i < 5 ? sprites.tax_science : sprites.tax_gold;
+
     ebox = gtk_event_box_new();
     gtk_widget_set_events(ebox, GDK_BUTTON_PRESS_MASK);
 
@@ -622,8 +623,7 @@
     gtk_signal_connect(GTK_OBJECT(ebox), "button_press_event",
                        GTK_SIGNAL_FUNC(taxrates_callback), GINT_TO_POINTER(i));
 
-    econ_label[i] = gtk_pixmap_new(get_citizen_sprite(c, i, NULL)->pixmap,
-                                  NULL);
+    econ_label[i] = gtk_pixmap_new(s->pixmap, NULL);
     gtk_pixmap_set_build_insensitive(GTK_PIXMAP(econ_label[i]), FALSE);
     gtk_container_add(GTK_CONTAINER(ebox), econ_label[i]);
   }
Index: client/gui-gtk/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/mapview.c,v
retrieving revision 1.221
diff -u -r1.221 mapview.c
--- client/gui-gtk/mapview.c    24 May 2004 22:48:08 -0000      1.221
+++ client/gui-gtk/mapview.c    4 Jun 2004 06:04:39 -0000
@@ -144,18 +144,18 @@
 
   d=0;
   for (; d < game.player_ptr->economic.luxury /10; d++) {
-    struct Sprite *sprite = get_citizen_sprite(CITIZEN_ELVIS, d, NULL);
+    struct Sprite *sprite = sprite = sprites.tax_luxury;
     gtk_pixmap_set(GTK_PIXMAP(econ_label[d]), sprite->pixmap, sprite->mask);
   }
  
   for (; d < (game.player_ptr->economic.science
             + game.player_ptr->economic.luxury) / 10; d++) {
-    struct Sprite *sprite = get_citizen_sprite(CITIZEN_SCIENTIST, d, NULL);
+    struct Sprite *sprite = sprites.tax_science;
     gtk_pixmap_set(GTK_PIXMAP(econ_label[d]), sprite->pixmap, sprite->mask);
   }
  
   for (; d < 10; d++) {
-    struct Sprite *sprite = get_citizen_sprite(CITIZEN_TAXMAN, d, NULL);
+    struct Sprite *sprite = sprites.tax_gold;
     gtk_pixmap_set(GTK_PIXMAP(econ_label[d]), sprite->pixmap, sprite->mask);
   }
  
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.72
diff -u -r1.72 gui_main.c
--- client/gui-gtk-2.0/gui_main.c       1 May 2004 17:28:47 -0000       1.72
+++ client/gui-gtk-2.0/gui_main.c       4 Jun 2004 06:04:40 -0000
@@ -803,7 +803,6 @@
   gtk_container_add(GTK_CONTAINER(ebox), table2);
   
   for (i = 0; i < 10; i++) {
-    enum citizen_type c = i < 5 ? CITIZEN_SCIENTIST : CITIZEN_TAXMAN;
     ebox = gtk_event_box_new();
     gtk_widget_add_events(ebox, GDK_BUTTON_PRESS_MASK);
 
@@ -812,7 +811,7 @@
     g_signal_connect(ebox, "button_press_event",
                      G_CALLBACK(taxrates_callback), GINT_TO_POINTER(i));
 
-    sprite = get_citizen_sprite(c, i, NULL);
+    sprite = i < 5 ? sprites.tax_science : sprites.tax_gold;
     econ_label[i] = gtk_image_new_from_pixmap(sprite->pixmap, sprite->mask);
     gtk_container_add(GTK_CONTAINER(ebox), econ_label[i]);
   }
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.127
diff -u -r1.127 mapview.c
--- client/gui-gtk-2.0/mapview.c        3 Jun 2004 13:53:42 -0000       1.127
+++ client/gui-gtk-2.0/mapview.c        4 Jun 2004 06:04:40 -0000
@@ -139,20 +139,23 @@
 
   d=0;
   for (; d < game.player_ptr->economic.luxury /10; d++) {
-    struct Sprite *sprite = get_citizen_sprite(CITIZEN_ELVIS, d, NULL);
+    struct Sprite *sprite = sprites.tax_luxury;
+
     gtk_image_set_from_pixmap(GTK_IMAGE(econ_label[d]),
                              sprite->pixmap, sprite->mask);
   }
  
   for (; d < (game.player_ptr->economic.science
             + game.player_ptr->economic.luxury) / 10; d++) {
-    struct Sprite *sprite = get_citizen_sprite(CITIZEN_SCIENTIST, d, NULL);
+    struct Sprite *sprite = sprites.tax_science;
+
     gtk_image_set_from_pixmap(GTK_IMAGE(econ_label[d]),
                              sprite->pixmap, sprite->mask);
   }
  
   for (; d < 10; d++) {
-    struct Sprite *sprite = get_citizen_sprite(CITIZEN_TAXMAN, d, NULL);
+    struct Sprite *sprite = sprites.tax_gold;
+
     gtk_image_set_from_pixmap(GTK_IMAGE(econ_label[d]),
                              sprite->pixmap, sprite->mask);
   }
Index: client/gui-mui/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/mapview.c,v
retrieving revision 1.66
diff -u -r1.66 mapview.c
--- client/gui-mui/mapview.c    17 May 2004 07:16:43 -0000      1.66
+++ client/gui-mui/mapview.c    4 Jun 2004 06:04:40 -0000
@@ -203,16 +203,13 @@
 
   d = 0;
   for (; d < (game.player_ptr->economic.luxury) / 10; d++)
-    set(main_econ_sprite[d], MUIA_Sprite_Sprite,
-       get_citizen_sprite(CITIZEN_ELVIS, d, NULL));
+    set(main_econ_sprite[d], MUIA_Sprite_Sprite, sprites.tax_luxury);
 
   for (; d < (game.player_ptr->economic.science + 
game.player_ptr->economic.luxury) / 10; d++)
-    set(main_econ_sprite[d], MUIA_Sprite_Sprite,
-       get_citizen_sprite(CITIZEN_SCIENTIST, d, NULL));
+    set(main_econ_sprite[d], MUIA_Sprite_Sprite, sprites.tax_science);
 
   for (; d < 10; d++)
-    set(main_econ_sprite[d], MUIA_Sprite_Sprite,
-       get_citizen_sprite(CITIZEN_TAXMAN, d, NULL));
+    set(main_econ_sprite[d], MUIA_Sprite_Sprite, sprites.tax_gold);
 
   update_timeout_label();
 }
Index: client/gui-win32/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/mapview.c,v
retrieving revision 1.118
diff -u -r1.118 mapview.c
--- client/gui-win32/mapview.c  26 May 2004 04:00:53 -0000      1.118
+++ client/gui-win32/mapview.c  4 Jun 2004 06:04:40 -0000
@@ -209,13 +209,13 @@
   int d;
   d=0;
   for(;d<(game.player_ptr->economic.luxury)/10;d++)
-    draw_sprite(get_citizen_sprite(CITIZEN_ELVIS, d, NULL), hdc,
+    draw_sprite(sprites.tax_luxury, hdc,
                SMALL_TILE_WIDTH*d,taxinfoline_y);/* elvis tile */
   
for(;d<(game.player_ptr->economic.science+game.player_ptr->economic.luxury)/10;d++)
-    draw_sprite(get_citizen_sprite(CITIZEN_SCIENTIST, d, NULL), hdc,
+    draw_sprite(sprites.tax_science, hdc,
                SMALL_TILE_WIDTH*d,taxinfoline_y); /* scientist tile */    
   for(;d<10;d++)
-    draw_sprite(get_citizen_sprite(CITIZEN_TAXMAN, d, NULL), hdc,
+    draw_sprite(sprites.tax_gold, hdc,
                SMALL_TILE_WIDTH*d,taxinfoline_y); /* taxman tile */  
 }
 
Index: client/gui-xaw/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/gui_main.c,v
retrieving revision 1.91
diff -u -r1.91 gui_main.c
--- client/gui-xaw/gui_main.c   15 Apr 2004 19:36:01 -0000      1.91
+++ client/gui-xaw/gui_main.c   4 Jun 2004 06:04:40 -0000
@@ -416,9 +416,10 @@
 
   /* Do this outside setup_widgets() so after tiles are loaded */
   for(i=0;i<10;i++)  {
-    enum citizen_type c = i < 5 ? CITIZEN_SCIENTIST : CITIZEN_TAXMAN;
+    struct Sprite *s = i < 5 ? sprites.tax_science : sprites.tax_gold;
+
     XtVaSetValues(econ_label[i], XtNbitmap,
-                 get_citizen_pixmap(c, i, NULL), NULL);
+                 s->pixmap, NULL);
     XtAddCallback(econ_label[i], XtNcallback, taxrates_callback,
                  INT_TO_XTPOINTER(i));
   }
Index: client/gui-xaw/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/mapview.c,v
retrieving revision 1.173
diff -u -r1.173 mapview.c
--- client/gui-xaw/mapview.c    17 May 2004 07:16:43 -0000      1.173
+++ client/gui-xaw/mapview.c    4 Jun 2004 06:04:42 -0000
@@ -176,16 +176,13 @@
 
   d=0;
   for(;d<(game.player_ptr->economic.luxury)/10;d++)
-    xaw_set_bitmap(econ_label[d],
-                  get_citizen_pixmap(CITIZEN_ELVIS, d, NULL));
+    xaw_set_bitmap(econ_label[d], sprites.tax_luxury->pixmap);
  
   
for(;d<(game.player_ptr->economic.science+game.player_ptr->economic.luxury)/10;d++)
-    xaw_set_bitmap(econ_label[d],
-                  get_citizen_pixmap(CITIZEN_SCIENTIST, d, NULL));
+    xaw_set_bitmap(econ_label[d], sprites.tax_science->pixmap);
  
    for(;d<10;d++)
-    xaw_set_bitmap(econ_label[d],
-                  get_citizen_pixmap(CITIZEN_TAXMAN, d, NULL));
+     xaw_set_bitmap(econ_label[d], sprites.tax_gold->pixmap);
  
   update_timeout_label();
 }
Index: data/isotrident/small.spec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isotrident/small.spec,v
retrieving revision 1.1
diff -u -r1.1 small.spec
--- data/isotrident/small.spec  2 May 2002 05:46:58 -0000       1.1
+++ data/isotrident/small.spec  4 Jun 2004 06:04:42 -0000
@@ -68,6 +68,12 @@
   0, 40, "s.cooling_flake_6"
   0, 41, "s.cooling_flake_7"
 
+; Panel tax icons
+
+  0, 23, "s.tax_luxury"
+  0, 24, "s.tax_science"
+  0, 25, "s.tax_gold"
+
 ; Citizen icons:
 
   0, 23, "citizen.entertainer"
Index: data/misc/small.spec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/misc/small.spec,v
retrieving revision 1.4
diff -u -r1.4 small.spec
--- data/misc/small.spec        25 Sep 2001 19:58:13 -0000      1.4
+++ data/misc/small.spec        4 Jun 2004 06:04:42 -0000
@@ -68,6 +68,12 @@
   0, 40, "s.cooling_flake_6"
   0, 41, "s.cooling_flake_7"
 
+; Panel tax icons
+
+  0, 23, "s.tax_luxury"
+  0, 24, "s.tax_science"
+  0, 25, "s.tax_gold"
+
 ; Citizen icons:
 
   0, 23, "citizen.entertainer"

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8903) separate sprites for tax icons, Jason Short <=