36 #define SPECENUM_NAME ts_type
37 #define SPECENUM_VALUE0 TS_OVERHEAD
38 #define SPECENUM_VALUE0NAME N_("Overhead")
39 #define SPECENUM_VALUE1 TS_ISOMETRIC
40 #define SPECENUM_VALUE1NAME N_("Isometric")
41 #include "specenum_gen.h"
43 #define NUM_TILES_PROGRESS 8
44 #define NUM_CORNER_DIRS 4
46 #define MAX_NUM_CITIZEN_SPRITES 6
53 constexpr direction8
DIR4_TO_DIR8[4] = {DIR8_NORTH, DIR8_SOUTH, DIR8_EAST,
95 std::map<QString, tileset_option>
105 bool game_fully_initialized);
113 const QStringList &patterns);
120 const struct terrain *pterrain);
123 const QString &suffix,
124 const struct terrain *pterrain);
134 const std::vector<std::unique_ptr<freeciv::layer>> &
139 bool required,
bool verbose =
true);
141 std::vector<drawn_sprite>
169 #define NUM_CURSOR_FRAMES 6
205 const struct city *pcity);
207 const struct city *pcity);
209 struct terrain **tterrain_near,
210 bv_extras *textras_near);
212 const struct unit *punit);
214 enum unit_activity activity,
227 enum direction8 facing,
228 const QColor &replace = QColor());
233 const std::vector<QPixmap *> &
238 int *hot_y,
int frame);
246 const struct unit *punit,
250 const struct unit *punit,
251 const int *upkeep_cost);
252 std::vector<drawn_sprite>
258 enum event_type
event);
263 const char *tag,
const char *alt,
264 const char *what,
const char *
name,
305 #define TS_TOPO_SQUARE 0
306 #define TS_TOPO_HEX 1
307 #define TS_TOPO_ISOHEX 2
enum output_type_id Output_type_id
struct setting_list * level[OLEVELS_NUM]
std::vector< QPixmap * > occupancy
QPixmap * terrain_resource
QPixmap * terrain_special
The base class for options.
Tileset options allow altering the behavior of a tileset.
QString description
One-line description for use in the UI (translated)
bool enabled_by_default
< Current status
void tileset_load_tiles(struct tileset *t)
Load the tiles; requires tilespec_read_toplevel() called previously.
const QPixmap * get_nuke_explode_sprite(const struct tileset *t)
Return a sprite contining the single nuke graphic.
int tileset_hex_width(const struct tileset *t)
Return the hex_width of the current tileset.
const QPixmap * get_activity_sprite(const struct tileset *t, enum unit_activity activity, extra_type *target)
void tilespec_init()
Initializes the tilespec system.
const char * tileset_name_get(const struct tileset *t)
Return tileset name.
int tileset_unit_width(const struct tileset *t)
Return the unit tile width of the current tileset.
std::vector< drawn_sprite > fill_basic_terrain_layer_sprite_array(struct tileset *t, int layer, struct terrain *pterrain)
Fill the sprite array with sprites that together make a representative image of the given terrain typ...
int tileset_unit_height(const struct tileset *t)
Return the unit tile height of the current tileset.
const QPixmap * 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.
int tileset_num_cardinal_dirs(const struct tileset *t)
Returns the number of cardinal directions used by the tileset.
int tileset_small_sprite_width(const struct tileset *t)
Return the small sprite width of the current tileset.
const freeciv::layer_city * tileset_layer_city(const struct tileset *t)
Returns the layer_city of the tileset.
const char * tileset_basename(const struct tileset *t)
Return the name of the given tileset.
const char * tileset_summary(const struct tileset *t)
Return tileset description summary.
const std::vector< std::unique_ptr< freeciv::layer > > & tileset_get_layers(const struct tileset *t)
void tileset_setup_government(struct tileset *t, struct government *gov)
Set government sprite value; should only happen after tilespec_load_tiles().
std::array< direction8, 8 > tileset_cardinal_dirs(const struct tileset *t)
Returns the cardinal directions used by the tileset.
const QPixmap * 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 suppor...
QPixmap * load_sprite(struct tileset *t, const QStringList &possible_names, bool required, bool verbose=true)
Finds the first sprite matching a list of possible names and returns it.
int tileset_full_tile_height(const struct tileset *t)
Return the full tile height of the current tileset.
const QPixmap * get_attention_crosshair_sprite(const struct tileset *t)
Returns a sprite with the "user-attention" crosshair graphic.
void tileset_setup_specialist_type(struct tileset *t, Specialist_type_id id)
Setup the graphics for specialist types.
bool tilespec_reread(const QString &tileset_name, bool game_fully_initialized)
Read a new tilespec in from scratch.
void tileset_setup_tile_type(struct tileset *t, const struct terrain *pterrain)
Set tile_type sprite values; should only happen after tilespec_load_tiles().
int get_focus_unit_toggle_timeout(const struct tileset *t)
Return the amount of time between calls to toggle_focus_unit_state.
void tileset_player_init(struct tileset *t, struct player *pplayer)
Setup tiles for one player using the player color.
int tileset_unit_layout_offset_y(const struct tileset *t)
Offset to layout extra unit sprites, such as upkeep.
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.
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.
const QPixmap * get_nation_shield_sprite(const struct tileset *t, const struct nation_type *nation)
Return the shield sprite for the nation.
bool tileset_has_option(const struct tileset *t, const QString &name)
Checks if the tileset has supports the given user-settable option.
void tileset_free_tiles(struct tileset *t)
Free all sprites from tileset.
void tileset_setup_impr_type(struct tileset *t, struct impr_type *pimprove)
Set improvement_type sprite value; should only happen after tilespec_load_tiles().
const QPixmap * get_city_flag_sprite(const struct tileset *t, const struct city *pcity)
Return the flag graphic to be used by the city.
int tileset_topo_index(const struct tileset *t)
Return tileset topology index.
const QPixmap * get_event_sprite(const struct tileset *t, enum event_type event)
Return event icon sprite.
QString valid_index_str(const struct tileset *t, int idx)
Do the same thing as cardinal_str, except including all valid directions.
void tileset_setup_tech_type(struct tileset *t, struct advance *padvance)
Set tech_type sprite value; should only happen after tilespec_load_tiles().
bool tilespec_try_read(const QString &name, bool verbose, int topo_id)
Read a new tilespec in when first starting the game.
const std::vector< QPixmap * > & get_unit_explode_animation(const struct tileset *t)
Return a sprite_vector containing the animation sprites for a unit explosion.
const QPixmap * get_indicator_sprite(const struct tileset *t, enum indicator_type indicator, int index)
Returns a sprite for the given indicator with the given index.
void tileset_free(struct tileset *tileset)
Clean up.
const QPixmap * get_tech_sprite(const struct tileset *t, Tech_type_id tech)
Return the sprite for the technology/advance.
const struct citybar_sprites * get_citybar_sprites(const struct tileset *t)
Return all the sprites used for city bar drawing.
std::vector< drawn_sprite > fill_basic_extra_sprite_array(const struct tileset *t, const struct extra_type *pextra)
Return a representative sprite for the given extra type.
const QPixmap * get_nation_flag_sprite(const struct tileset *t, const struct nation_type *nation)
Return the sprite for the nation.
struct color_system * get_color_system(const struct tileset *t)
Return the tileset's color system.
bool tileset_option_is_enabled(const struct tileset *t, const QString &name)
Checks if an user-settable tileset option is enabled.
bool tileset_is_isometric(const struct tileset *t)
Return whether the current tileset is isometric.
bool tileset_use_hard_coded_fog(const struct tileset *t)
Return TRUE if the client will use the code to generate the fog.
QPoint tileset_full_tile_offset(const struct tileset *t)
Return the x and y offsets of full tiles in the tileset.
void tileset_setup_city_tiles(struct tileset *t, int style)
Set city tiles sprite values; should only happen after tilespec_load_tiles().
void build_tile_data(const struct tile *ptile, struct terrain *pterrain, struct terrain **tterrain_near, bv_extras *textras_near)
Assemble some data that is used in building the tile sprite arrays.
const char * tileset_version(const struct tileset *t)
Return tileset version.
std::map< QString, tileset_option > tileset_get_options(const struct tileset *t)
Gets the user-settable options of the tileset.
void toggle_focus_unit_state(struct tileset *t)
Toggle/increment the focus unit state.
int tileset_small_sprite_height(const struct tileset *t)
Return the small sprite height of the current tileset.
void focus_unit_in_combat(struct tileset *t)
Setup tileset for showing combat where focus unit participates.
const QPixmap * get_mask_sprite(const struct tileset *t)
Return tile mask sprite.
const QPixmap * get_dither_sprite(const struct tileset *t)
Return dither sprite.
bool is_cardinal_tileset_dir(const struct tileset *t, enum direction8 dir)
Return TRUE iff the dir is cardinal in this tileset.
QEvent::Type TilesetChanged
An event type sent to all widgets when the current tileset changes.
void tileset_setup_extra(struct tileset *t, struct extra_type *pextra)
Set extra sprite values; should only happen after tilespec_load_tiles().
bool tileset_is_fully_loaded()
Is tileset in sane state?
const QPixmap * get_treaty_thumb_sprite(const struct tileset *t, bool on_off)
Return a thumbs-up/thumbs-down sprite to show treaty approval or disapproval.
void tileset_init(struct tileset *t)
Initialize tileset structure.
int tileset_tile_height(const struct tileset *t)
Return the tile height of the current tileset.
const QPixmap * get_unittype_sprite(const struct tileset *t, const struct unit_type *punittype, enum direction8 facing, const QColor &replace=QColor())
Return the sprite for the unit type (the base "unit" sprite).
bool tileset_set_option(struct tileset *t, const QString &name, bool enabled)
Enable or disable a user-settable tileset option.
struct tileset * get_tileset()
Returns the tileset.
void assign_digit_sprites(struct tileset *t, QPixmap *units[NUM_TILES_DIGITS], QPixmap *tens[NUM_TILES_DIGITS], QPixmap *hundreds[NUM_TILES_DIGITS], const QStringList &patterns)
Assigns the digits for city or go-to orders, for units, tens, and hundreds (i.e.
int tileset_unit_with_upkeep_height(const struct tileset *t)
Suitable canvas height for a unit icon that includes upkeep sprites.
int tileset_replaced_hue(const struct tileset *t)
Returns the hue (color) that should be replaced with the player color in player-dependent sprites.
const QPixmap * get_government_sprite(const struct tileset *t, const struct government *gov)
Return the sprite for the government.
int tileset_hex_height(const struct tileset *t)
Return the hex_height of the current tileset.
void reset_focus_unit_state(struct tileset *t)
Reset the focus unit state.
void tileset_setup_unit_type(struct tileset *t, struct unit_type *punittype)
Set unit_type sprite value; should only happen after tilespec_load_tiles().
const QVector< QString > * get_tileset_list(const struct option *poption)
Returns a static list of tilesets available on the system by searching all data directories for files...
QPixmap * tiles_lookup_sprite_tag_alt(struct tileset *t, QtMsgType 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 nullptr,...
const QPixmap * get_sample_city_sprite(const struct tileset *t, int style_idx)
bool tileset_has_options(const struct tileset *t)
Checks if the tileset has any user-settable options.
void finish_loading_sprites(struct tileset *t)
Frees any internal buffers which are created by load_sprite.
const QPixmap * 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 s...
int tileset_num_valid_dirs(const struct tileset *t)
Returns the number of valid directions in the tileset.
void tileset_error(struct tileset *t, QtMsgType level, const char *format,...)
Called when ever there's problem in ruleset/tileset compatibility.
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 option...
const char * tileset_description(const struct tileset *t)
Return tileset description body.
int tileset_full_tile_width(const struct tileset *t)
Return the full tile width of the current tileset.
QString cardinal_index_str(const struct tileset *t, int idx)
Return a directional string for the cardinal directions.
help_item * tileset_help(const struct tileset *t)
Creates the help item for the given tileset.
int tileset_num_index_cardinals(const struct tileset *t)
Returns the number of cardinal indices used by the tileset.
const QPixmap * get_spaceship_sprite(const struct tileset *t, enum spaceship_part part)
Return the sprite for drawing the given spaceship part.
const QPixmap * get_tax_sprite(const struct tileset *t, Output_type_id otype)
Return a tax sprite for the given output type (usually gold/lux/sci).
const QPixmap * 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.
QPixmap * get_unit_nation_flag_sprite(const struct tileset *t, const struct unit *punit)
Return a sprite for the national flag for this unit.
bool is_extra_drawing_enabled(const extra_type *pextra)
Should the given extra be drawn FIXME: Some extras can not be switched.
void tilespec_reread_frozen_refresh(const QString &name)
Read a new tilespec in from scratch.
std::array< direction8, 8 > tileset_valid_dirs(const struct tileset *t)
Returns the valid directions for the tileset.
double tileset_preferred_scale(const struct tileset *t)
Returns the preferred scale (zoom level) of the tileset.
struct unit * get_drawable_unit(const struct tileset *t, const ::tile *ptile)
Find unit that we can display from given tile.
QStringList make_tag_terrain_list(const QString &prefix, const QString &suffix, const struct terrain *pterrain)
Make the list of possible tag names for the extras which may vary depending on the terrain they're on...
const QPixmap * get_building_sprite(const struct tileset *t, const struct impr_type *pimprove)
Return the sprite for the building/improvement.
QString dir_get_tileset_name(enum direction8 dir)
Return the tileset name of the direction.
bool tileset_has_error(const struct tileset *t)
Checks if the tileset had any error message (LOG_ERROR).
int tileset_tile_width(const struct tileset *t)
Return the tile width of the current tileset.
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.
const struct editor_sprites * get_editor_sprites(const struct tileset *t)
Return all the sprites used for editor icons, images, etc.
constexpr direction8 DIR4_TO_DIR8[4]
std::vector< tileset_log_entry > tileset_log(const struct tileset *t)
Get tileset log (warnings, errors, etc.)
void tileset_setup_nation_flag(struct tileset *t, struct nation_type *nation)
Set nation flag sprite value; should only happen after tilespec_load_tiles().
void tileset_ruleset_reset(struct tileset *t)
Reset tileset data specific to ruleset.