[Freeciv-Dev] (PR#12518) accessors for some named_sprite values
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12518 >
This patch adds accessors for the nuke sprite and the number of city
overlay colors. These are the last two values from the named_sprite
struct that are accessed outside of tilespec.c. After this patch (and
the spaceship one) the named_sprite struct should be encapsulated in
tilespec.c.
-jason
? diff
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.214
diff -u -r1.214 mapview_common.c
--- client/mapview_common.c 15 Mar 2005 16:04:17 -0000 1.214
+++ client/mapview_common.c 16 Mar 2005 02:16:06 -0000
@@ -993,7 +993,7 @@
* This array can be added to without breaking anything elsewhere.
*/
static int color_index = 0;
-#define NUM_CITY_COLORS (sprites.city.worked_tile_overlay.size)
+#define NUM_CITY_COLORS tileset_num_city_colors(tileset)
/****************************************************************************
@@ -1038,7 +1038,7 @@
void put_nuke_mushroom_pixmaps(struct tile *ptile)
{
int canvas_x, canvas_y;
- struct Sprite *mysprite = sprites.explode.nuke;
+ struct Sprite *mysprite = get_nuke_explode_sprite(tileset);
int width, height;
/* We can't count on the return value of tile_to_canvas_pos since the
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.267
diff -u -r1.267 tilespec.c
--- client/tilespec.c 15 Mar 2005 16:04:17 -0000 1.267
+++ client/tilespec.c 16 Mar 2005 02:16:07 -0000
@@ -315,6 +315,14 @@
return t->minimap_intro_filename;
}
+/****************************************************************************
+ Return the number of possible colors for city overlays.
+****************************************************************************/
+int tileset_num_city_colors(struct tileset *t)
+{
+ return sprites.city.worked_tile_overlay.size;
+}
+
/**************************************************************************
Initialize.
**************************************************************************/
@@ -3914,6 +3922,16 @@
return &sprites.explode.unit;
}
+/****************************************************************************
+ Return a sprite contining the single nuke graphic.
+
+ TODO: This should be an animation like the unit explode animation.
+****************************************************************************/
+struct Sprite *get_nuke_explode_sprite(struct tileset *t)
+{
+ return sprites.explode.nuke;
+}
+
/**************************************************************************
Returns a sprite for the given cursor. The "hot" coordinates (the
active coordinates of the mouse relative to the sprite) are placed int
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.128
diff -u -r1.128 tilespec.h
--- client/tilespec.h 15 Mar 2005 16:04:17 -0000 1.128
+++ client/tilespec.h 16 Mar 2005 02:16:09 -0000
@@ -363,6 +363,7 @@
struct Sprite *get_tax_sprite(Output_type_id otype);
struct Sprite *get_treaty_thumb_sprite(bool on_off);
struct sprite_vector *get_unit_explode_animation(void);
+struct Sprite *get_nuke_explode_sprite(struct tileset *t);
struct Sprite *get_cursor_sprite(enum cursor_type cursor,
int *hot_x, int *hot_y);
struct Sprite *get_attention_crosshair_sprite(void);
@@ -424,6 +425,7 @@
int tileset_small_sprite_height(struct tileset *t);
const char *tileset_main_intro_filename(struct tileset *t);
const char *tileset_mini_intro_filename(struct tileset *t);
+int tileset_num_city_colors(struct tileset *t);
struct Sprite *load_sprite(struct tileset *t, const char *tag_name);
void unload_sprite(struct tileset *t, const char *tag_name);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#12518) accessors for some named_sprite values,
Jason Short <=
|
|