Freeciv-3.1
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions | Variables
tilespec.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "astring.h"
#include "bitvector.h"
#include "capability.h"
#include "deprecations.h"
#include "fcintl.h"
#include "log.h"
#include "mem.h"
#include "rand.h"
#include "registry.h"
#include "shared.h"
#include "string_vector.h"
#include "support.h"
#include "base.h"
#include "effects.h"
#include "game.h"
#include "government.h"
#include "map.h"
#include "movement.h"
#include "nation.h"
#include "player.h"
#include "road.h"
#include "specialist.h"
#include "unit.h"
#include "unitlist.h"
#include "dialogs_g.h"
#include "graphics_g.h"
#include "gui_main_g.h"
#include "mapview_g.h"
#include "menu_g.h"
#include "themes_g.h"
#include "citydlg_common.h"
#include "client_main.h"
#include "climap.h"
#include "colors_common.h"
#include "control.h"
#include "editor.h"
#include "goto.h"
#include "helpdata.h"
#include "options.h"
#include "themes_common.h"
#include "tilespec.h"
#include "specenum_gen.h"
#include "speclist.h"
#include "spechash.h"

Go to the source code of this file.

Data Structures

struct  drawing_data
 
struct  drawing_data::drawing_layer
 
struct  city_style_threshold
 
struct  city_sprite
 
struct  river_sprites
 
struct  named_sprites
 
struct  named_sprites::citizen_graphic
 
struct  specfile
 
struct  small_sprite
 
struct  tileset
 
struct  tileset::tileset_layer
 

Macros

#define TILESPEC_CAPSTR   "+Freeciv-3.1-tilespec duplicates_ok"
 
#define SPEC_CAPSTR   "+Freeciv-3.1-spec"
 
#define TILESPEC_SUFFIX   ".tilespec"
 
#define TILE_SECTION_PREFIX   "tile_"
 
#define MAX_INDEX_CARDINAL   64
 
#define MAX_INDEX_HALF   16
 
#define MAX_INDEX_VALID   256
 
#define NUM_TILES_HP_BAR   11
 
#define NUM_TILES_DIGITS   10
 
#define NUM_TILES_SELECT   4
 
#define MAX_NUM_UPKEEP_SPRITES   10
 
#define SPECENUM_NAME   extrastyle_id
 
#define SPECENUM_VALUE0   ESTYLE_ROAD_ALL_SEPARATE
 
#define SPECENUM_VALUE0NAME   "RoadAllSeparate"
 
#define SPECENUM_VALUE1   ESTYLE_ROAD_PARITY_COMBINED
 
#define SPECENUM_VALUE1NAME   "RoadParityCombined"
 
#define SPECENUM_VALUE2   ESTYLE_ROAD_ALL_COMBINED
 
#define SPECENUM_VALUE2NAME   "RoadAllCombined"
 
#define SPECENUM_VALUE3   ESTYLE_RIVER
 
#define SPECENUM_VALUE3NAME   "River"
 
#define SPECENUM_VALUE4   ESTYLE_SINGLE1
 
#define SPECENUM_VALUE4NAME   "Single1"
 
#define SPECENUM_VALUE5   ESTYLE_SINGLE2
 
#define SPECENUM_VALUE5NAME   "Single2"
 
#define SPECENUM_VALUE6   ESTYLE_3LAYER
 
#define SPECENUM_VALUE6NAME   "3Layer"
 
#define SPECENUM_VALUE7   ESTYLE_CARDINALS
 
#define SPECENUM_VALUE7NAME   "Cardinals"
 
#define SPECENUM_COUNT   ESTYLE_COUNT
 
#define MAX_NUM_LAYERS   3
 
#define MAX_NUM_MATCH_WITH   8
 
#define SPECLIST_TAG   specfile
 
#define SPECLIST_TYPE   struct specfile
 
#define specfile_list_iterate(list, pitem)    TYPED_LIST_ITERATE(struct specfile, list, pitem)
 
#define specfile_list_iterate_end   LIST_ITERATE_END
 
#define SPECLIST_TAG   small_sprite
 
#define SPECLIST_TYPE   struct small_sprite
 
#define small_sprite_list_iterate(list, pitem)    TYPED_LIST_ITERATE(struct small_sprite, list, pitem)
 
#define small_sprite_list_iterate_end   LIST_ITERATE_END
 
#define SPECHASH_TAG   sprite
 
#define SPECHASH_ASTR_KEY_TYPE
 
#define SPECHASH_IDATA_TYPE   struct small_sprite *
 
#define sprite_hash_iterate(hash, tag_name, sprite)
 
#define sprite_hash_iterate_end   HASH_ITERATE_END
 
#define SPECHASH_TAG   drawing
 
#define SPECHASH_CSTR_KEY_TYPE
 
#define SPECHASH_IDATA_TYPE   struct drawing_data *
 
#define SPECHASH_IDATA_FREE   drawing_data_destroy
 
#define SPECHASH_TAG   estyle
 
#define SPECHASH_ASTR_KEY_TYPE
 
#define SPECHASH_ENUM_DATA_TYPE   extrastyle_id
 
#define NUM_CORNER_DIRS   4
 
#define TILES_PER_CORNER   4
 
#define SET_SPRITE(field, tag)
 
#define SET_SPRITE_NOTSMOOTH(field, tag)
 
#define SET_SPRITE_UNSCALED(field, tag)
 
#define SET_SPRITE_ALT(field, tag, alt)
 
#define SET_SPRITE_OPT(field, tag)    t->sprites.field = load_sprite(t, tag, TRUE, TRUE)
 
#define SET_SPRITE_ALT_OPT(field, tag, alt)
 
#define SET_EDITOR_SPRITE(x)   SET_SPRITE(editor.x, "editor." #x)
 
#define SET_GOTO_TURN_SPRITE(state, state_name, factor, factor_name)
 
#define LOAD_FACING_SPRITE(dir)
 
#define FULL_TILE_X_OFFSET   ((t->normal_tile_width - t->full_tile_width) / 2)
 
#define FULL_TILE_Y_OFFSET   (t->normal_tile_height - t->full_tile_height)
 
#define ADD_SPRITE(s, draw_fog, x_offset, y_offset)
 
#define ADD_SPRITE_SIMPLE(s)   ADD_SPRITE(s, TRUE, 0, 0)
 
#define ADD_SPRITE_FULL(s)    ADD_SPRITE(s, TRUE, FULL_TILE_X_OFFSET, FULL_TILE_Y_OFFSET)
 
#define MATCH(dir)
 
#define UNKNOWN(dir)
 
#define ADD_SPRITE_IF_NOT_NULL(x)
 

Enumerations

enum  direction4 { DIR4_NORTH = 0 , DIR4_SOUTH , DIR4_EAST , DIR4_WEST }
 
enum  match_style { MATCH_NONE , MATCH_SAME , MATCH_PAIR , MATCH_FULL }
 
enum  sprite_type { CELL_WHOLE , CELL_CORNER }
 

Functions

static void drawing_data_destroy (struct drawing_data *draw)
 
static struct tilesettileset_read_toplevel (const char *tileset_name, bool verbose, int topology_id, float scale)
 
static int fill_unit_type_sprite_array (const struct tileset *t, struct drawn_sprite *sprs, const struct unit_type *putype, enum direction8 facing)
 
static int fill_unit_sprite_array (const struct tileset *t, struct drawn_sprite *sprs, const struct unit *punit, int stack, bool backdrop)
 
static bool load_river_sprites (struct tileset *t, struct river_sprites *store, const char *tag_pfx)
 
static void tileset_setup_base (struct tileset *t, const struct extra_type *pextra, const char *tag)
 
static void tileset_setup_road (struct tileset *t, struct extra_type *pextra, const char *tag)
 
static bool is_extra_drawing_enabled (struct extra_type *pextra)
 
static int fill_basic_road_sprite_array (const struct tileset *t, struct drawn_sprite *sprs, const struct extra_type *pextra)
 
static int fill_basic_base_sprite_array (const struct tileset *t, struct drawn_sprite *sprs, const struct extra_type *pextra)
 
static void tileset_player_free (struct tileset *t, int plrid)
 
void tileset_error (enum log_level level, const char *tset_name, const char *format,...)
 
static struct drawing_datadrawing_data_new (void)
 
struct tilesetget_tileset (void)
 
const char * tileset_basename (const struct tileset *t)
 
bool tileset_is_isometric (const struct tileset *t)
 
int tileset_hex_width (const struct tileset *t)
 
int tileset_hex_height (const struct tileset *t)
 
int tileset_tile_width (const struct tileset *t)
 
int tileset_tile_height (const struct tileset *t)
 
int tileset_full_tile_width (const struct tileset *t)
 
int tileset_full_tile_height (const struct tileset *t)
 
int tileset_unit_width (const struct tileset *t)
 
int tileset_unit_height (const struct tileset *t)
 
static int calculate_max_upkeep_height (const struct tileset *t)
 
static int tileset_upkeep_height (const struct tileset *t)
 
int tileset_unit_with_upkeep_height (const struct tileset *t)
 
int tileset_unit_with_small_upkeep_height (const struct tileset *t)
 
int tileset_unit_layout_offset_y (const struct tileset *t)
 
int tileset_unit_layout_small_offset_y (const struct tileset *t)
 
int tileset_small_sprite_width (const struct tileset *t)
 
int tileset_citybar_offset_y (const struct tileset *t)
 
int tileset_tilelabel_offset_y (const struct tileset *t)
 
float tileset_scale (const struct tileset *t)
 
int tileset_small_sprite_height (const struct tileset *t)
 
const char * tileset_main_intro_filename (const struct tileset *t)
 
int tileset_num_city_colors (const struct tileset *t)
 
bool tileset_use_hard_coded_fog (const struct tileset *t)
 
static struct tilesettileset_new (void)
 
static const char * dir_get_tileset_name (enum direction8 dir)
 
static enum direction8 dir_by_tileset_name (const char *str)
 
static bool is_valid_tileset_dir (const struct tileset *t, enum direction8 dir)
 
static bool is_cardinal_tileset_dir (const struct tileset *t, enum direction8 dir)
 
static int ts_topology_index (int actual_topology)
 
const struct strvecget_tileset_list (const struct option *poption)
 
static char * tilespec_fullname (const char *tileset_name)
 
static bool check_tilespec_capabilities (struct section_file *file, const char *which, const char *us_capstr, const char *filename, bool verbose)
 
static void tileset_free_toplevel (struct tileset *t)
 
void tileset_free (struct tileset *t)
 
bool tilespec_try_read (const char *tileset_name, bool verbose, int topo_id, bool global_default)
 
bool tilespec_reread (const char *new_tileset_name, bool game_fully_initialized, float scale)
 
void tilespec_reread_callback (struct option *poption)
 
void tilespec_reread_frozen_refresh (const char *tname)
 
static struct spriteload_gfx_file (const char *gfx_filename)
 
static void ensure_big_sprite (struct specfile *sf, const char *tset_name)
 
static void scan_specfile (struct tileset *t, struct specfile *sf, bool duplicates_ok)
 
static char * tilespec_gfx_filename (const char *gfx_filename, const char *tset_name)
 
static int check_sprite_type (const char *sprite_type, const char *tile_section)
 
static const char * citizen_rule_name (enum citizen_category citizen)
 
static const char * cardinal_index_str (const struct tileset *t, int idx)
 
static char * valid_index_str (const struct tileset *t, int idx)
 
static struct spriteload_sprite (struct tileset *t, const char *tag_name, bool scale, bool smooth)
 
static struct spritecreate_plr_sprite (struct color *pcolor)
 
static void unload_sprite (struct tileset *t, const char *tag_name)
 
static bool sprite_exists (const struct tileset *t, const char *tag_name)
 
void tileset_setup_specialist_type (struct tileset *t, Specialist_type_id id)
 
static void tileset_setup_citizen_types (struct tileset *t)
 
static struct spriteget_city_sprite (const struct city_sprite *city_sprite, const struct city *pcity)
 
static int load_city_thresholds_sprites (struct tileset *t, const char *tag, char *graphic, char *graphic_alt, struct city_style_threshold **thresholds)
 
static struct city_spriteload_city_sprite (struct tileset *t, const char *tag)
 
static void free_city_sprite (struct city_sprite *city_sprite)
 
static void tileset_lookup_sprite_tags (struct tileset *t)
 
void finish_loading_sprites (struct tileset *t)
 
void tileset_load_tiles (struct tileset *t)
 
struct spritetiles_lookup_sprite_tag_alt (struct tileset *t, enum log_level level, const char *tag, const char *alt, const char *what, const char *name, bool scale)
 
static bool tileset_setup_unit_direction (struct tileset *t, int uidx, const char *base_str, enum direction8 dir, bool has_icon)
 
static bool tileset_setup_unit_type_from_tag (struct tileset *t, int uidx, const char *tag)
 
void tileset_setup_unit_type (struct tileset *t, struct unit_type *ut)
 
void tileset_setup_impr_type (struct tileset *t, struct impr_type *pimprove)
 
void tileset_setup_tech_type (struct tileset *t, struct advance *padvance)
 
void tileset_setup_extra (struct tileset *t, struct extra_type *pextra)
 
void tileset_setup_tile_type (struct tileset *t, const struct terrain *pterrain)
 
void tileset_setup_government (struct tileset *t, struct government *gov)
 
void tileset_setup_nation_flag (struct tileset *t, struct nation_type *nation)
 
struct spriteget_city_flag_sprite (const struct tileset *t, const struct city *pcity)
 
static struct spriteget_unit_nation_flag_sprite (const struct tileset *t, const struct unit *punit)
 
static void build_tile_data (const struct tile *ptile, struct terrain *pterrain, struct terrain **tterrain_near, bv_extras *textras_near)
 
static int fill_road_corner_sprites (const struct tileset *t, const struct extra_type *pextra, struct drawn_sprite *sprs, bool road, bool *road_near, bool hider, bool *hider_near)
 
static int fill_road_sprite_array (const struct tileset *t, const struct extra_type *pextra, struct drawn_sprite *sprs, bv_extras textras, bv_extras *textras_near, struct terrain *tterrain_near[8], const struct city *pcity)
 
static int get_irrigation_index (const struct tileset *t, struct extra_type *pextra, bv_extras *textras_near)
 
static int fill_irrigation_sprite_array (const struct tileset *t, struct drawn_sprite *sprs, bv_extras textras, bv_extras *textras_near, const struct city *pcity)
 
static int fill_city_overlays_sprite_array (const struct tileset *t, struct drawn_sprite *sprs, const struct tile *ptile, const struct city *citymode)
 
static int fill_terrain_sprite_blending (const struct tileset *t, struct drawn_sprite *sprs, const struct tile *ptile, const struct terrain *pterrain, struct terrain **tterrain_near)
 
static int fill_fog_sprite_array (const struct tileset *t, struct drawn_sprite *sprs, const struct tile *ptile, const struct tile_edge *pedge, const struct tile_corner *pcorner)
 
static int fill_terrain_sprite_array (struct tileset *t, struct drawn_sprite *sprs, int l, const struct tile *ptile, const struct terrain *pterrain, struct terrain **tterrain_near, struct drawing_data *draw)
 
static int fill_terrain_sprite_darkness (struct tileset *t, struct drawn_sprite *sprs, const struct tile *ptile, struct terrain **tterrain_near)
 
static int fill_terrain_sprite_layer (struct tileset *t, struct drawn_sprite *sprs, int layer_num, const struct tile *ptile, const struct terrain *pterrain, struct terrain **tterrain_near)
 
bool unit_drawn_with_city_outline (const struct unit *punit, bool check_focus)
 
static int fill_grid_sprite_array (const struct tileset *t, struct drawn_sprite *sprs, const struct tile *ptile, const struct tile_edge *pedge, const struct tile_corner *pcorner, const struct unit *punit, const struct city *pcity, const struct city *citymode)
 
static int fill_goto_sprite_array (const struct tileset *t, struct drawn_sprite *sprs, const struct tile *ptile, const struct tile_edge *pedge, const struct tile_corner *pcorner)
 
int fill_sprite_array (struct tileset *t, struct drawn_sprite *sprs, enum mapview_layer layer, const struct tile *ptile, const struct tile_edge *pedge, const struct tile_corner *pcorner, const struct unit *punit, const struct city *pcity, const struct city *citymode, const struct unit_type *putype)
 
void tileset_setup_city_tiles (struct tileset *t, int style)
 
double get_focus_unit_toggle_timeout (const struct tileset *t)
 
void reset_focus_unit_state (struct tileset *t)
 
void focus_unit_in_combat (struct tileset *t)
 
void toggle_focus_unit_state (struct tileset *t)
 
struct unitget_drawable_unit (const struct tileset *t, struct tile *ptile, const struct city *citymode)
 
static void unload_all_sprites (struct tileset *t)
 
void tileset_free_tiles (struct tileset *t)
 
struct spriteget_spaceship_sprite (const struct tileset *t, enum spaceship_part part)
 
struct spriteget_citizen_sprite (const struct tileset *t, enum citizen_category type, int citizen_index, const struct city *pcity)
 
struct spriteget_nation_flag_sprite (const struct tileset *t, const struct nation_type *pnation)
 
struct spriteget_nation_shield_sprite (const struct tileset *t, const struct nation_type *pnation)
 
struct spriteget_tech_sprite (const struct tileset *t, Tech_type_id tech)
 
struct spriteget_building_sprite (const struct tileset *t, const struct impr_type *pimprove)
 
struct spriteget_government_sprite (const struct tileset *t, const struct government *gov)
 
struct spriteget_unittype_sprite (const struct tileset *t, const struct unit_type *punittype, enum direction8 facing)
 
struct spriteget_sample_city_sprite (const struct tileset *t, int style_idx)
 
struct spriteget_arrow_sprite (const struct tileset *t, enum arrow_type arrow)
 
struct spriteget_tax_sprite (const struct tileset *t, Output_type_id otype)
 
struct spriteget_event_sprite (const struct tileset *t, enum event_type event)
 
struct spriteget_treaty_thumb_sprite (const struct tileset *t, bool on_off)
 
const struct sprite_vector * get_unit_explode_animation (const struct tileset *t)
 
struct spriteget_nuke_explode_sprite (const struct tileset *t)
 
const struct citybar_spritesget_citybar_sprites (const struct tileset *t)
 
const struct editor_spritesget_editor_sprites (const struct tileset *t)
 
struct spriteget_cursor_sprite (const struct tileset *t, enum cursor_type cursor, int *hot_x, int *hot_y, int frame)
 
struct spriteget_icon_sprite (const struct tileset *t, enum icon_type icon)
 
struct spriteget_attention_crosshair_sprite (const struct tileset *t)
 
struct spriteget_indicator_sprite (const struct tileset *t, enum indicator_type indicator, int idx)
 
struct spriteget_unit_unhappy_sprite (const struct tileset *t, const struct unit *punit, int happy_cost)
 
struct spriteget_unit_upkeep_sprite (const struct tileset *t, Output_type_id otype, const struct unit *punit, const int *upkeep_cost)
 
struct spriteget_basic_fog_sprite (const struct tileset *t)
 
struct color_systemget_color_system (const struct tileset *t)
 
void tileset_use_preferred_theme (const struct tileset *t)
 
void tileset_init (struct tileset *t)
 
int fill_basic_terrain_layer_sprite_array (struct tileset *t, struct drawn_sprite *sprs, int layer, struct terrain *pterrain)
 
int fill_basic_extra_sprite_array (const struct tileset *t, struct drawn_sprite *sprs, const struct extra_type *pextra)
 
enum mapview_layer tileset_get_layer (const struct tileset *t, int n)
 
bool tileset_layer_in_category (enum mapview_layer layer, enum layer_category cat)
 
void tileset_player_init (struct tileset *t, struct player *pplayer)
 
void tileset_background_init (struct tileset *t)
 
void tileset_background_free (struct tileset *t)
 
void tileset_ruleset_reset (struct tileset *t)
 
bool tileset_is_fully_loaded (void)
 
const char * tileset_name_get (struct tileset *t)
 
const char * tileset_version (struct tileset *t)
 
const char * tileset_summary (struct tileset *t)
 
const char * tileset_description (struct tileset *t)
 
char * tileset_what_ruleset (struct tileset *t)
 
int tileset_topo_index (struct tileset *t)
 

Variables

static const char direction4letters [4] = "udrl"
 
static const char edge_name [EDGE_COUNT][3] = {"ns", "we", "ud", "lr"}
 
static const int DIR4_TO_DIR8 [4]
 
struct tilesettileset = NULL
 
struct tilesetunscaled_tileset = NULL
 
int focus_unit_state = 0
 
static bool tileset_update = FALSE
 

Macro Definition Documentation

◆ ADD_SPRITE

#define ADD_SPRITE (   s,
  draw_fog,
  x_offset,
  y_offset 
)
Value:
(fc_assert(s != NULL), \
sprs->sprite = s, \
sprs->foggable = (draw_fog && t->fogstyle == FOG_AUTO), \
sprs->offset_x = x_offset, \
sprs->offset_y = y_offset, \
sprs++)
#define fc_assert(condition)
Definition log.h:176

Definition at line 4251 of file tilespec.c.

◆ ADD_SPRITE_FULL

#define ADD_SPRITE_FULL (   s)     ADD_SPRITE(s, TRUE, FULL_TILE_X_OFFSET, FULL_TILE_Y_OFFSET)

Definition at line 4259 of file tilespec.c.

◆ ADD_SPRITE_IF_NOT_NULL

#define ADD_SPRITE_IF_NOT_NULL (   x)
Value:
do {\
if ((x) != NULL) {\
ADD_SPRITE_FULL(x);\
}\
} while (FALSE)
#define FALSE
Definition support.h:47

◆ ADD_SPRITE_SIMPLE

#define ADD_SPRITE_SIMPLE (   s)    ADD_SPRITE(s, TRUE, 0, 0)

Definition at line 4258 of file tilespec.c.

◆ FULL_TILE_X_OFFSET

#define FULL_TILE_X_OFFSET   ((t->normal_tile_width - t->full_tile_width) / 2)

Definition at line 4248 of file tilespec.c.

◆ FULL_TILE_Y_OFFSET

#define FULL_TILE_Y_OFFSET   (t->normal_tile_height - t->full_tile_height)

Definition at line 4249 of file tilespec.c.

◆ LOAD_FACING_SPRITE

#define LOAD_FACING_SPRITE (   dir)
Value:
if (!tileset_setup_unit_direction(t, uidx, tag, dir, has_icon)) { \
facing_sprites = FALSE; \
}
static bool tileset_setup_unit_direction(struct tileset *t, int uidx, const char *base_str, enum direction8 dir, bool has_icon)
Definition tilespec.c:3494

◆ MATCH

#define MATCH (   dir)
Value:
(t->sprites.drawing[terrain_index(tterrain_near[(dir)])]->num_layers > l \
? t->sprites.drawing[terrain_index(tterrain_near[(dir)])]->layer[l].match_index[0] \
: -1)
Terrain_type_id terrain_index(const struct terrain *pterrain)
Definition terrain.c:126

◆ MAX_INDEX_CARDINAL

#define MAX_INDEX_CARDINAL   64

Definition at line 107 of file tilespec.c.

◆ MAX_INDEX_HALF

#define MAX_INDEX_HALF   16

Definition at line 108 of file tilespec.c.

◆ MAX_INDEX_VALID

#define MAX_INDEX_VALID   256

Definition at line 109 of file tilespec.c.

◆ MAX_NUM_LAYERS

#define MAX_NUM_LAYERS   3

Definition at line 165 of file tilespec.c.

◆ MAX_NUM_MATCH_WITH

#define MAX_NUM_MATCH_WITH   8

Definition at line 171 of file tilespec.c.

◆ MAX_NUM_UPKEEP_SPRITES

#define MAX_NUM_UPKEEP_SPRITES   10

Definition at line 114 of file tilespec.c.

◆ NUM_CORNER_DIRS

#define NUM_CORNER_DIRS   4

Definition at line 510 of file tilespec.c.

◆ NUM_TILES_DIGITS

#define NUM_TILES_DIGITS   10

Definition at line 112 of file tilespec.c.

◆ NUM_TILES_HP_BAR

#define NUM_TILES_HP_BAR   11

Definition at line 111 of file tilespec.c.

◆ NUM_TILES_SELECT

#define NUM_TILES_SELECT   4

Definition at line 113 of file tilespec.c.

◆ SET_EDITOR_SPRITE

#define SET_EDITOR_SPRITE (   x)    SET_SPRITE(editor.x, "editor." #x)

◆ SET_GOTO_TURN_SPRITE

#define SET_GOTO_TURN_SPRITE (   state,
  state_name,
  factor,
  factor_name 
)
Value:
fc_snprintf(buffer, sizeof(buffer), "path." state_name "_%d" #factor, i); \
SET_SPRITE_OPT(path.s[state].turns ## factor_name [i], buffer); \
if (t->sprites.path.s[state].turns ## factor_name [i] == NULL) { \
t->sprites.path.s[state].turns ## factor_name [i] = \
t->sprites.path.s[GTS_MP_LEFT].turns ## factor_name [i]; \
}
@ GTS_MP_LEFT
Definition goto.h:27
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:969

◆ SET_SPRITE

#define SET_SPRITE (   field,
  tag 
)
Value:
do { \
t->sprites.field = load_sprite(t, tag, TRUE, TRUE); \
if (t->sprites.field == NULL) { \
tileset_error(LOG_FATAL, tileset_name_get(t), \
_("Sprite for tag '%s' missing."), tag); \
} \
} while (FALSE)
#define _(String)
Definition fcintl.h:67
@ LOG_FATAL
Definition log.h:29
#define TRUE
Definition support.h:46
static struct sprite * load_sprite(struct tileset *t, const char *tag_name, bool scale, bool smooth)
Definition tilespec.c:2588
const char * tileset_name_get(struct tileset *t)
Definition tilespec.c:7211

Definition at line 2705 of file tilespec.c.

◆ SET_SPRITE_ALT

#define SET_SPRITE_ALT (   field,
  tag,
  alt 
)
Value:
do { \
t->sprites.field = load_sprite(t, tag, TRUE, TRUE); \
if (!t->sprites.field) { \
t->sprites.field = load_sprite(t, alt, TRUE, TRUE); \
} \
if (t->sprites.field == NULL) { \
tileset_error(LOG_FATAL, tileset_name_get(t), \
_("Sprite for tags '%s' and alternate '%s' are " \
"both missing."), tag, alt); \
} \
} while (FALSE)

Definition at line 2734 of file tilespec.c.

◆ SET_SPRITE_ALT_OPT

#define SET_SPRITE_ALT_OPT (   field,
  tag,
  alt 
)
Value:
do { \
t->sprites.field = tiles_lookup_sprite_tag_alt(t, LOG_VERBOSE, tag, alt,\
"sprite", #field, TRUE); \
} while (FALSE)
@ LOG_VERBOSE
Definition log.h:33
struct sprite * tiles_lookup_sprite_tag_alt(struct tileset *t, enum log_level level, const char *tag, const char *alt, const char *what, const char *name, bool scale)
Definition tilespec.c:3458

Definition at line 2751 of file tilespec.c.

◆ SET_SPRITE_NOTSMOOTH

#define SET_SPRITE_NOTSMOOTH (   field,
  tag 
)
Value:
do { \
t->sprites.field = load_sprite(t, tag, TRUE, FALSE); \
if (t->sprites.field == NULL) { \
tileset_error(LOG_FATAL, tileset_name_get(t), \
_("Sprite for tag '%s' missing."), tag); \
} \
} while (FALSE)

Definition at line 2715 of file tilespec.c.

◆ SET_SPRITE_OPT

#define SET_SPRITE_OPT (   field,
  tag 
)     t->sprites.field = load_sprite(t, tag, TRUE, TRUE)

Definition at line 2748 of file tilespec.c.

◆ SET_SPRITE_UNSCALED

#define SET_SPRITE_UNSCALED (   field,
  tag 
)
Value:
do { \
t->sprites.field = load_sprite(t, tag, FALSE, FALSE); \
if (t->sprites.field == NULL) { \
tileset_error(LOG_FATAL, tileset_name_get(t), \
_("Sprite for tag '%s' missing."), tag); \
} \
} while (FALSE)

Definition at line 2724 of file tilespec.c.

◆ small_sprite_list_iterate

#define small_sprite_list_iterate (   list,
  pitem 
)     TYPED_LIST_ITERATE(struct small_sprite, list, pitem)

Definition at line 431 of file tilespec.c.

◆ small_sprite_list_iterate_end

#define small_sprite_list_iterate_end   LIST_ITERATE_END

Definition at line 433 of file tilespec.c.

◆ SPEC_CAPSTR

#define SPEC_CAPSTR   "+Freeciv-3.1-spec"

Definition at line 95 of file tilespec.c.

◆ SPECENUM_COUNT

#define SPECENUM_COUNT   ESTYLE_COUNT

Definition at line 133 of file tilespec.c.

◆ SPECENUM_NAME

#define SPECENUM_NAME   extrastyle_id

Definition at line 116 of file tilespec.c.

◆ SPECENUM_VALUE0

#define SPECENUM_VALUE0   ESTYLE_ROAD_ALL_SEPARATE

Definition at line 117 of file tilespec.c.

◆ SPECENUM_VALUE0NAME

#define SPECENUM_VALUE0NAME   "RoadAllSeparate"

Definition at line 118 of file tilespec.c.

◆ SPECENUM_VALUE1

#define SPECENUM_VALUE1   ESTYLE_ROAD_PARITY_COMBINED

Definition at line 119 of file tilespec.c.

◆ SPECENUM_VALUE1NAME

#define SPECENUM_VALUE1NAME   "RoadParityCombined"

Definition at line 120 of file tilespec.c.

◆ SPECENUM_VALUE2

#define SPECENUM_VALUE2   ESTYLE_ROAD_ALL_COMBINED

Definition at line 121 of file tilespec.c.

◆ SPECENUM_VALUE2NAME

#define SPECENUM_VALUE2NAME   "RoadAllCombined"

Definition at line 122 of file tilespec.c.

◆ SPECENUM_VALUE3

#define SPECENUM_VALUE3   ESTYLE_RIVER

Definition at line 123 of file tilespec.c.

◆ SPECENUM_VALUE3NAME

#define SPECENUM_VALUE3NAME   "River"

Definition at line 124 of file tilespec.c.

◆ SPECENUM_VALUE4

#define SPECENUM_VALUE4   ESTYLE_SINGLE1

Definition at line 125 of file tilespec.c.

◆ SPECENUM_VALUE4NAME

#define SPECENUM_VALUE4NAME   "Single1"

Definition at line 126 of file tilespec.c.

◆ SPECENUM_VALUE5

#define SPECENUM_VALUE5   ESTYLE_SINGLE2

Definition at line 127 of file tilespec.c.

◆ SPECENUM_VALUE5NAME

#define SPECENUM_VALUE5NAME   "Single2"

Definition at line 128 of file tilespec.c.

◆ SPECENUM_VALUE6

#define SPECENUM_VALUE6   ESTYLE_3LAYER

Definition at line 129 of file tilespec.c.

◆ SPECENUM_VALUE6NAME

#define SPECENUM_VALUE6NAME   "3Layer"

Definition at line 130 of file tilespec.c.

◆ SPECENUM_VALUE7

#define SPECENUM_VALUE7   ESTYLE_CARDINALS

Definition at line 131 of file tilespec.c.

◆ SPECENUM_VALUE7NAME

#define SPECENUM_VALUE7NAME   "Cardinals"

Definition at line 132 of file tilespec.c.

◆ specfile_list_iterate

#define specfile_list_iterate (   list,
  pitem 
)     TYPED_LIST_ITERATE(struct specfile, list, pitem)

Definition at line 402 of file tilespec.c.

◆ specfile_list_iterate_end

#define specfile_list_iterate_end   LIST_ITERATE_END

Definition at line 404 of file tilespec.c.

◆ SPECHASH_ASTR_KEY_TYPE [1/2]

#define SPECHASH_ASTR_KEY_TYPE

Definition at line 437 of file tilespec.c.

◆ SPECHASH_ASTR_KEY_TYPE [2/2]

#define SPECHASH_ASTR_KEY_TYPE

Definition at line 437 of file tilespec.c.

◆ SPECHASH_CSTR_KEY_TYPE

#define SPECHASH_CSTR_KEY_TYPE

Definition at line 449 of file tilespec.c.

◆ SPECHASH_ENUM_DATA_TYPE

#define SPECHASH_ENUM_DATA_TYPE   extrastyle_id

Definition at line 456 of file tilespec.c.

◆ SPECHASH_IDATA_FREE

#define SPECHASH_IDATA_FREE   drawing_data_destroy

Definition at line 451 of file tilespec.c.

◆ SPECHASH_IDATA_TYPE [1/2]

#define SPECHASH_IDATA_TYPE   struct small_sprite *

Definition at line 438 of file tilespec.c.

◆ SPECHASH_IDATA_TYPE [2/2]

#define SPECHASH_IDATA_TYPE   struct drawing_data *

Definition at line 438 of file tilespec.c.

◆ SPECHASH_TAG [1/3]

#define SPECHASH_TAG   sprite

Definition at line 436 of file tilespec.c.

◆ SPECHASH_TAG [2/3]

#define SPECHASH_TAG   drawing

Definition at line 436 of file tilespec.c.

◆ SPECHASH_TAG [3/3]

#define SPECHASH_TAG   estyle

Definition at line 436 of file tilespec.c.

◆ SPECLIST_TAG [1/2]

#define SPECLIST_TAG   specfile

Definition at line 398 of file tilespec.c.

◆ SPECLIST_TAG [2/2]

#define SPECLIST_TAG   small_sprite

Definition at line 398 of file tilespec.c.

◆ SPECLIST_TYPE [1/2]

#define SPECLIST_TYPE   struct specfile

Definition at line 399 of file tilespec.c.

◆ SPECLIST_TYPE [2/2]

#define SPECLIST_TYPE   struct small_sprite

Definition at line 399 of file tilespec.c.

◆ sprite_hash_iterate

#define sprite_hash_iterate (   hash,
  tag_name,
  sprite 
)
Value:
TYPED_HASH_ITERATE(const char *, struct small_sprite *, \
char * tag_name
Definition events.c:77
static GHashTable * hash
Definition wldlg.c:320
#define TYPED_HASH_ITERATE(TYPE_key, TYPE_data, ARG_ht, NAME_key, NAME_data)
Definition spechash.h:726

Definition at line 440 of file tilespec.c.

◆ sprite_hash_iterate_end

#define sprite_hash_iterate_end   HASH_ITERATE_END

Definition at line 443 of file tilespec.c.

◆ TILE_SECTION_PREFIX

#define TILE_SECTION_PREFIX   "tile_"

Definition at line 104 of file tilespec.c.

◆ TILES_PER_CORNER

#define TILES_PER_CORNER   4

Definition at line 511 of file tilespec.c.

◆ TILESPEC_CAPSTR

#define TILESPEC_CAPSTR   "+Freeciv-3.1-tilespec duplicates_ok"

Definition at line 79 of file tilespec.c.

◆ TILESPEC_SUFFIX

#define TILESPEC_SUFFIX   ".tilespec"

Definition at line 103 of file tilespec.c.

◆ UNKNOWN

#define UNKNOWN (   dir)
Value:
((adjc_tile = mapstep(&(wld.map), ptile, (dir))) \
enum known_type client_tile_get_known(const struct tile *ptile)
Definition climap.c:36
struct world wld
Definition game.c:58
struct tile * mapstep(const struct civ_map *nmap, const struct tile *ptile, enum direction8 dir)
Definition map.c:369
struct civ_map map
@ TILE_UNKNOWN
Definition tile.h:35

Enumeration Type Documentation

◆ direction4

enum direction4
Enumerator
DIR4_NORTH 
DIR4_SOUTH 
DIR4_EAST 
DIR4_WEST 

Definition at line 137 of file tilespec.c.

◆ match_style

Enumerator
MATCH_NONE 
MATCH_SAME 
MATCH_PAIR 
MATCH_FULL 

Definition at line 147 of file tilespec.c.

◆ sprite_type

Enumerator
CELL_WHOLE 
CELL_CORNER 

Definition at line 154 of file tilespec.c.

Function Documentation

◆ build_tile_data()

static void build_tile_data ( const struct tile ptile,
struct terrain pterrain,
struct terrain **  tterrain_near,
bv_extras *  textras_near 
)
static

Assemble some data that is used in building the tile sprite arrays. (map_x, map_y) : the (normalized) map position The values we fill in: tterrain_near : terrain types of all adjacent terrain textra_near : extras of all adjacent terrain

Definition at line 4269 of file tilespec.c.

Referenced by fill_sprite_array().

◆ calculate_max_upkeep_height()

static int calculate_max_upkeep_height ( const struct tileset t)
static

Calculate the height of a unit upkeep icons.

Definition at line 776 of file tilespec.c.

Referenced by tileset_lookup_sprite_tags().

◆ cardinal_index_str()

static const char * cardinal_index_str ( const struct tileset t,
int  idx 
)
static

Return a directional string for the cardinal directions. Normally the binary value 1000 will be converted into "n1e0s0w0". This is in a clockwise ordering.

Definition at line 2545 of file tilespec.c.

Referenced by load_river_sprites(), tileset_lookup_sprite_tags(), tileset_setup_extra(), and tileset_setup_tile_type().

◆ check_sprite_type()

static int check_sprite_type ( const char *  sprite_type,
const char *  tile_section 
)
static

Determine the sprite_type string.

Definition at line 1764 of file tilespec.c.

Referenced by tileset_read_toplevel().

◆ check_tilespec_capabilities()

static bool check_tilespec_capabilities ( struct section_file file,
const char *  which,
const char *  us_capstr,
const char *  filename,
bool  verbose 
)
static

Checks options in filename match what we require and support. Die if not. 'which' should be "tilespec" or "spec".

Definition at line 1108 of file tilespec.c.

Referenced by ensure_big_sprite(), scan_specfile(), and tileset_read_toplevel().

◆ citizen_rule_name()

static const char * citizen_rule_name ( enum citizen_category  citizen)
static

Returns a text name for the citizen, as used in the tileset.

Definition at line 2520 of file tilespec.c.

Referenced by tileset_setup_citizen_types().

◆ create_plr_sprite()

static struct sprite * create_plr_sprite ( struct color pcolor)
static

Create a sprite with the given color and tag.

Definition at line 2658 of file tilespec.c.

Referenced by tileset_background_init(), and tileset_player_init().

◆ dir_by_tileset_name()

static enum direction8 dir_by_tileset_name ( const char *  str)
static

Parse a direction name as a direction8.

Definition at line 974 of file tilespec.c.

Referenced by tileset_read_toplevel().

◆ dir_get_tileset_name()

static const char * dir_get_tileset_name ( enum direction8  dir)
static

Return the tileset name of the direction. This is similar to dir_get_name but you shouldn't change this or all tilesets will break.

Definition at line 947 of file tilespec.c.

Referenced by cardinal_index_str(), dir_by_tileset_name(), load_river_sprites(), tileset_lookup_sprite_tags(), tileset_setup_road(), tileset_setup_unit_direction(), and valid_index_str().

◆ drawing_data_destroy()

static void drawing_data_destroy ( struct drawing_data draw)
static

Free a drawing data.

Definition at line 623 of file tilespec.c.

Referenced by tileset_read_toplevel().

◆ drawing_data_new()

static struct drawing_data * drawing_data_new ( void  )
static

Create a new drawing data.

Definition at line 611 of file tilespec.c.

Referenced by tileset_read_toplevel().

◆ ensure_big_sprite()

static void ensure_big_sprite ( struct specfile sf,
const char *  tset_name 
)
static

Ensure that the big sprite of the given spec file is loaded.

Definition at line 1524 of file tilespec.c.

Referenced by load_sprite().

◆ fill_basic_base_sprite_array()

int fill_basic_base_sprite_array ( const struct tileset t,
struct drawn_sprite sprs,
const struct extra_type pextra 
)
static

Fills the sprite array with sprites that together make a representative image of the given base type. The image is suitable for use as an icon for the base type, for example.

Definition at line 6980 of file tilespec.c.

Referenced by fill_basic_extra_sprite_array().

◆ fill_basic_extra_sprite_array()

int fill_basic_extra_sprite_array ( const struct tileset t,
struct drawn_sprite sprs,
const struct extra_type pextra 
)

Return a representative sprite for the given extra type.

Definition at line 6897 of file tilespec.c.

Referenced by create_extra_pixbuf(), help_dialog::make_tree(), set_help_tile_from_extra(), help_widget::set_topic_extra(), and terrain_canvas().

◆ fill_basic_road_sprite_array()

int fill_basic_road_sprite_array ( const struct tileset t,
struct drawn_sprite sprs,
const struct extra_type pextra 
)
static

Fills the sprite array with sprites that together make a representative image of the given road type. The image is suitable for use as an icon for the road type, for example.

Definition at line 6932 of file tilespec.c.

Referenced by fill_basic_extra_sprite_array().

◆ fill_basic_terrain_layer_sprite_array()

int fill_basic_terrain_layer_sprite_array ( struct tileset t,
struct drawn_sprite sprs,
int  layer,
struct terrain pterrain 
)

Fill the sprite array with sprites that together make a representative image of the given terrain type. Suitable for use as an icon and in list views.

NB: The 'layer' argument is NOT a LAYER_* value, but rather one of 0, 1, 2. Using other values for 'layer' here will result in undefined behaviour. ;)

Definition at line 6864 of file tilespec.c.

Referenced by create_terrain_pixbuf(), set_help_tile_from_terrain(), and terrain_canvas().

◆ fill_city_overlays_sprite_array()

static int fill_city_overlays_sprite_array ( const struct tileset t,
struct drawn_sprite sprs,
const struct tile ptile,
const struct city citymode 
)
static

Fill in the city overlays for the tile. This includes the citymap overlays on the mapview as well as the tile output sprites.

Definition at line 4830 of file tilespec.c.

Referenced by fill_sprite_array().

◆ fill_fog_sprite_array()

static int fill_fog_sprite_array ( const struct tileset t,
struct drawn_sprite sprs,
const struct tile ptile,
const struct tile_edge pedge,
const struct tile_corner pcorner 
)
static

Add sprites for fog (and some forms of darkness).

Definition at line 4950 of file tilespec.c.

Referenced by fill_sprite_array().

◆ fill_goto_sprite_array()

static int fill_goto_sprite_array ( const struct tileset t,
struct drawn_sprite sprs,
const struct tile ptile,
const struct tile_edge pedge,
const struct tile_corner pcorner 
)
static

Fill in the given sprite array with any needed goto sprites.

Definition at line 5433 of file tilespec.c.

Referenced by fill_sprite_array().

◆ fill_grid_sprite_array()

static int fill_grid_sprite_array ( const struct tileset t,
struct drawn_sprite sprs,
const struct tile ptile,
const struct tile_edge pedge,
const struct tile_corner pcorner,
const struct unit punit,
const struct city pcity,
const struct city citymode 
)
static

Fill in the grid sprites for the given tile, city, and unit.

Definition at line 5283 of file tilespec.c.

Referenced by fill_sprite_array().

◆ fill_irrigation_sprite_array()

static int fill_irrigation_sprite_array ( const struct tileset t,
struct drawn_sprite sprs,
bv_extras  textras,
bv_extras *  textras_near,
const struct city pcity 
)
static

Fill in the farmland/irrigation sprite for the tile.

Definition at line 4788 of file tilespec.c.

Referenced by fill_sprite_array().

◆ fill_road_corner_sprites()

static int fill_road_corner_sprites ( const struct tileset t,
const struct extra_type pextra,
struct drawn_sprite sprs,
bool  road,
bool road_near,
bool  hider,
bool hider_near 
)
static

Add any corner road sprites to the sprite array.

Definition at line 4505 of file tilespec.c.

Referenced by fill_road_sprite_array().

◆ fill_road_sprite_array()

static int fill_road_sprite_array ( const struct tileset t,
const struct extra_type pextra,
struct drawn_sprite sprs,
bv_extras  textras,
bv_extras *  textras_near,
struct terrain tterrain_near[8],
const struct city pcity 
)
static

Fill all road and rail sprites into the sprite array.

Definition at line 4556 of file tilespec.c.

Referenced by fill_sprite_array().

◆ fill_sprite_array()

int fill_sprite_array ( struct tileset t,
struct drawn_sprite sprs,
enum mapview_layer  layer,
const struct tile ptile,
const struct tile_edge pedge,
const struct tile_corner pcorner,
const struct unit punit,
const struct city pcity,
const struct city citymode,
const struct unit_type putype 
)

Fill in the sprite array for the given tile, city, and unit.

ptile, if specified, gives the tile. If specified the terrain and specials will be drawn for this tile. In this case (map_x,map_y) should give the location of the tile.

punit, if specified, gives the unit. For tile drawing this should generally be get_drawable_unit(); otherwise it can be any unit.

pcity, if specified, gives the city. For tile drawing this should generally be tile_city(ptile); otherwise it can be any city.

citymode specifies whether this is part of a citydlg. If so some drawing is done differently.

Definition at line 5568 of file tilespec.c.

Referenced by put_one_element().

◆ fill_terrain_sprite_array()

static int fill_terrain_sprite_array ( struct tileset t,
struct drawn_sprite sprs,
int  l,
const struct tile ptile,
const struct terrain pterrain,
struct terrain **  tterrain_near,
struct drawing_data draw 
)
static

Helper function for fill_terrain_sprite_layer().

Definition at line 5004 of file tilespec.c.

Referenced by fill_basic_terrain_layer_sprite_array(), and fill_terrain_sprite_layer().

◆ fill_terrain_sprite_blending()

static int fill_terrain_sprite_blending ( const struct tileset t,
struct drawn_sprite sprs,
const struct tile ptile,
const struct terrain pterrain,
struct terrain **  tterrain_near 
)
static

Helper function for fill_terrain_sprite_layer. Fill in the sprite array for blended terrain.

Definition at line 4910 of file tilespec.c.

Referenced by fill_terrain_sprite_layer().

◆ fill_terrain_sprite_darkness()

static int fill_terrain_sprite_darkness ( struct tileset t,
struct drawn_sprite sprs,
const struct tile ptile,
struct terrain **  tterrain_near 
)
static

Helper function for fill_terrain_sprite_layer. Fill in the sprite array of darkness.

Definition at line 5157 of file tilespec.c.

Referenced by fill_sprite_array().

◆ fill_terrain_sprite_layer()

static int fill_terrain_sprite_layer ( struct tileset t,
struct drawn_sprite sprs,
int  layer_num,
const struct tile ptile,
const struct terrain pterrain,
struct terrain **  tterrain_near 
)
static

Add sprites for the base tile to the sprite list. This doesn't include specials or rivers.

Definition at line 5221 of file tilespec.c.

Referenced by fill_sprite_array().

◆ fill_unit_sprite_array()

static int fill_unit_sprite_array ( const struct tileset t,
struct drawn_sprite sprs,
const struct unit punit,
int  stack,
bool  backdrop 
)
static

Fill in the sprite array for the unit.

Definition at line 4319 of file tilespec.c.

Referenced by fill_sprite_array().

◆ fill_unit_type_sprite_array()

static int fill_unit_type_sprite_array ( const struct tileset t,
struct drawn_sprite sprs,
const struct unit_type putype,
enum direction8  facing 
)
static

Fill in the sprite array for the unit type.

Definition at line 4301 of file tilespec.c.

Referenced by fill_sprite_array(), and fill_unit_sprite_array().

◆ finish_loading_sprites()

void finish_loading_sprites ( struct tileset t)

Frees any internal buffers which are created by load_sprite. Should be called after the last (for a given period of time) load_sprite call. This saves a fair amount of memory, but it will take extra time the next time we start loading sprites again.

Definition at line 3432 of file tilespec.c.

Referenced by handle_rulesets_ready(), and tileset_load_tiles().

◆ focus_unit_in_combat()

void focus_unit_in_combat ( struct tileset t)

Setup tileset for showing combat where focus unit participates.

Definition at line 6278 of file tilespec.c.

Referenced by set_units_in_combat().

◆ free_city_sprite()

static void free_city_sprite ( struct city_sprite city_sprite)
static

Frees a city sprite.

See also get_city_sprite, load_city_sprite.

Definition at line 2963 of file tilespec.c.

Referenced by tileset_free_tiles(), and tileset_setup_city_tiles().

◆ get_arrow_sprite()

struct sprite * get_arrow_sprite ( const struct tileset t,
enum arrow_type  arrow 
)

Return a sprite with an "arrow" theme graphic.

Definition at line 6564 of file tilespec.c.

Referenced by populate_unit_image_table(), and populate_unit_pic_table().

◆ get_attention_crosshair_sprite()

struct sprite * get_attention_crosshair_sprite ( const struct tileset t)

Returns a sprite with the "user-attention" crosshair graphic.

FIXME: This function shouldn't be needed if the attention graphics are drawn natively by the tileset code.

Definition at line 6685 of file tilespec.c.

Referenced by draw_calculated_trade_routes(), and put_cross_overlay_tile().

◆ get_basic_fog_sprite()

struct sprite * get_basic_fog_sprite ( const struct tileset t)

Return a rectangular sprite containing a fog "color". This can be used for drawing fog onto arbitrary areas (like the overview).

Definition at line 6748 of file tilespec.c.

Referenced by put_overview_tile_area().

◆ get_building_sprite()

struct sprite * get_building_sprite ( const struct tileset t,
const struct impr_type pimprove 
)

◆ get_citizen_sprite()

struct sprite * get_citizen_sprite ( const struct tileset t,
enum citizen_category  type,
int  citizen_index,
const struct city pcity 
)

Return a sprite for the given citizen. The citizen's type is given, as well as their index (in the range [0..city_size_get(pcity))). The citizen's city can be used to determine which sprite to use (a NULL value indicates there is no city; i.e., the sprite is just being used as a picture).

Definition at line 6437 of file tilespec.c.

Referenced by city_dialog_update_citizens(), client_government_sprite(), get_citizen_surface(), refresh_feeling_surface(), refresh_feeling_surface(), and city_dialog::update_citizens().

◆ get_city_flag_sprite()

struct sprite * get_city_flag_sprite ( const struct tileset t,
const struct city pcity 
)

Return the flag graphic to be used by the city.

Definition at line 4227 of file tilespec.c.

Referenced by fill_sprite_array(), and show_full_citybar().

◆ get_city_sprite()

static struct sprite * get_city_sprite ( const struct city_sprite city_sprite,
const struct city pcity 
)
static

Return the sprite in the city_sprite listing that corresponds to this city - based on city style and size.

See also load_city_sprite, free_city_sprite.

Definition at line 2858 of file tilespec.c.

Referenced by fill_sprite_array().

◆ get_citybar_sprites()

const struct citybar_sprites * get_citybar_sprites ( const struct tileset t)

Return all the sprites used for city bar drawing.

Definition at line 6633 of file tilespec.c.

Referenced by show_full_citybar().

◆ get_color_system()

struct color_system * get_color_system ( const struct tileset t)

Return the tileset's color system.

Definition at line 6756 of file tilespec.c.

Referenced by get_color().

◆ get_cursor_sprite()

struct sprite * get_cursor_sprite ( const struct tileset t,
enum cursor_type  cursor,
int *  hot_x,
int *  hot_y,
int  frame 
)

Returns a sprite for the given cursor. The "hot" coordinates (the active coordinates of the mouse relative to the sprite) are placed int (*hot_x, *hot_y). A cursor can consist of several frames to be used for animation.

Definition at line 6656 of file tilespec.c.

Referenced by animate_mouse_cursor(), fc_client::create_cursors(), and load_cursors().

◆ get_drawable_unit()

struct unit * get_drawable_unit ( const struct tileset t,
struct tile ptile,
const struct city citymode 
)

Find unit that we can display from given tile.

Definition at line 6302 of file tilespec.c.

Referenced by city_dialog_redraw_map(), and put_one_tile().

◆ get_editor_sprites()

const struct editor_sprites * get_editor_sprites ( const struct tileset t)

Return all the sprites used for editor icons, images, etc.

Definition at line 6645 of file tilespec.c.

Referenced by editbar_create(), editor_get_mode_sprite(), editor_tool_get_sprite(), and get_tool_value_pixbuf().

◆ get_event_sprite()

struct sprite * get_event_sprite ( const struct tileset t,
enum event_type  event 
)

Return event icon sprite

Definition at line 6596 of file tilespec.c.

Referenced by meswin_dialog_refresh(), and messagewdg::msg().

◆ get_focus_unit_toggle_timeout()

double get_focus_unit_toggle_timeout ( const struct tileset t)

Return the amount of time between calls to toggle_focus_unit_state. The main loop needs to call toggle_focus_unit_state about this often to do the active-unit animation.

Definition at line 6257 of file tilespec.c.

Referenced by blink_active_unit().

◆ get_government_sprite()

struct sprite * get_government_sprite ( const struct tileset t,
const struct government gov 
)

◆ get_icon_sprite()

struct sprite * get_icon_sprite ( const struct tileset t,
enum icon_type  icon 
)

Return a sprite for the given icon. Icons are used by the operating system/window manager. Usually freeciv has to tell the OS what icon to use.

Note that this function will return NULL before the sprites are loaded. The GUI code must be sure to call tileset_load_tiles before setting the top-level icon.

Definition at line 6674 of file tilespec.c.

Referenced by create_city_dialog(), qtg_ui_main(), city_dialog::setup_ui(), tileset_changed(), and ui_main().

◆ get_indicator_sprite()

struct sprite * get_indicator_sprite ( const struct tileset t,
enum indicator_type  indicator,
int  idx 
)

Returns a sprite for the given indicator with the given index. The index should be in [0, NUM_TILES_PROGRESS).

Definition at line 6694 of file tilespec.c.

Referenced by client_cooling_sprite(), client_research_sprite(), and client_warming_sprite().

◆ get_irrigation_index()

static int get_irrigation_index ( const struct tileset t,
struct extra_type pextra,
bv_extras *  textras_near 
)
static

Return the index of the sprite to be used for irrigation or farmland in this tile.

We assume that the current tile has farmland or irrigation. We then choose a sprite (index) based upon which cardinally adjacent tiles have either farmland or irrigation (the two are considered interchangable for this).

Definition at line 4768 of file tilespec.c.

Referenced by fill_irrigation_sprite_array().

◆ get_nation_flag_sprite()

struct sprite * get_nation_flag_sprite ( const struct tileset t,
const struct nation_type pnation 
)

◆ get_nation_shield_sprite()

struct sprite * get_nation_shield_sprite ( const struct tileset t,
const struct nation_type pnation 
)

Return the shield sprite for the nation.

Definition at line 6476 of file tilespec.c.

Referenced by pregame_options::update_buttons().

◆ get_nuke_explode_sprite()

struct sprite * get_nuke_explode_sprite ( const struct tileset t)

Return a sprite contining the single nuke graphic.

TODO: This should be an animation like the unit explode animation.

Definition at line 6625 of file tilespec.c.

Referenced by nuke_animation(), and put_nuke_mushroom_pixmaps().

◆ get_sample_city_sprite()

struct sprite * get_sample_city_sprite ( const struct tileset t,
int  style_idx 
)

Return a "sample" sprite for this city style.

Definition at line 6547 of file tilespec.c.

Referenced by create_races_dialog(), get_sample_city_surface(), and races_dialog::races_dialog().

◆ get_spaceship_sprite()

struct sprite * get_spaceship_sprite ( const struct tileset t,
enum spaceship_part  part 
)

Return the sprite for drawing the given spaceship part.

Definition at line 6424 of file tilespec.c.

Referenced by get_spaceship_dimensions(), and put_spaceship().

◆ get_tax_sprite()

struct sprite * get_tax_sprite ( const struct tileset t,
Output_type_id  otype 
)

◆ get_tech_sprite()

struct sprite * get_tech_sprite ( const struct tileset t,
Tech_type_id  tech 
)

◆ get_tileset()

struct tileset * get_tileset ( void  )

◆ get_tileset_list()

const struct strvec * get_tileset_list ( const struct option poption)

Returns a static list of tilesets available on the system by searching all data directories for files matching TILESPEC_SUFFIX.

Definition at line 1047 of file tilespec.c.

Referenced by mr_menu::tileset_custom_load().

◆ get_treaty_thumb_sprite()

struct sprite * get_treaty_thumb_sprite ( const struct tileset t,
bool  on_off 
)

Return a thumbs-up/thumbs-down sprite to show treaty approval or disapproval.

Definition at line 6605 of file tilespec.c.

Referenced by get_thumb_pixbuf(), and diplo_wdg::update_wdg().

◆ get_unit_explode_animation()

const struct sprite_vector * get_unit_explode_animation ( const struct tileset t)

Return a sprite_vector containing the animation sprites for a unit explosion.

Definition at line 6614 of file tilespec.c.

Referenced by decrease_unit_hp_smooth().

◆ get_unit_nation_flag_sprite()

static struct sprite * get_unit_nation_flag_sprite ( const struct tileset t,
const struct unit punit 
)
static

Return a sprite for the national flag for this unit.

Definition at line 4236 of file tilespec.c.

Referenced by fill_unit_sprite_array().

◆ get_unit_unhappy_sprite()

struct sprite * get_unit_unhappy_sprite ( const struct tileset t,
const struct unit punit,
int  happy_cost 
)

Return a sprite for the unhappiness of the unit - to be shown as an overlay on the unit in the city support dialog, for instance.

May return NULL if there's no unhappiness.

Definition at line 6711 of file tilespec.c.

Referenced by put_unit_city_overlays().

◆ get_unit_upkeep_sprite()

struct sprite * get_unit_upkeep_sprite ( const struct tileset t,
Output_type_id  otype,
const struct unit punit,
const int *  upkeep_cost 
)

Return a sprite for the upkeep of the unit - to be shown as an overlay on the unit in the city support dialog, for instance.

May return NULL if there's no upkeep of the kind.

Definition at line 6730 of file tilespec.c.

Referenced by put_unit_city_overlays().

◆ get_unittype_sprite()

struct sprite * get_unittype_sprite ( const struct tileset t,
const struct unit_type punittype,
enum direction8  facing 
)

◆ is_cardinal_tileset_dir()

static bool is_cardinal_tileset_dir ( const struct tileset t,
enum direction8  dir 
)
static

Return TRUE iff the dir is cardinal in this tileset.

"Cardinal", in this sense, means that a tile will share a border with another tile in the direction rather than sharing just a single vertex.

Definition at line 1010 of file tilespec.c.

Referenced by fill_road_corner_sprites(), fill_road_sprite_array(), tileset_read_toplevel(), and tileset_setup_road().

◆ is_extra_drawing_enabled()

static bool is_extra_drawing_enabled ( struct extra_type pextra)
static

Should the given extra be drawn FIXME: Some extras can not be switched

Definition at line 5501 of file tilespec.c.

Referenced by fill_irrigation_sprite_array(), and fill_sprite_array().

◆ is_valid_tileset_dir()

static bool is_valid_tileset_dir ( const struct tileset t,
enum direction8  dir 
)
static

Return TRUE iff the dir is valid in this tileset.

Definition at line 992 of file tilespec.c.

Referenced by is_cardinal_tileset_dir(), tileset_read_toplevel(), and tileset_setup_unit_direction().

◆ load_city_sprite()

static struct city_sprite * load_city_sprite ( struct tileset t,
const char *  tag 
)
static

Allocates and loads a new city sprite from the given sprite tags.

tag may be NULL.

See also get_city_sprite, free_city_sprite.

Definition at line 2935 of file tilespec.c.

Referenced by tileset_setup_city_tiles().

◆ load_city_thresholds_sprites()

static int load_city_thresholds_sprites ( struct tileset t,
const char *  tag,
char *  graphic,
char *  graphic_alt,
struct city_style_threshold **  thresholds 
)
static

Allocates one threshold set for city sprite

Definition at line 2894 of file tilespec.c.

Referenced by load_city_sprite().

◆ load_gfx_file()

static struct sprite * load_gfx_file ( const char *  gfx_filename)
static

Loads the given graphics file (found in the data path) into a newly allocated sprite.

Definition at line 1496 of file tilespec.c.

Referenced by ensure_big_sprite(), and load_sprite().

◆ load_river_sprites()

static bool load_river_sprites ( struct tileset t,
struct river_sprites store,
const char *  tag_pfx 
)
static

Load sprites of one river type.

Definition at line 3398 of file tilespec.c.

Referenced by tileset_setup_road().

◆ load_sprite()

static struct sprite * load_sprite ( struct tileset t,
const char *  tag_name,
bool  scale,
bool  smooth 
)
static

Loads the sprite. If the sprite is already loaded a reference counter is increased. Can return NULL if the sprite couldn't be loaded. Scale means if sprite should be scaled, smooth if scaling might use other scaling algorithm than nearest neighbor.

Definition at line 2588 of file tilespec.c.

Referenced by fill_terrain_sprite_layer(), load_city_thresholds_sprites(), load_river_sprites(), tiles_lookup_sprite_tag_alt(), tileset_lookup_sprite_tags(), tileset_setup_base(), tileset_setup_citizen_types(), tileset_setup_extra(), tileset_setup_nation_flag(), tileset_setup_specialist_type(), tileset_setup_tile_type(), tileset_setup_unit_direction(), and tileset_setup_unit_type_from_tag().

◆ reset_focus_unit_state()

void reset_focus_unit_state ( struct tileset t)

Reset the focus unit state. This should be called when changing focus units.

Definition at line 6270 of file tilespec.c.

Referenced by focus_unit_in_combat().

◆ scan_specfile()

static void scan_specfile ( struct tileset t,
struct specfile sf,
bool  duplicates_ok 
)
static

Scan all sprites declared in the given specfile. This means that the positions of the sprites in the big_sprite are saved in the small_sprite structs.

Definition at line 1567 of file tilespec.c.

Referenced by tileset_read_toplevel().

◆ sprite_exists()

static bool sprite_exists ( const struct tileset t,
const char *  tag_name 
)
static

Return TRUE iff the specified sprite exists in the tileset (whether or not it is currently loaded).

Definition at line 2698 of file tilespec.c.

Referenced by tileset_lookup_sprite_tags().

◆ tiles_lookup_sprite_tag_alt()

struct sprite * tiles_lookup_sprite_tag_alt ( struct tileset t,
enum log_level  level,
const char *  tag,
const char *  alt,
const char *  what,
const char *  name,
bool  scale 
)

Lookup sprite to match tag, or else to match alt if don't find, or else return NULL, and emit log message.

Definition at line 3458 of file tilespec.c.

Referenced by tileset_setup_government(), tileset_setup_impr_type(), tileset_setup_tech_type(), tileset_setup_tile_type(), and unittype_item::unittype_item().

◆ tileset_background_free()

void tileset_background_free ( struct tileset t)

Free tiles for the background.

Definition at line 7167 of file tilespec.c.

Referenced by tileset_background_init(), and tileset_free_tiles().

◆ tileset_background_init()

void tileset_background_init ( struct tileset t)

Setup tiles for the background.

Definition at line 7148 of file tilespec.c.

Referenced by handle_ruleset_game(), and tilespec_reread().

◆ tileset_basename()

const char * tileset_basename ( const struct tileset t)

◆ tileset_citybar_offset_y()

int tileset_citybar_offset_y ( const struct tileset t)

Return the offset from the origin of the city tile at which to place the city bar text.

Definition at line 873 of file tilespec.c.

Referenced by show_city_descriptions(), show_full_citybar(), and show_small_citybar().

◆ tileset_description()

const char * tileset_description ( struct tileset t)

Return tileset description body

Definition at line 7235 of file tilespec.c.

Referenced by boot_help_texts().

◆ tileset_error()

void tileset_error ( enum log_level  level,
const char *  tset_name,
const char *  format,
  ... 
)

◆ tileset_free()

void tileset_free ( struct tileset t)

◆ tileset_free_tiles()

void tileset_free_tiles ( struct tileset t)

Free all sprites from tileset.

Definition at line 6342 of file tilespec.c.

Referenced by fc_client::fc_main(), tileset_free(), and ui_main().

◆ tileset_free_toplevel()

static void tileset_free_toplevel ( struct tileset t)
static

Frees the tilespec toplevel data, in preparation for re-reading it.

See tilespec_read_toplevel().

Definition at line 1146 of file tilespec.c.

Referenced by tileset_free().

◆ tileset_full_tile_height()

int tileset_full_tile_height ( const struct tileset t)

Return the full tile height of the current tileset. This is the maximum height that any mapview sprite will have. This may be greater than the tile width in which case the extra area is above the "normal" tile.

Some callers assume the full height is 50% larger than the height in iso-view, and equal in non-iso view.

Definition at line 752 of file tilespec.c.

Referenced by battle_animation(), city_dialog_update_present_units(), create_pixbuf_from_layers(), create_present_supported_units_widget_list(), get_terrain_surface(), move_unit_map_canvas(), movement_animation(), put_city(), put_terrain(), put_unit_image(), put_unit_picture(), redraw_unit_info_label(), help_widget::set_topic_extra(), help_widget::set_topic_unit(), terrain_canvas(), tile_to_canvas_pos(), usdlg_get_unit_image(), and usdlg_tab_append_utype().

◆ tileset_full_tile_width()

int tileset_full_tile_width ( const struct tileset t)

◆ tileset_get_layer()

enum mapview_layer tileset_get_layer ( const struct tileset t,
int  n 
)

Gets the nth layer of the tileset.

Definition at line 7016 of file tilespec.c.

◆ tileset_hex_height()

int tileset_hex_height ( const struct tileset t)

Return the hex_height of the current tileset. For hex tilesets this value will be > 0 and is_isometric will be set.

Definition at line 693 of file tilespec.c.

Referenced by battle_animation(), client_start_server(), units_select::create_pixmap(), gui_to_map_pos(), move_unit_map_canvas(), movement_animation(), qtg_crop_sprite(), tileset_map_topo_compatible(), tileset_read_toplevel(), unit_item::unit_item(), and unit_info::update_units().

◆ tileset_hex_width()

int tileset_hex_width ( const struct tileset t)

Return the hex_width of the current tileset. For iso-hex tilesets this value will be > 0 and is_isometric will be set.

Definition at line 684 of file tilespec.c.

Referenced by client_start_server(), units_select::create_pixmap(), gui_to_map_pos(), qtg_crop_sprite(), mr_menu::save_image(), tileset_map_topo_compatible(), unit_item::unit_item(), and unit_info::update_units().

◆ tileset_init()

void tileset_init ( struct tileset t)

Initialize tileset structure

Definition at line 6823 of file tilespec.c.

Referenced by activate_gui(), qtg_ui_main(), ui_main(), and ui_main().

◆ tileset_is_fully_loaded()

bool tileset_is_fully_loaded ( void  )

Is tileset in sane state?

Definition at line 7203 of file tilespec.c.

Referenced by science_diagram_update(), science_diagram_update(), and update_unqueue().

◆ tileset_is_isometric()

bool tileset_is_isometric ( const struct tileset t)

◆ tileset_layer_in_category()

bool tileset_layer_in_category ( enum mapview_layer  layer,
enum layer_category  cat 
)

Gets the nth layer of the tileset.

Definition at line 7025 of file tilespec.c.

Referenced by create_pixbuf_from_layers().

◆ tileset_load_tiles()

void tileset_load_tiles ( struct tileset t)

Load the tiles; requires tilespec_read_toplevel() called previously. Leads to tile_sprites being allocated and filled with pointers to sprites. Also sets up and populates sprite_hash, and calls func to initialize 'sprites' structure.

Definition at line 3448 of file tilespec.c.

Referenced by activate_gui(), qtg_ui_main(), tilespec_reread(), ui_main(), and ui_main().

◆ tileset_lookup_sprite_tags()

static void tileset_lookup_sprite_tags ( struct tileset t)
static

Initialize 'sprites' structure based on hardwired tags which freeciv always requires.

Definition at line 2983 of file tilespec.c.

Referenced by tileset_load_tiles().

◆ tileset_main_intro_filename()

const char * tileset_main_intro_filename ( const struct tileset t)

Return the path within the data directories where the main intro graphics file can be found. (It is left up to the GUI code to load and unload this file.)

Definition at line 910 of file tilespec.c.

Referenced by fc_client::create_main_page(), and create_main_page().

◆ tileset_name_get()

const char * tileset_name_get ( struct tileset t)

◆ tileset_new()

static struct tileset * tileset_new ( void  )
static

Initialize.

Definition at line 934 of file tilespec.c.

Referenced by tileset_read_toplevel().

◆ tileset_num_city_colors()

int tileset_num_city_colors ( const struct tileset t)

Return the number of possible colors for city overlays.

Definition at line 918 of file tilespec.c.

Referenced by fill_sprite_array().

◆ tileset_player_free()

static void tileset_player_free ( struct tileset t,
int  plrid 
)
static

Free tiles for one player using the player color.

Definition at line 7119 of file tilespec.c.

Referenced by tileset_free(), and tileset_player_init().

◆ tileset_player_init()

void tileset_player_init ( struct tileset t,
struct player pplayer 
)

Setup tiles for one player using the player color.

Definition at line 7068 of file tilespec.c.

Referenced by handle_player_info(), and tilespec_reread().

◆ tileset_read_toplevel()

static struct tileset * tileset_read_toplevel ( const char *  tileset_name,
bool  verbose,
int  topology_id,
float  scale 
)
static

Finds and reads the toplevel tilespec file based on given name. Sets global variables, including tile sizes and full names for intro files. topology_id of -1 means any topology is acceptable.

Definition at line 1785 of file tilespec.c.

Referenced by get_tileset_list(), tilespec_reread(), and tilespec_try_read().

◆ tileset_ruleset_reset()

void tileset_ruleset_reset ( struct tileset t)

Reset tileset data specific to ruleset.

Definition at line 7183 of file tilespec.c.

Referenced by handle_ruleset_control().

◆ tileset_scale()

float tileset_scale ( const struct tileset t)

Returns tileset scale

Definition at line 890 of file tilespec.c.

◆ tileset_setup_base()

static void tileset_setup_base ( struct tileset t,
const struct extra_type pextra,
const char *  tag 
)
static

Set base sprite values; should only happen after tilespec_load_tiles().

Definition at line 3875 of file tilespec.c.

Referenced by tileset_setup_extra().

◆ tileset_setup_citizen_types()

static void tileset_setup_citizen_types ( struct tileset t)
static

Setup the graphics for (non-specialist) citizen types.

Definition at line 2828 of file tilespec.c.

Referenced by tileset_lookup_sprite_tags().

◆ tileset_setup_city_tiles()

void tileset_setup_city_tiles ( struct tileset t,
int  style 
)

Set city tiles sprite values; should only happen after tilespec_load_tiles().

Definition at line 6208 of file tilespec.c.

Referenced by handle_ruleset_city(), and tilespec_reread().

◆ tileset_setup_extra()

void tileset_setup_extra ( struct tileset t,
struct extra_type pextra 
)

Set extra sprite values; should only happen after tilespec_load_tiles().

Definition at line 3640 of file tilespec.c.

Referenced by handle_ruleset_extra(), and tilespec_reread().

◆ tileset_setup_government()

void tileset_setup_government ( struct tileset t,
struct government gov 
)

Set government sprite value; should only happen after tilespec_load_tiles().

Definition at line 4178 of file tilespec.c.

Referenced by handle_ruleset_government(), and tilespec_reread().

◆ tileset_setup_impr_type()

void tileset_setup_impr_type ( struct tileset t,
struct impr_type pimprove 
)

Set improvement_type sprite value; should only happen after tilespec_load_tiles().

Definition at line 3606 of file tilespec.c.

Referenced by handle_ruleset_building(), and tilespec_reread().

◆ tileset_setup_nation_flag()

void tileset_setup_nation_flag ( struct tileset t,
struct nation_type nation 
)

Set nation flag sprite value; should only happen after tilespec_load_tiles().

Definition at line 4193 of file tilespec.c.

Referenced by handle_ruleset_nation(), and tilespec_reread().

◆ tileset_setup_road()

static void tileset_setup_road ( struct tileset t,
struct extra_type pextra,
const char *  tag 
)
static

Set road sprite values; should only happen after tilespec_load_tiles().

Definition at line 3767 of file tilespec.c.

Referenced by tileset_setup_extra().

◆ tileset_setup_specialist_type()

void tileset_setup_specialist_type ( struct tileset t,
Specialist_type_id  id 
)

Setup the graphics for specialist types.

Definition at line 2760 of file tilespec.c.

Referenced by handle_ruleset_specialist(), and tilespec_reread().

◆ tileset_setup_tech_type()

void tileset_setup_tech_type ( struct tileset t,
struct advance padvance 
)

Set tech_type sprite value; should only happen after tilespec_load_tiles().

Definition at line 3621 of file tilespec.c.

Referenced by handle_ruleset_tech(), and tilespec_reread().

◆ tileset_setup_tile_type()

void tileset_setup_tile_type ( struct tileset t,
const struct terrain pterrain 
)

Set tile_type sprite values; should only happen after tilespec_load_tiles().

Definition at line 3913 of file tilespec.c.

Referenced by handle_ruleset_terrain(), and tilespec_reread().

◆ tileset_setup_unit_direction()

static bool tileset_setup_unit_direction ( struct tileset t,
int  uidx,
const char *  base_str,
enum direction8  dir,
bool  has_icon 
)
static

Helper function to load sprite for one unit orientation. Returns FALSE if a needed sprite was not found.

Definition at line 3494 of file tilespec.c.

◆ tileset_setup_unit_type()

void tileset_setup_unit_type ( struct tileset t,
struct unit_type ut 
)

Set unit_type sprite value; should only happen after tilespec_load_tiles().

Definition at line 3576 of file tilespec.c.

Referenced by handle_ruleset_unit(), and tilespec_reread().

◆ tileset_setup_unit_type_from_tag()

static bool tileset_setup_unit_type_from_tag ( struct tileset t,
int  uidx,
const char *  tag 
)
static

Try to setup all unit type sprites from single tag

Definition at line 3540 of file tilespec.c.

Referenced by tileset_setup_unit_type().

◆ tileset_small_sprite_height()

int tileset_small_sprite_height ( const struct tileset t)

Return the small sprite height of the current tileset. The small sprites are used for various theme graphics (e.g., citymap citizens/specialists as well as panel indicator icons).

Definition at line 900 of file tilespec.c.

Referenced by city_dialog_update_citizens(), create_city_dialog(), extviewer_new(), and city_dialog::update_citizens().

◆ tileset_small_sprite_width()

int tileset_small_sprite_width ( const struct tileset t)

Return the small sprite width of the current tileset. The small sprites are used for various theme graphics (e.g., citymap citizens/specialists as well as panel indicator icons).

Definition at line 864 of file tilespec.c.

Referenced by citizens_callback(), citizens_callback(), city_dialog_update_citizens(), create_city_dialog(), extviewer_new(), city_label::mousePressEvent(), refresh_feeling_surface(), refresh_feeling_surface(), and city_dialog::update_citizens().

◆ tileset_summary()

const char * tileset_summary ( struct tileset t)

Return tileset description summary

Definition at line 7227 of file tilespec.c.

Referenced by boot_help_texts().

◆ tileset_tile_height()

int tileset_tile_height ( const struct tileset t)

Return the tile height of the current tileset. This is the tesselation height of the tiled plane. This means it's the height of the bounding box of the basic map tile.

See also tileset_tile_width.

Definition at line 728 of file tilespec.c.

Referenced by anchor_selection_rectangle(), battle_animation(), info_tile::calc_size(), can_do_cached_drawing(), canvas_to_city_pos(), center_tile_mapcanvas(), city_to_canvas_pos(), create_extra_pixbuf(), create_pixbuf_from_layers(), create_terrain_pixbuf(), create_tool_value_selector(), decrease_unit_hp_smooth(), define_tiles_within_rectangle(), draw_calculated_trade_routes(), draw_segment(), draw_trade_route_line(), editor_end_selection_rectangle(), explosion_animation(), generate_citydlg_dimensions(), get_mapview_scroll_step(), get_mapview_scroll_window(), gui_to_map_pos(), gui_to_natural_pos(), gui_to_overview(), link_mark_draw(), map_canvas_resized(), map_to_gui_vector(), move_unit_map_canvas(), movement_animation(), nuke_animation(), objprop_setup_widget(), popit(), popup_terrain_info_dialog(), popupinfo_positioning_callback(), put_city(), put_nuke_mushroom_pixmaps(), put_terrain(), put_unit(), put_unittype(), put_window_near_map_tile(), mr_menu::save_image(), select_tgt_extra(), set_help_tile_from_extra(), set_help_tile_from_terrain(), help_widget::set_topic_extra(), terrain_canvas(), tile_to_canvas_pos(), tile_visible_and_not_on_border_mapcanvas(), tileset_read_toplevel(), unqueue_mapview_updates(), hud_units::update_actions(), update_map_canvas(), and update_selection_rectangle().

◆ tileset_tile_width()

int tileset_tile_width ( const struct tileset t)

Return the tile width of the current tileset. This is the tesselation width of the tiled plane. This means it's the width of the bounding box of the basic map tile.

For best results:

  • The value should be even (or a multiple of 4 in iso-view).
  • In iso-view, the width should be twice the height (to give a perspective of 30 degrees above the horizon).
  • In non-iso-view, width and height should be equal (overhead perspective).
  • In hex or iso-hex view, remember this is the tesselation vector. hex_width and hex_height then give the size of the side of the hexagon. Calculating the dimensions of a "regular" hexagon or iso-hexagon may be tricky. However these requirements are not absolute and callers should not depend on them (although some do).

Definition at line 716 of file tilespec.c.

Referenced by anchor_selection_rectangle(), battle_animation(), can_do_cached_drawing(), canvas_to_city_pos(), center_tile_mapcanvas(), city_to_canvas_pos(), create_extra_pixbuf(), create_terrain_pixbuf(), decrease_unit_hp_smooth(), define_tiles_within_rectangle(), draw_calculated_trade_routes(), draw_segment(), draw_trade_route_line(), editor_end_selection_rectangle(), explosion_animation(), generate_citydlg_dimensions(), get_mapview_scroll_step(), get_mapview_scroll_window(), gui_to_map_pos(), gui_to_natural_pos(), gui_to_overview(), link_mark_draw(), map_canvas_resized(), map_to_gui_vector(), nuke_animation(), objprop_setup_widget(), populate_unit_image_table(), populate_unit_pic_table(), popup_hurry_production_dialog(), popupinfo_positioning_callback(), put_nuke_mushroom_pixmaps(), put_window_near_map_tile(), mr_menu::save_image(), select_tgt_extra(), set_help_tile_from_extra(), set_help_tile_from_terrain(), set_unit_icon(), show_city_descriptions(), show_full_citybar(), show_small_citybar(), show_tile_label(), show_tile_labels(), tile_to_canvas_pos(), tile_visible_and_not_on_border_mapcanvas(), unqueue_mapview_updates(), and update_selection_rectangle().

◆ tileset_tilelabel_offset_y()

int tileset_tilelabel_offset_y ( const struct tileset t)

Return the offset from the origin of the tile at which to place the label text.

Definition at line 882 of file tilespec.c.

Referenced by show_tile_label().

◆ tileset_topo_index()

int tileset_topo_index ( struct tileset t)

Return tileset topology index

Definition at line 7251 of file tilespec.c.

Referenced by tilespec_try_read().

◆ tileset_unit_height()

int tileset_unit_height ( const struct tileset t)

◆ tileset_unit_layout_offset_y()

int tileset_unit_layout_offset_y ( const struct tileset t)

Offset to layout extra unit sprites, such as upkeep.

Definition at line 845 of file tilespec.c.

Referenced by put_unit_image_city_overlays(), put_unit_picture_city_overlays(), tileset_unit_with_upkeep_height(), and unit_item::unit_item().

◆ tileset_unit_layout_small_offset_y()

int tileset_unit_layout_small_offset_y ( const struct tileset t)

Offset to layout extra unit sprites, such as upkeep, requesting small space layout.

Definition at line 854 of file tilespec.c.

Referenced by create_unit_surface(), and tileset_unit_with_small_upkeep_height().

◆ tileset_unit_width()

int tileset_unit_width ( const struct tileset t)

◆ tileset_unit_with_small_upkeep_height()

int tileset_unit_with_small_upkeep_height ( const struct tileset t)

Suitable canvas height for a unit icon that includes upkeep sprites, using small space layout.

Definition at line 834 of file tilespec.c.

Referenced by create_unit_surface().

◆ tileset_unit_with_upkeep_height()

int tileset_unit_with_upkeep_height ( const struct tileset t)

Suitable canvas height for a unit icon that includes upkeep sprites.

Definition at line 822 of file tilespec.c.

Referenced by city_dialog::city_dialog(), city_dialog_update_supported_units(), create_and_append_overview_page(), and unit_item::unit_item().

◆ tileset_upkeep_height()

static int tileset_upkeep_height ( const struct tileset t)
static

Get the height of a unit upkeep icons.

Definition at line 813 of file tilespec.c.

Referenced by tileset_unit_with_small_upkeep_height(), and tileset_unit_with_upkeep_height().

◆ tileset_use_hard_coded_fog()

bool tileset_use_hard_coded_fog ( const struct tileset t)

Return TRUE if the client will use the code to generate the fog.

Definition at line 926 of file tilespec.c.

◆ tileset_use_preferred_theme()

void tileset_use_preferred_theme ( const struct tileset t)

Loads preferred theme if there's any.

Definition at line 6764 of file tilespec.c.

Referenced by activate_gui(), tilespec_reread(), ui_main(), and ui_main().

◆ tileset_version()

const char * tileset_version ( struct tileset t)

Return tileset version

Definition at line 7219 of file tilespec.c.

Referenced by boot_help_texts().

◆ tileset_what_ruleset()

char * tileset_what_ruleset ( struct tileset t)

Return what ruleset this tileset is primarily meant for

Definition at line 7243 of file tilespec.c.

Referenced by client_start_server().

◆ tilespec_fullname()

static char * tilespec_fullname ( const char *  tileset_name)
static

Gets full filename for tilespec file, based on input name. Returned data is allocated, and freed by user as required. Input name may be null, in which case uses default. Falls back to default if can't find specified name; dies if can't find default.

Definition at line 1084 of file tilespec.c.

Referenced by tileset_read_toplevel().

◆ tilespec_gfx_filename()

static char * tilespec_gfx_filename ( const char *  gfx_filename,
const char *  tset_name 
)
static

Returns the correct name of the gfx file (with path and extension) Must be free'd when no longer used

Definition at line 1733 of file tilespec.c.

Referenced by tileset_read_toplevel().

◆ tilespec_reread()

bool tilespec_reread ( const char *  new_tileset_name,
bool  game_fully_initialized,
float  scale 
)

Read a new tilespec in from scratch.

Unlike the initial reading code, which reads pieces one at a time, this gets rid of the old data and reads in the new all at once. If the new tileset fails to load the old tileset may be reloaded; otherwise the client will exit. If a NULL name is given the current tileset will be reread.

It will also call the necessary functions to redraw the graphics.

Returns TRUE iff new tileset has been successfully loaded.

Definition at line 1299 of file tilespec.c.

Referenced by handle_ruleset_control(), mr_menu::load_new_tileset(), popup_tileset_suggestion_dialog(), reload_tileset_callback(), map_view::shortcut_pressed(), tileset_suggestion_callback(), tileset_suggestion_response(), tilespec_reread_callback(), tilespec_reread_frozen_refresh(), mr_menu::zoom_in(), mr_menu::zoom_out(), and mr_menu::zoom_reset().

◆ tilespec_reread_callback()

void tilespec_reread_callback ( struct option poption)

This is merely a wrapper for tilespec_reread (above) for use in options.c and the client local options dialog.

Definition at line 1449 of file tilespec.c.

◆ tilespec_reread_frozen_refresh()

void tilespec_reread_frozen_refresh ( const char *  tname)

Read a new tilespec in from scratch. Keep UI frozen while tileset is partially loaded; in inconsistent state.

See tilespec_reread() for details.

Definition at line 1484 of file tilespec.c.

Referenced by handle_set_topology().

◆ tilespec_try_read()

bool tilespec_try_read ( const char *  tileset_name,
bool  verbose,
int  topo_id,
bool  global_default 
)

Read a new tilespec in when first starting the game.

Call this function with the (guessed) name of the tileset, when starting the client.

Returns TRUE iff tileset with suggested tileset_name was loaded.

Definition at line 1240 of file tilespec.c.

Referenced by default_tileset_select().

◆ toggle_focus_unit_state()

void toggle_focus_unit_state ( struct tileset t)

Toggle/increment the focus unit state. This should be called once every get_focus_unit_toggle_timeout() seconds.

Definition at line 6289 of file tilespec.c.

Referenced by blink_active_unit().

◆ ts_topology_index()

static int ts_topology_index ( int  actual_topology)
static

Convert properties of the actual topology to an index of different tileset topology types.

Definition at line 1025 of file tilespec.c.

Referenced by get_tileset_list(), and tileset_read_toplevel().

◆ unit_drawn_with_city_outline()

bool unit_drawn_with_city_outline ( const struct unit punit,
bool  check_focus 
)

Indicate whether a unit is to be drawn with a surrounding city outline under current conditions. (This includes being in focus, but if the caller has already checked that, they can bypass this slightly expensive check with check_focus FALSE.)

Definition at line 5266 of file tilespec.c.

Referenced by fill_grid_sprite_array(), handle_unit_packet_common(), and refresh_unit_mapcanvas().

◆ unload_all_sprites()

static void unload_all_sprites ( struct tileset t)
static

This patch unloads all sprites from the sprite hash (the hash itself is left intact).

Definition at line 6328 of file tilespec.c.

Referenced by tileset_free_tiles().

◆ unload_sprite()

static void unload_sprite ( struct tileset t,
const char *  tag_name 
)
static

Unloads the sprite. Decrease the reference counter. If the last reference is removed the sprite is freed.

Definition at line 2674 of file tilespec.c.

Referenced by unload_all_sprites().

◆ valid_index_str()

static char * valid_index_str ( const struct tileset t,
int  idx 
)
static

Do the same thing as cardinal_str, except including all valid directions. The returned string is a pointer to static memory.

Definition at line 2565 of file tilespec.c.

Referenced by tileset_setup_road().

Variable Documentation

◆ DIR4_TO_DIR8

const int DIR4_TO_DIR8[4]
static
Initial value:
=
{ DIR8_NORTH, DIR8_SOUTH, DIR8_EAST, DIR8_WEST }

Definition at line 144 of file tilespec.c.

Referenced by fill_terrain_sprite_array(), fill_terrain_sprite_blending(), and fill_terrain_sprite_darkness().

◆ direction4letters

const char direction4letters[4] = "udrl"
static

Definition at line 140 of file tilespec.c.

Referenced by tileset_setup_tile_type().

◆ edge_name

const char edge_name[EDGE_COUNT][3] = {"ns", "we", "ud", "lr"}
static

Definition at line 142 of file tilespec.c.

Referenced by tileset_lookup_sprite_tags().

◆ focus_unit_state

int focus_unit_state = 0

◆ tileset

struct tileset* tileset = NULL

Definition at line 544 of file tilespec.c.

◆ tileset_update

bool tileset_update = FALSE
static

◆ unscaled_tileset

struct tileset* unscaled_tileset = NULL