[Freeciv-Dev] (PR#12729) move government sprites into the tileset
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12729 >
This patch moves government sprites into the tileset. Pretty
straightforward...
-jason
Index: client/climisc.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v
retrieving revision 1.160
diff -u -r1.160 climisc.c
--- client/climisc.c 28 Mar 2005 16:59:13 -0000 1.160
+++ client/climisc.c 6 Apr 2005 17:51:07 -0000
@@ -375,7 +375,9 @@
struct sprite *client_government_sprite(void)
{
if (can_client_change_view() && game.government_count > 0) {
- return get_government(game.player_ptr->government)->sprite;
+ struct government *gov = get_government(game.player_ptr->government);
+
+ return get_government_sprite(tileset, gov);
} else {
/* HACK: the UNHAPPY citizen is used for the government
* when we don't know any better. */
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.285
diff -u -r1.285 tilespec.c
--- client/tilespec.c 6 Apr 2005 17:36:14 -0000 1.285
+++ client/tilespec.c 6 Apr 2005 17:51:08 -0000
@@ -130,6 +130,7 @@
struct sprite *tech[A_LAST];
struct sprite *building[B_LAST];
+ struct sprite *government[G_MAGIC];
struct citizen_graphic {
/* Each citizen type has up to MAX_NUM_CITIZEN_SPRITES different
@@ -2481,8 +2482,9 @@
{
struct government *gov = get_government(id);
- gov->sprite = lookup_sprite_tag_alt(t, gov->graphic_str, gov->graphic_alt,
- TRUE, "government", gov->name);
+ t->sprites.government[id]
+ = lookup_sprite_tag_alt(t, gov->graphic_str, gov->graphic_alt,
+ TRUE, "government", gov->name);
/* should probably do something if NULL, eg generic default? */
}
@@ -4221,6 +4223,20 @@
return t->sprites.building[b];
}
+
+/****************************************************************************
+ Return the sprite for the government.
+****************************************************************************/
+struct sprite *get_government_sprite(const struct tileset *t,
+ const struct government *gov)
+{
+ if (!gov || gov->index < 0 || gov->index >= game.government_count) {
+ assert(0);
+ return NULL;
+ }
+ return t->sprites.government[gov->index];
+}
+
/**************************************************************************
Return a "sample" sprite for this city style.
**************************************************************************/
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.144
diff -u -r1.144 tilespec.h
--- client/tilespec.h 6 Apr 2005 17:36:14 -0000 1.144
+++ client/tilespec.h 6 Apr 2005 17:51:08 -0000
@@ -182,6 +182,8 @@
const struct nation_type *nation);
struct sprite *get_tech_sprite(const struct tileset *t, Tech_Type_id tech);
struct sprite *get_building_sprite(const struct tileset *t, Impr_Type_id b);
+struct sprite *get_government_sprite(const struct tileset *t,
+ const struct government *gov);
struct sprite *get_sample_city_sprite(const struct tileset *t,
int city_style);
struct sprite *get_arrow_sprite(const struct tileset *t);
Index: client/gui-gtk-2.0/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/menu.c,v
retrieving revision 1.69
diff -u -r1.69 menu.c
--- client/gui-gtk-2.0/menu.c 28 Mar 2005 16:59:14 -0000 1.69
+++ client/gui-gtk-2.0/menu.c 6 Apr 2005 17:51:09 -0000
@@ -1256,7 +1256,7 @@
my_snprintf(buf, sizeof(buf), _("%s..."), g->name);
item = gtk_image_menu_item_new_with_label(buf);
- if ((gsprite = g->sprite)) {
+ if ((gsprite = get_government_sprite(tileset, g))) {
image = gtk_image_new_from_pixbuf(sprite_get_pixbuf(gsprite));
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image);
gtk_widget_show(image);
Index: common/government.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/government.h,v
retrieving revision 1.41
diff -u -r1.41 government.h
--- common/government.h 28 Mar 2005 17:14:57 -0000 1.41
+++ common/government.h 6 Apr 2005 17:51:09 -0000
@@ -18,8 +18,6 @@
#include "fc_types.h"
#include "requirements.h"
-struct sprite; /* opaque; client-gui specific */
-
#define G_MAGIC (127) /* magic constant, used as flag value */
/* special values for free_* fields -- SKi */
@@ -123,8 +121,6 @@
use government_has_flag() to access */
int flags;
- struct sprite *sprite;
-
char *helptext;
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#12729) move government sprites into the tileset,
Jason Short <=
|
|