![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <QApplication>#include <QHash>#include <QImageReader>#include <QPixmap>#include <QSet>#include <QString>#include <QVector>#include <cstdarg>#include <cstdlib>#include <cstring>#include "astring.h"#include "bitvector.h"#include "capability.h"#include "city.h"#include "fcintl.h"#include "log.h"#include "registry.h"#include "registry_ini.h"#include "shared.h"#include "support.h"#include "game.h"#include "government.h"#include "helpdata.h"#include "nation.h"#include "specialist.h"#include "mapview_g.h"#include "menu_g.h"#include "sprite_g.h"#include "citybar.h"#include "citydlg_common.h"#include "client_main.h"#include "climap.h"#include "climisc.h"#include "colors_common.h"#include "control.h"#include "helpdlg.h"#include "layer_background.h"#include "layer_base_flags.h"#include "layer_city.h"#include "layer_city_size.h"#include "layer_darkness.h"#include "layer_editor.h"#include "layer_fog.h"#include "layer_goto.h"#include "layer_grid.h"#include "layer_infrawork.h"#include "layer_overlays.h"#include "layer_roads.h"#include "layer_special.h"#include "layer_terrain.h"#include "layer_units.h"#include "layer_water.h"#include "layer_workertask.h"#include "options.h"#include "page_game.h"#include "tilespec.h"#include "utils/colorizer.h"#include "views/view_map.h"Go to the source code of this file.
Classes | |
| struct | citizen_graphic |
| struct | named_sprites |
| struct | specfile |
| struct | small_sprite |
| Information about an individual sprite. More... | |
| struct | tileset |
Macros | |
| #define | TILESPEC_CAPSTR |
| #define | SPEC_CAPSTR "+Freeciv-spec-Devel-2019-Jul-03 options" |
| #define | TILESPEC_SUFFIX ".tilespec" |
| #define | TILE_SECTION_PREFIX "tile_" |
| #define | MAX_NUM_LAYERS 3 |
| #define | LOAD_FACING_SPRITE(dir) |
Functions | |
| Q_LOGGING_CATEGORY (tileset_category, "freeciv.tileset") | |
| Functions for handling the tilespec files which describe the files and contents of tilesets. More... | |
| static struct tileset * | tileset_read_toplevel (const QString &tileset_name, bool verbose, int topology_id) |
| Finds and reads the toplevel tilespec file based on given name. More... | |
| static bool | tileset_setup_options (struct tileset *t, const section_file *file) |
| Loads tileset options. More... | |
| static void | tileset_player_free (struct tileset *t, int plrid) |
| Free tiles for one player using the player color. More... | |
| void | tileset_error (struct tileset *t, QtMsgType level, const char *format,...) |
| Called when ever there's problem in ruleset/tileset compatibility. More... | |
| struct tileset * | get_tileset () |
| Returns the tileset. More... | |
| const char * | tileset_basename (const struct tileset *t) |
| Return the name of the given tileset. More... | |
| bool | tileset_is_isometric (const struct tileset *t) |
| Return whether the current tileset is isometric. More... | |
| int | tileset_hex_width (const struct tileset *t) |
| Return the hex_width of the current tileset. More... | |
| int | tileset_hex_height (const struct tileset *t) |
| Return the hex_height of the current tileset. More... | |
| int | tileset_tile_width (const struct tileset *t) |
| Return the tile width of the current tileset. More... | |
| int | tileset_tile_height (const struct tileset *t) |
| Return the tile height of the current tileset. More... | |
| int | tileset_full_tile_width (const struct tileset *t) |
| Return the full tile width of the current tileset. More... | |
| int | tileset_full_tile_height (const struct tileset *t) |
| Return the full tile height of the current tileset. More... | |
| QPoint | tileset_full_tile_offset (const struct tileset *t) |
| Return the x and y offsets of full tiles in the tileset. More... | |
| int | tileset_unit_width (const struct tileset *t) |
| Return the unit tile width of the current tileset. More... | |
| int | tileset_unit_height (const struct tileset *t) |
| Return the unit tile height of the current tileset. More... | |
| static int | calculate_max_upkeep_height (const struct tileset *t) |
| Calculate the height of a unit upkeep icons. More... | |
| static int | tileset_upkeep_height (const struct tileset *t) |
| Get the height of a unit upkeep icons. More... | |
| int | tileset_unit_with_upkeep_height (const struct tileset *t) |
| Suitable canvas height for a unit icon that includes upkeep sprites. More... | |
| int | tileset_unit_layout_offset_y (const struct tileset *t) |
| Offset to layout extra unit sprites, such as upkeep. More... | |
| int | tileset_small_sprite_width (const struct tileset *t) |
| Return the small sprite width of the current tileset. More... | |
| 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. More... | |
| 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. More... | |
| int | tileset_small_sprite_height (const struct tileset *t) |
| Return the small sprite height of the current tileset. More... | |
| bool | tileset_use_hard_coded_fog (const struct tileset *t) |
| Return TRUE if the client will use the code to generate the fog. More... | |
| double | tileset_preferred_scale (const struct tileset *t) |
| Returns the preferred scale (zoom level) of the tileset. More... | |
| int | tileset_replaced_hue (const struct tileset *t) |
| Returns the hue (color) that should be replaced with the player color in player-dependent sprites. More... | |
| int | tileset_num_cardinal_dirs (const struct tileset *t) |
| Returns the number of cardinal directions used by the tileset. More... | |
| int | tileset_num_index_cardinals (const struct tileset *t) |
| Returns the number of cardinal indices used by the tileset. More... | |
| std::array< direction8, 8 > | tileset_cardinal_dirs (const struct tileset *t) |
| Returns the cardinal directions used by the tileset. More... | |
| int | tileset_num_valid_dirs (const struct tileset *t) |
| Returns the number of valid directions in the tileset. More... | |
| std::array< direction8, 8 > | tileset_valid_dirs (const struct tileset *t) |
| Returns the valid directions for the tileset. More... | |
| static struct tileset * | tileset_new () |
| Initialize. More... | |
| QString | dir_get_tileset_name (enum direction8 dir) |
| Return the tileset name of the direction. More... | |
| static enum direction8 | dir_by_tileset_name (const QString &str) |
| Parse a direction name as a direction8. More... | |
| static bool | is_valid_tileset_dir (const struct tileset *t, enum direction8 dir) |
| Return TRUE iff the dir is valid in this tileset. More... | |
| bool | is_cardinal_tileset_dir (const struct tileset *t, enum direction8 dir) |
| Return TRUE iff the dir is cardinal in this tileset. More... | |
| static int | ts_topology_index (int actual_topology) |
| Convert properties of the actual topology to an index of different tileset topology types. More... | |
| void | tilespec_init () |
| Initializes the tilespec system. More... | |
| 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 matching TILESPEC_SUFFIX. More... | |
| static char * | tilespec_fullname (QString tileset_name) |
| Gets full filename for tilespec file, based on input name. More... | |
| static bool | check_tilespec_capabilities (struct section_file *file, const char *which, const char *us_capstr, const char *filename, bool verbose) |
| Checks options in filename match what we require and support. More... | |
| static void | tileset_free_toplevel (struct tileset *t) |
| Frees the tilespec toplevel data, in preparation for re-reading it. More... | |
| void | tileset_free (struct tileset *t) |
| Clean up. More... | |
| bool | tilespec_try_read (const QString &tileset_name, bool verbose, int topo_id) |
| Read a new tilespec in when first starting the game. More... | |
| bool | tilespec_reread (const QString &name, bool game_fully_initialized) |
| Read a new tilespec in from scratch. More... | |
| 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. More... | |
| void | tilespec_reread_frozen_refresh (const QString &name) |
| Read a new tilespec in from scratch. More... | |
| static QPixmap * | make_error_pixmap () |
| Makes a dummy "error" pixmap to prevent crashes. More... | |
| static QPixmap * | load_gfx_file (const char *gfx_filename) |
| Loads the given graphics file (found in the data path) into a newly allocated sprite. More... | |
| static void | ensure_big_sprite (struct tileset *t, struct specfile *sf) |
| Ensure that the big sprite of the given spec file is loaded. More... | |
| static void | scan_specfile (struct tileset *t, struct specfile *sf, bool duplicates_ok) |
| Scan all sprites declared in the given specfile. More... | |
| static freeciv::layer_terrain::sprite_type | check_sprite_type (const char *sprite_type, const char *tile_section) |
| Determine the sprite_type string. More... | |
| static bool | tileset_invalid_offsets (struct tileset *t, struct section_file *file) |
| static void | tileset_set_offsets (struct tileset *t, struct section_file *file) |
| static void | tileset_stop_read (struct tileset *t, struct section_file *file, char *fname, struct section_list *sections, const char **layer_order) |
| static void | tileset_add_layer (struct tileset *t, mapview_layer layer) |
Creates a layer object for the given enumerated type and appends it to the layers of t. More... | |
| static const char * | citizen_rule_name (enum citizen_category citizen) |
| Returns a text name for the citizen, as used in the tileset. More... | |
| QString | cardinal_index_str (const struct tileset *t, int idx) |
| Return a directional string for the cardinal directions. More... | |
| QString | valid_index_str (const struct tileset *t, int idx) |
| Do the same thing as cardinal_str, except including all valid directions. More... | |
| static QPixmap * | load_sprite (struct tileset *t, const QString &tag_name) |
| Loads the sprite. More... | |
| QPixmap * | load_sprite (struct tileset *t, const QStringList &possible_names, bool required, bool verbose) |
| Finds the first sprite matching a list of possible names and returns it. More... | |
| static void | unload_sprite (struct tileset *t, const QString &tag_name) |
| Unloads the sprite. More... | |
| static void | assign_sprite (struct tileset *t, QPixmap *&field, const QStringList &possible_names, bool required) |
| finds the first sprite matching a list of possible names and returns it to the field argument. More... | |
| static void | assign_digit_sprites_helper (struct tileset *t, QPixmap *sprites[NUM_TILES_DIGITS], const QStringList &patterns, const QString &suffix, bool required) |
| Goes through the possible digits and assigns them. More... | |
| 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. More... | |
| void | tileset_setup_specialist_type (struct tileset *t, Specialist_type_id id) |
| Setup the graphics for specialist types. More... | |
| static void | tileset_setup_citizen_types (struct tileset *t) |
| Setup the graphics for (non-specialist) citizen types. More... | |
| static void | tileset_lookup_sprite_tags (struct tileset *t) |
| Initialize 'sprites' structure based on hardwired tags which freeciv always requires. More... | |
| void | finish_loading_sprites (struct tileset *t) |
| Frees any internal buffers which are created by load_sprite. More... | |
| void | tileset_load_tiles (struct tileset *t) |
| Load the tiles; requires tilespec_read_toplevel() called previously. More... | |
| 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, and emit log message. More... | |
| static bool | tileset_setup_unit_direction (struct tileset *t, int uidx, const char *base_str, enum direction8 dir, bool has_icon) |
| Helper function to load sprite for one unit orientation. More... | |
| static bool | tileset_setup_unit_type_from_tag (struct tileset *t, int uidx, const char *tag) |
| Try to setup all unit type sprites from single tag. More... | |
| void | tileset_setup_unit_type (struct tileset *t, struct unit_type *ut) |
| Set unit_type sprite value; should only happen after tilespec_load_tiles(). More... | |
| void | tileset_setup_impr_type (struct tileset *t, struct impr_type *pimprove) |
| Set improvement_type sprite value; should only happen after tilespec_load_tiles(). More... | |
| void | tileset_setup_tech_type (struct tileset *t, struct advance *padvance) |
| Set tech_type sprite value; should only happen after tilespec_load_tiles(). More... | |
| 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. More... | |
| void | tileset_setup_extra (struct tileset *t, struct extra_type *pextra) |
| Set extra sprite values; should only happen after tilespec_load_tiles(). More... | |
| void | tileset_setup_tile_type (struct tileset *t, const struct terrain *pterrain) |
| Set tile_type sprite values; should only happen after tilespec_load_tiles(). More... | |
| void | tileset_setup_government (struct tileset *t, struct government *gov) |
| Set government sprite value; should only happen after tilespec_load_tiles(). More... | |
| void | tileset_setup_nation_flag (struct tileset *t, struct nation_type *nation) |
| Set nation flag sprite value; should only happen after tilespec_load_tiles(). More... | |
| const QPixmap * | get_city_flag_sprite (const struct tileset *t, const struct city *pcity) |
| Return the flag graphic to be used by the city. More... | |
| QPixmap * | get_unit_nation_flag_sprite (const struct tileset *t, const struct unit *punit) |
| Return a sprite for the national flag for this unit. More... | |
| 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. More... | |
| 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. More... | |
| bool | is_extra_drawing_enabled (const extra_type *pextra) |
| Should the given extra be drawn FIXME: Some extras can not be switched. More... | |
| void | tileset_setup_city_tiles (struct tileset *t, int style) |
| Set city tiles sprite values; should only happen after tilespec_load_tiles(). More... | |
| int | get_focus_unit_toggle_timeout (const struct tileset *t) |
| Return the amount of time between calls to toggle_focus_unit_state. More... | |
| void | reset_focus_unit_state (struct tileset *t) |
| Reset the focus unit state. More... | |
| void | focus_unit_in_combat (struct tileset *t) |
| Setup tileset for showing combat where focus unit participates. More... | |
| void | toggle_focus_unit_state (struct tileset *t) |
| Toggle/increment the focus unit state. More... | |
| struct unit * | get_drawable_unit (const struct tileset *t, const ::tile *ptile) |
| Find unit that we can display from given tile. More... | |
| static void | unload_all_sprites (struct tileset *t) |
| This patch unloads all sprites from the sprite hash (the hash itself is left intact). More... | |
| void | tileset_free_tiles (struct tileset *t) |
| Free all sprites from tileset. More... | |
| const QPixmap * | get_spaceship_sprite (const struct tileset *t, enum spaceship_part part) |
| Return the sprite for drawing the given spaceship part. More... | |
| 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. More... | |
| const QPixmap * | get_nation_flag_sprite (const struct tileset *t, const struct nation_type *pnation) |
| Return the sprite for the nation. More... | |
| const QPixmap * | get_nation_shield_sprite (const struct tileset *t, const struct nation_type *pnation) |
| Return the shield sprite for the nation. More... | |
| const QPixmap * | get_tech_sprite (const struct tileset *t, Tech_type_id tech) |
| Return the sprite for the technology/advance. More... | |
| const QPixmap * | get_building_sprite (const struct tileset *t, const struct impr_type *pimprove) |
| Return the sprite for the building/improvement. More... | |
| const QPixmap * | get_government_sprite (const struct tileset *t, const struct government *gov) |
| Return the sprite for the government. More... | |
| const QPixmap * | get_unittype_sprite (const struct tileset *t, const struct unit_type *punittype, enum direction8 facing, const QColor &replace) |
| Return the sprite for the unit type (the base "unit" sprite). More... | |
| 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). More... | |
| const QPixmap * | get_event_sprite (const struct tileset *t, enum event_type event) |
| Return event icon sprite. More... | |
| const QPixmap * | get_dither_sprite (const struct tileset *t) |
| Return dither sprite. More... | |
| const QPixmap * | get_mask_sprite (const struct tileset *t) |
| Return tile mask sprite. More... | |
| 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. More... | |
| const std::vector< QPixmap * > & | get_unit_explode_animation (const struct tileset *t) |
| Return a sprite_vector containing the animation sprites for a unit explosion. More... | |
| const QPixmap * | get_nuke_explode_sprite (const struct tileset *t) |
| Return a sprite contining the single nuke graphic. More... | |
| const struct citybar_sprites * | get_citybar_sprites (const struct tileset *t) |
| Return all the sprites used for city bar drawing. More... | |
| const struct editor_sprites * | get_editor_sprites (const struct tileset *t) |
| Return all the sprites used for editor icons, images, etc. More... | |
| 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. More... | |
| const QPixmap * | get_attention_crosshair_sprite (const struct tileset *t) |
| Returns a sprite with the "user-attention" crosshair graphic. More... | |
| const QPixmap * | get_indicator_sprite (const struct tileset *t, enum indicator_type indicator, int idx) |
| Returns a sprite for the given indicator with the given index. More... | |
| 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 support dialog, for instance. More... | |
| 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 support dialog, for instance. More... | |
| struct color_system * | get_color_system (const struct tileset *t) |
| Return the tileset's color system. More... | |
| void | tileset_init (struct tileset *t) |
| Initialize tileset structure. More... | |
| 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 type. More... | |
| const freeciv::layer_city * | tileset_layer_city (const struct tileset *t) |
| Returns the layer_city of the tileset. More... | |
| 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. More... | |
| const std::vector< std::unique_ptr< freeciv::layer > > & | tileset_get_layers (const struct tileset *t) |
| void | tileset_player_init (struct tileset *t, struct player *pplayer) |
| Setup tiles for one player using the player color. More... | |
| void | tileset_ruleset_reset (struct tileset *t) |
| Reset tileset data specific to ruleset. More... | |
| bool | tileset_is_fully_loaded () |
| Is tileset in sane state? More... | |
| std::vector< tileset_log_entry > | tileset_log (const struct tileset *t) |
| Get tileset log (warnings, errors, etc.) More... | |
| bool | tileset_has_error (const struct tileset *t) |
| Checks if the tileset had any error message (LOG_ERROR). More... | |
| bool | tileset_has_options (const struct tileset *t) |
| Checks if the tileset has any user-settable options. More... | |
| bool | tileset_has_option (const struct tileset *t, const QString &option) |
| Checks if the tileset has supports the given user-settable option. More... | |
| std::map< QString, tileset_option > | tileset_get_options (const struct tileset *t) |
| Gets the user-settable options of the tileset. More... | |
| bool | tileset_option_is_enabled (const struct tileset *t, const QString &name) |
| Checks if an user-settable tileset option is enabled. More... | |
| bool | tileset_set_option (struct tileset *t, const QString &name, bool enabled) |
| Enable or disable a user-settable tileset option. More... | |
| const char * | tileset_name_get (const struct tileset *t) |
| Return tileset name. More... | |
| const char * | tileset_version (const struct tileset *t) |
| Return tileset version. More... | |
| const char * | tileset_summary (const struct tileset *t) |
| Return tileset description summary. More... | |
| const char * | tileset_description (const struct tileset *t) |
| Return tileset description body. More... | |
| int | tileset_topo_index (const struct tileset *t) |
| Return tileset topology index. More... | |
| help_item * | tileset_help (const struct tileset *t) |
| Creates the help item for the given tileset. More... | |
Variables | |
| static const char *const | OPTION_SECTION_PREFIX = "option_" |
| The prefix for option sections in the tilespec file. More... | |
| struct tileset * | tileset |
| static bool | tileset_update = false |
| QEvent::Type | TilesetChanged |
| An event type sent to all widgets when the current tileset changes. More... | |
| #define LOAD_FACING_SPRITE | ( | dir | ) |
| #define MAX_NUM_LAYERS 3 |
Definition at line 134 of file tilespec.cpp.
| #define SPEC_CAPSTR "+Freeciv-spec-Devel-2019-Jul-03 options" |
Definition at line 118 of file tilespec.cpp.
| #define TILE_SECTION_PREFIX "tile_" |
Definition at line 129 of file tilespec.cpp.
| #define TILESPEC_CAPSTR |
Definition at line 87 of file tilespec.cpp.
| #define TILESPEC_SUFFIX ".tilespec" |
Definition at line 128 of file tilespec.cpp.
| 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.
up to 999)
Definition at line 2408 of file tilespec.cpp.
Referenced by freeciv::layer_city_size::load_sprites(), and freeciv::layer_goto::load_sprites().
|
static |
Goes through the possible digits and assigns them.
Definition at line 2390 of file tilespec.cpp.
Referenced by assign_digit_sprites().
|
static |
finds the first sprite matching a list of possible names and returns it to the field argument.
Definition at line 2380 of file tilespec.cpp.
Referenced by assign_digit_sprites_helper(), tileset_lookup_sprite_tags(), and tileset_setup_extra().
| 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.
(map_x, map_y) : the (normalized) map position The values we fill in: tterrain_near : terrain types of all adjacent terrain tspecial_near : specials of all adjacent terrain
Definition at line 3080 of file tilespec.cpp.
Referenced by freeciv::layer_roads::fill_corners(), freeciv::layer_terrain::fill_sprite_array(), and freeciv::layer_water::fill_sprite_array().
|
static |
Calculate the height of a unit upkeep icons.
Definition at line 442 of file tilespec.cpp.
Referenced by tileset_lookup_sprite_tags().
| QString cardinal_index_str | ( | const struct tileset * | t, |
| int | idx | ||
| ) |
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 2233 of file tilespec.cpp.
Referenced by freeciv::layer_terrain::initialize_cell_whole_match_same(), freeciv::layer_water::initialize_extra(), and freeciv::layer_darkness::load_sprites().
|
static |
Determine the sprite_type string.
Definition at line 1395 of file tilespec.cpp.
Referenced by tileset_read_toplevel().
|
static |
Checks options in filename match what we require and support.
Die if not. 'which' should be "tilespec" or "spec".
Definition at line 780 of file tilespec.cpp.
Referenced by ensure_big_sprite(), scan_specfile(), and tileset_read_toplevel().
|
static |
Returns a text name for the citizen, as used in the tileset.
Definition at line 2207 of file tilespec.cpp.
Referenced by tileset_setup_citizen_types().
|
static |
Parse a direction name as a direction8.
Definition at line 613 of file tilespec.cpp.
Referenced by tileset_read_toplevel().
| QString dir_get_tileset_name | ( | enum direction8 | dir | ) |
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 613 of file tilespec.cpp.
Referenced by cardinal_index_str(), freeciv::layer_roads::initialize_all_separate(), freeciv::layer_roads::initialize_corners(), freeciv::layer_water::initialize_extra(), freeciv::layer_roads::initialize_parity_combined(), freeciv::layer_darkness::load_sprites(), tileset_setup_unit_direction(), and valid_index_str().
Ensure that the big sprite of the given spec file is loaded.
Definition at line 1146 of file tilespec.cpp.
Referenced by load_sprite().
| 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.
Definition at line 3679 of file tilespec.cpp.
Referenced by help_dialog::make_tree(), and terrain_canvas().
| 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 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 3642 of file tilespec.cpp.
Referenced by terrain_canvas().
| 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 2698 of file tilespec.cpp.
Referenced by handle_rulesets_ready(), and tileset_load_tiles().
| void focus_unit_in_combat | ( | struct tileset * | t | ) |
Setup tileset for showing combat where focus unit participates.
Definition at line 3221 of file tilespec.cpp.
Referenced by set_units_in_combat().
| const QPixmap* 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 3557 of file tilespec.cpp.
Referenced by draw_calculated_trade_routes(), freeciv::layer_overlays::fill_sprite_array(), and put_cross_overlay_tile().
Return the sprite for the building/improvement.
Definition at line 3394 of file tilespec.cpp.
Referenced by draw_reqtree(), help_dialog::make_tree(), node_rectangle_minimum_size(), polished_citybar_painter::paint(), city_production_delegate::paint(), freeciv::upkeep_widget::refresh(), progress_bar::set_pixmap(), help_widget::set_topic_building(), city_dialog::update_improvements(), and eco_report::update_report().
| 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.
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 nullptr value indicates there is no city; i.e., the sprite is just being used as a picture).
Definition at line 3337 of file tilespec.cpp.
Referenced by client_government_sprite(), and city_dialog::fill_citizens_pixmap().
Return the flag graphic to be used by the city.
Definition at line 3052 of file tilespec.cpp.
Referenced by freeciv::layer_city::fill_sprite_array(), traditional_citybar_painter::paint(), and polished_citybar_painter::paint().
| const struct citybar_sprites* get_citybar_sprites | ( | const struct tileset * | t | ) |
Return all the sprites used for city bar drawing.
Definition at line 3523 of file tilespec.cpp.
Referenced by help_widget::create_terrain_widget(), traditional_citybar_painter::paint(), and polished_citybar_painter::paint().
| struct color_system* get_color_system | ( | const struct tileset * | t | ) |
Return the tileset's color system.
Definition at line 3622 of file tilespec.cpp.
Referenced by get_color().
| 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.
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 3542 of file tilespec.cpp.
Referenced by fc_client::create_cursors().
| const QPixmap* get_dither_sprite | ( | const struct tileset * | t | ) |
Return dither sprite.
Definition at line 3478 of file tilespec.cpp.
Referenced by freeciv::layer_terrain::initialize_blending().
Find unit that we can display from given tile.
Definition at line 3246 of file tilespec.cpp.
Referenced by put_one_tile(), and freeciv::tileset_debugger::set_tile().
| const struct editor_sprites* get_editor_sprites | ( | const struct tileset * | t | ) |
Return all the sprites used for editor icons, images, etc.
Definition at line 3531 of file tilespec.cpp.
Referenced by editor_get_mode_sprite(), and editor_tool_get_sprite().
| const QPixmap* get_event_sprite | ( | const struct tileset * | t, |
| enum event_type | event | ||
| ) |
Return event icon sprite.
Definition at line 3469 of file tilespec.cpp.
Referenced by message_widget::msg().
| int 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 3200 of file tilespec.cpp.
Referenced by blink_active_unit().
| const QPixmap* get_government_sprite | ( | const struct tileset * | t, |
| const struct government * | gov | ||
| ) |
Return the sprite for the government.
Definition at line 3404 of file tilespec.cpp.
Referenced by client_government_sprite(), plr_item::data(), draw_reqtree(), help_dialog::make_tree(), node_rectangle_minimum_size(), and gov_menu::update().
| const QPixmap* 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 3566 of file tilespec.cpp.
Referenced by client_cooling_sprite(), client_research_sprite(), and client_warming_sprite().
| const QPixmap* get_mask_sprite | ( | const struct tileset * | t | ) |
Return tile mask sprite.
Definition at line 3486 of file tilespec.cpp.
Referenced by freeciv::layer_terrain::initialize_cell_corner_match_full(), freeciv::layer_terrain::initialize_cell_hex_corner(), freeciv::layer_background::initialize_player(), freeciv::layer_editor::load_sprites(), and freeciv::layer_overlays::load_sprites().
| const QPixmap* get_nation_flag_sprite | ( | const struct tileset * | t, |
| const struct nation_type * | pnation | ||
| ) |
Return the sprite for the nation.
Definition at line 3367 of file tilespec.cpp.
Referenced by diplo_dlg::add_widget(), plr_item::data(), diplo_wdg::diplo_wdg(), freeciv::layer_base_flags::fill_sprite_array(), goto_dialog::fill_tab(), get_city_flag_sprite(), help_dialog::make_tree(), pageGame::pageGame(), pageGame::reloadSidebarIcons(), races_dialog::set_index(), city_dialog::update_nation_table(), endgame_report::update_report(), and page_pregame::update_start_page().
| const QPixmap* get_nation_shield_sprite | ( | const struct tileset * | t, |
| const struct nation_type * | pnation | ||
| ) |
Return the shield sprite for the nation.
Definition at line 3376 of file tilespec.cpp.
Referenced by pregame_options::update_buttons().
| const QPixmap* 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 3515 of file tilespec.cpp.
Referenced by put_nuke_mushroom_pixmaps().
| const QPixmap* get_spaceship_sprite | ( | const struct tileset * | t, |
| enum spaceship_part | part | ||
| ) |
Return the sprite for drawing the given spaceship part.
Definition at line 3324 of file tilespec.cpp.
| 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).
Definition at line 3448 of file tilespec.cpp.
Referenced by national_budget_widget::paintEvent(), national_budget_dialog::refresh(), and national_budget_widget::sizeHint().
| const QPixmap* get_tech_sprite | ( | const struct tileset * | t, |
| Tech_type_id | tech | ||
| ) |
Return the sprite for the technology/advance.
Definition at line 3385 of file tilespec.cpp.
Referenced by help_dialog::make_tree(), progress_bar::set_pixmap(), help_widget::set_topic_tech(), top_bar_right_click_science(), and science_report::update_report().
| struct tileset* get_tileset | ( | ) |
Returns the tileset.
Definition at line 326 of file tilespec.cpp.
Referenced by unit_list_widget::create_unit_image(), traditional_citybar_painter::paint(), polished_citybar_painter::paint(), city_production_delegate::paint(), freeciv::upkeep_widget::refresh(), progress_bar::set_pixmap(), and city_dialog::update_improvements().
Returns a static list of tilesets available on the system by searching all data directories for files matching TILESPEC_SUFFIX.
Definition at line 725 of file tilespec.cpp.
Referenced by init_client_options(), and mr_menu::tileset_custom_load().
| 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.
Definition at line 3495 of file tilespec.cpp.
Referenced by diplo_wdg::update_wdg().
| const std::vector<QPixmap *>& get_unit_explode_animation | ( | const struct tileset * | t | ) |
Return a sprite_vector containing the animation sprites for a unit explosion.
Definition at line 3505 of file tilespec.cpp.
Referenced by animate_unit_explosion().
Return a sprite for the national flag for this unit.
Definition at line 3061 of file tilespec.cpp.
Referenced by freeciv::layer_units::fill_sprite_array().
| 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 support dialog, for instance.
May return nullptr if there's no unhappiness.
Definition at line 3582 of file tilespec.cpp.
Referenced by put_unit_city_overlays().
| 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 support dialog, for instance.
May return nullptr if there's no upkeep of the kind.
Definition at line 3603 of file tilespec.cpp.
Referenced by put_unit_city_overlays().
| const QPixmap* get_unittype_sprite | ( | const struct tileset * | t, |
| const struct unit_type * | punittype, | ||
| enum direction8 | facing, | ||
| const QColor & | replace | ||
| ) |
Return the sprite for the unit type (the base "unit" sprite).
If 'facing' is direction8_invalid(), will use an unoriented sprite or a default orientation.
Definition at line 3416 of file tilespec.cpp.
Referenced by draw_reqtree(), freeciv::layer_units::fill_sprite_array(), hud_unit_combat::init_images(), help_dialog::make_tree(), node_rectangle_minimum_size(), polished_citybar_painter::paint(), city_production_delegate::paint(), progress_bar::set_pixmap(), help_widget::set_topic_unit(), hud_unit_loader::show_me(), city_dialog::update_improvements(), eco_report::update_report(), units_view::update_units(), and units_view::update_waiting().
| bool is_cardinal_tileset_dir | ( | const struct tileset * | t, |
| enum direction8 | dir | ||
| ) |
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 675 of file tilespec.cpp.
Referenced by freeciv::layer_roads::fill_corners(), freeciv::layer_roads::initialize_corners(), and tileset_read_toplevel().
| bool is_extra_drawing_enabled | ( | const extra_type * | pextra | ) |
Should the given extra be drawn FIXME: Some extras can not be switched.
Definition at line 3133 of file tilespec.cpp.
Referenced by freeciv::layer_water::fill_irrigation_sprite_array(), freeciv::layer_roads::fill_sprite_array(), and freeciv::layer_special::fill_sprite_array().
|
static |
Return TRUE iff the dir is valid in this tileset.
Definition at line 657 of file tilespec.cpp.
Referenced by is_cardinal_tileset_dir(), tileset_read_toplevel(), and tileset_setup_unit_direction().
|
static |
Loads the given graphics file (found in the data path) into a newly allocated sprite.
Definition at line 1113 of file tilespec.cpp.
Referenced by ensure_big_sprite(), and load_sprite().
|
static |
Loads the sprite.
If the sprite is already loaded a reference counter is increased. Can return nullptr if the sprite couldn't be loaded.
Definition at line 2270 of file tilespec.cpp.
Referenced by assign_sprite(), freeciv::layer::load_sprite(), load_sprite(), tiles_lookup_sprite_tag_alt(), tileset_lookup_sprite_tags(), tileset_setup_citizen_types(), tileset_setup_nation_flag(), tileset_setup_specialist_type(), tileset_setup_unit_direction(), and tileset_setup_unit_type_from_tag().
| QPixmap* load_sprite | ( | struct tileset * | t, |
| const QStringList & | possible_names, | ||
| bool | required, | ||
| bool | verbose | ||
| ) |
Finds the first sprite matching a list of possible names and returns it.
Aborts when a required sprite is not found; otherwise, warns and returns nullptr.
Definition at line 2322 of file tilespec.cpp.
|
static |
Makes a dummy "error" pixmap to prevent crashes.
Definition at line 1102 of file tilespec.cpp.
Referenced by load_gfx_file(), tileset_setup_impr_type(), and tileset_setup_tech_type().
| 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.
Definition at line 2914 of file tilespec.cpp.
Referenced by freeciv::layer_roads::initialize_all_combined(), freeciv::layer_roads::initialize_all_separate(), freeciv::layer_roads::initialize_corners(), freeciv::layer_water::initialize_extra(), and freeciv::layer_roads::initialize_parity_combined().
| Q_LOGGING_CATEGORY | ( | tileset_category | , |
| "freeciv.tileset" | |||
| ) |
Functions for handling the tilespec files which describe the files and contents of tilesets.
original author: David Pfitzner dwp@mso.anu.edu.au
| void reset_focus_unit_state | ( | struct tileset * | t | ) |
Reset the focus unit state.
This should be called when changing focus units.
Definition at line 3213 of file tilespec.cpp.
Referenced by focus_unit_in_combat().
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 1186 of file tilespec.cpp.
Referenced by tileset_read_toplevel().
| 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, and emit log message.
Definition at line 2724 of file tilespec.cpp.
Referenced by freeciv::layer_terrain::initialize_blending(), freeciv::layer_terrain::initialize_cell_corner_match_none(), freeciv::layer_terrain::initialize_cell_corner_match_pair(), freeciv::layer_terrain::initialize_cell_corner_match_same(), freeciv::layer_terrain::initialize_cell_whole_match_same(), tileset_setup_government(), tileset_setup_impr_type(), tileset_setup_tech_type(), and units_view::units_view().
|
static |
Creates a layer object for the given enumerated type and appends it to the layers of t.
Also fills layer pointers in *t if needed.
Definition at line 1480 of file tilespec.cpp.
Referenced by tileset_read_toplevel().
| const char* tileset_basename | ( | const struct tileset * | t | ) |
Return the name of the given tileset.
Definition at line 331 of file tilespec.cpp.
Referenced by handle_ruleset_control(), handle_set_topology(), popup_tileset_suggestion_dialog(), scan_specfile(), map_view::shortcut_pressed(), tileset_set_option(), and tileset_setup_options().
| std::array<direction8, 8> tileset_cardinal_dirs | ( | const struct tileset * | t | ) |
Returns the cardinal directions used by the tileset.
Only the first tileset_num_cardinal_dirs items should be used.
Definition at line 574 of file tilespec.cpp.
Referenced by freeciv::layer_darkness::fill_sprite_array(), freeciv::layer_water::fill_sprite_array(), freeciv::layer_terrain::fill_terrain_sprite_array(), freeciv::layer_water::initialize_extra(), and freeciv::layer_darkness::load_sprites().
| 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 504 of file tilespec.cpp.
Referenced by show_city_desc(), and show_city_descriptions().
| const char* tileset_description | ( | const struct tileset * | t | ) |
Return tileset description body.
Definition at line 3846 of file tilespec.cpp.
Referenced by tileset_help().
| void tileset_error | ( | struct tileset * | t, |
| QtMsgType | level, | ||
| const char * | format, | ||
| ... | |||
| ) |
Called when ever there's problem in ruleset/tileset compatibility.
Definition at line 291 of file tilespec.cpp.
Referenced by freeciv::layer_terrain::add_tag(), freeciv::layer_terrain::create_matching_group(), freeciv::layer_terrain::enable_blending(), ensure_big_sprite(), freeciv::layer_city_size::fill_sprite_array(), freeciv::layer_goto::fill_sprite_array(), freeciv::layer_terrain::group(), handle_map_info(), freeciv::layer_terrain::initialize_blending(), freeciv::layer_terrain::initialize_cell_corner_match_full(), freeciv::layer_terrain::initialize_cell_hex_corner(), freeciv::layer_terrain::initialize_cell_whole_match_none(), freeciv::layer_city::initialize_city_style(), freeciv::layer_terrain::initialize_terrain(), freeciv::layer_city::load_city_size_sprites(), load_sprite(), freeciv::layer_darkness::load_sprites(), freeciv::layer_overlays::load_sprites(), freeciv::layer_units::load_sprites(), scan_specfile(), tiles_lookup_sprite_tag_alt(), tileset_lookup_sprite_tags(), tileset_read_toplevel(), tileset_setup_citizen_types(), tileset_setup_extra(), tileset_setup_nation_flag(), tileset_setup_options(), tileset_setup_specialist_type(), tileset_setup_unit_type(), tilespec_reread(), and tilespec_try_read().
| void tileset_free | ( | struct tileset * | t | ) |
Clean up.
Definition at line 840 of file tilespec.cpp.
Referenced by client_exit(), get_tileset_list(), tilespec_reread(), and tilespec_try_read().
| void tileset_free_tiles | ( | struct tileset * | t | ) |
Free all sprites from tileset.
Definition at line 3285 of file tilespec.cpp.
Referenced by fc_client::fc_main(), and tileset_free().
|
static |
Frees the tilespec toplevel data, in preparation for re-reading it.
See tilespec_read_toplevel().
Definition at line 819 of file tilespec.cpp.
Referenced by tileset_free().
| 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 407 of file tilespec.cpp.
Referenced by freeciv::layer_background::create_player_sprite(), move_unit_map_canvas(), terrain_canvas(), and tile_to_canvas_pos().
| QPoint tileset_full_tile_offset | ( | const struct tileset * | t | ) |
Return the x and y offsets of full tiles in the tileset.
Use this to draw "full sprites".
Definition at line 416 of file tilespec.cpp.
Referenced by freeciv::layer_city::fill_sprite_array(), freeciv::layer_infrawork::fill_sprite_array(), freeciv::layer_units::fill_sprite_array(), freeciv::layer_workertask::fill_sprite_array(), freeciv::layer_city::fill_sprite_array_no_flag(), freeciv::layer_special::initialize_extra(), tileset_add_layer(), and tileset_read_toplevel().
| int tileset_full_tile_width | ( | const struct tileset * | t | ) |
Return the full tile width of the current tileset.
This is the maximum width that any mapview sprite will have.
Note: currently this is always equal to the tile width.
Definition at line 394 of file tilespec.cpp.
Referenced by freeciv::layer_background::create_player_sprite(), terrain_canvas(), and hud_units::update_actions().
| const std::vector<std::unique_ptr<freeciv::layer> >& tileset_get_layers | ( | const struct tileset * | t | ) |
Definition at line 3700 of file tilespec.cpp.
Referenced by put_terrain(), put_unit(), freeciv::tileset_debugger::set_tile(), and update_map_canvas().
| std::map<QString, tileset_option> tileset_get_options | ( | const struct tileset * | t | ) |
Gets the user-settable options of the tileset.
Definition at line 3789 of file tilespec.cpp.
Referenced by freeciv::tileset_options_dialog::reset(), and freeciv::tileset_options_dialog::tileset_options_dialog().
| bool tileset_has_error | ( | const struct tileset * | t | ) |
Checks if the tileset had any error message (LOG_ERROR).
Definition at line 3763 of file tilespec.cpp.
Referenced by tileset_changed().
| bool tileset_has_option | ( | const struct tileset * | t, |
| const QString & | option | ||
| ) |
Checks if the tileset has supports the given user-settable option.
Definition at line 3780 of file tilespec.cpp.
Referenced by scan_specfile(), and tileset_setup_options().
| bool tileset_has_options | ( | const struct tileset * | t | ) |
Checks if the tileset has any user-settable options.
Definition at line 3772 of file tilespec.cpp.
Referenced by mr_menu::event(), and mr_menu::setup_menus().
Creates the help item for the given tileset.
Definition at line 3859 of file tilespec.cpp.
Referenced by boot_help_texts(), client_main(), client_state(), handle_game_info(), and tilespec_reread().
| 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 351 of file tilespec.cpp.
Referenced by units_select::create_pixmap(), unit_list_widget::create_unit_image(), freeciv::layer_roads::fill_corners(), gui_to_map_pos(), freeciv::layer_grid::load_sprites(), move_unit_map_canvas(), freeciv::gui_rect_iterator::next(), and tileset_read_toplevel().
| 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 345 of file tilespec.cpp.
Referenced by units_select::create_pixmap(), unit_list_widget::create_unit_image(), freeciv::layer_roads::fill_corners(), gui_to_map_pos(), freeciv::layer_grid::load_sprites(), and freeciv::gui_rect_iterator::next().
| void tileset_init | ( | struct tileset * | t | ) |
Initialize tileset structure.
Definition at line 3630 of file tilespec.cpp.
Referenced by ui_main().
|
static |
Definition at line 1414 of file tilespec.cpp.
Referenced by tileset_read_toplevel().
| bool tileset_is_fully_loaded | ( | ) |
Is tileset in sane state?
Definition at line 3750 of file tilespec.cpp.
| bool tileset_is_isometric | ( | const struct tileset * | t | ) |
Return whether the current tileset is isometric.
Definition at line 336 of file tilespec.cpp.
Referenced by can_do_cached_drawing(), units_select::create_pixmap(), unit_list_widget::create_unit_image(), freeciv::layer_terrain::enable_blending(), freeciv::layer_grid::fill_sprite_array(), freeciv::layer_overlays::fill_sprite_array(), freeciv::layer_city::fill_sprite_array_no_flag(), freeciv::layer_terrain::fill_terrain_sprite_array(), get_mapview_scroll_window(), freeciv::gui_rect_iterator::gui_rect_iterator(), gui_to_map_pos(), gui_to_natural_pos(), minimap_view::heightForWidth(), map_to_gui_vector(), move_unit_map_canvas(), mr_menu::save_image(), tile_visible_and_not_on_border_mapcanvas(), tileset_lookup_sprite_tags(), hud_units::update_actions(), and update_map_canvas().
| const freeciv::layer_city* tileset_layer_city | ( | const struct tileset * | t | ) |
Returns the layer_city of the tileset.
Definition at line 3665 of file tilespec.cpp.
Referenced by freeciv::city_icon_widget::paintEvent(), races_dialog::races_dialog(), and freeciv::city_icon_widget::sizeHint().
| 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 2714 of file tilespec.cpp.
Referenced by tilespec_reread(), and ui_main().
| std::vector<tileset_log_entry> tileset_log | ( | const struct tileset * | t | ) |
Get tileset log (warnings, errors, etc.)
Definition at line 3755 of file tilespec.cpp.
Referenced by freeciv::tileset_debugger::refresh_messages().
|
static |
Initialize 'sprites' structure based on hardwired tags which freeciv always requires.
Definition at line 2515 of file tilespec.cpp.
Referenced by tileset_load_tiles().
| const char* tileset_name_get | ( | const struct tileset * | t | ) |
Return tileset name.
Definition at line 3828 of file tilespec.cpp.
Referenced by freeciv::layer_city_size::fill_sprite_array(), freeciv::layer_goto::fill_sprite_array(), tileset_changed(), and tileset_help().
|
static |
| int tileset_num_cardinal_dirs | ( | const struct tileset * | t | ) |
Returns the number of cardinal directions used by the tileset.
Definition at line 554 of file tilespec.cpp.
Referenced by freeciv::layer_darkness::fill_sprite_array(), freeciv::layer_water::fill_sprite_array(), freeciv::layer_terrain::fill_terrain_sprite_array(), freeciv::layer_water::initialize_extra(), and freeciv::layer_darkness::load_sprites().
| int tileset_num_index_cardinals | ( | const struct tileset * | t | ) |
Returns the number of cardinal indices used by the tileset.
This is 2^tileset_num_cardinal_dirs(t).
Definition at line 564 of file tilespec.cpp.
Referenced by freeciv::layer_terrain::fill_terrain_sprite_array(), freeciv::layer_terrain::initialize_cell_whole_match_same(), freeciv::layer_water::initialize_extra(), and freeciv::layer_darkness::load_sprites().
| int tileset_num_valid_dirs | ( | const struct tileset * | t | ) |
Returns the number of valid directions in the tileset.
Definition at line 582 of file tilespec.cpp.
Referenced by freeciv::layer_roads::fill_all_separate(), freeciv::layer_roads::fill_corners(), freeciv::layer_roads::fill_parity_combined(), freeciv::layer_roads::initialize_all_combined(), freeciv::layer_roads::initialize_all_separate(), freeciv::layer_roads::initialize_corners(), and freeciv::layer_roads::initialize_parity_combined().
| bool tileset_option_is_enabled | ( | const struct tileset * | t, |
| const QString & | name | ||
| ) |
Checks if an user-settable tileset option is enabled.
The option must exist in the tileset.
Definition at line 3799 of file tilespec.cpp.
Referenced by scan_specfile(), and freeciv::tileset_options_dialog::tileset_options_dialog().
|
static |
Free tiles for one player using the player color.
Definition at line 3727 of file tilespec.cpp.
Referenced by tileset_free(), and tileset_player_init().
Setup tiles for one player using the player color.
Definition at line 3708 of file tilespec.cpp.
Referenced by handle_player_info(), and tilespec_reread().
| double tileset_preferred_scale | ( | const struct tileset * | t | ) |
Returns the preferred scale (zoom level) of the tileset.
Definition at line 539 of file tilespec.cpp.
Referenced by tileset_changed(), and map_view::zoom_reset().
|
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 1579 of file tilespec.cpp.
Referenced by get_tileset_list(), tilespec_reread(), and tilespec_try_read().
| int tileset_replaced_hue | ( | const struct tileset * | t | ) |
Returns the hue (color) that should be replaced with the player color in player-dependent sprites.
Definition at line 548 of file tilespec.cpp.
Referenced by freeciv::layer_city::load_city_size_sprites().
| void tileset_ruleset_reset | ( | struct tileset * | t | ) |
Reset tileset data specific to ruleset.
Definition at line 3740 of file tilespec.cpp.
Referenced by handle_ruleset_control().
|
static |
Definition at line 1455 of file tilespec.cpp.
Referenced by tileset_read_toplevel().
| bool tileset_set_option | ( | struct tileset * | t, |
| const QString & | name, | ||
| bool | enabled | ||
| ) |
Enable or disable a user-settable tileset option.
The tileset may be reloaded as a result, invalidating t.
Returns false if the option does not exist. The game must have been initialized before calling this.
Definition at line 3812 of file tilespec.cpp.
Referenced by freeciv::tileset_options_dialog::tileset_options_dialog().
|
static |
Setup the graphics for (non-specialist) citizen types.
Definition at line 2487 of file tilespec.cpp.
Referenced by tileset_lookup_sprite_tags().
| 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 3188 of file tilespec.cpp.
Referenced by handle_ruleset_city(), and tilespec_reread().
| 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 2937 of file tilespec.cpp.
Referenced by handle_rulesets_ready(), and tilespec_reread().
| void tileset_setup_government | ( | struct tileset * | t, |
| struct government * | gov | ||
| ) |
Set government sprite value; should only happen after tilespec_load_tiles().
Definition at line 3007 of file tilespec.cpp.
Referenced by handle_ruleset_government(), and tilespec_reread().
Set improvement_type sprite value; should only happen after tilespec_load_tiles().
Definition at line 2879 of file tilespec.cpp.
Referenced by handle_ruleset_building(), and tilespec_reread().
| 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 3020 of file tilespec.cpp.
Referenced by handle_ruleset_nation(), and tilespec_reread().
|
static |
Loads tileset options.
This function loads options from the a '.tilespec' file and sets up all structures in the tileset.
Definition at line 2139 of file tilespec.cpp.
Referenced by tileset_read_toplevel().
| void tileset_setup_specialist_type | ( | struct tileset * | t, |
| Specialist_type_id | id | ||
| ) |
Setup the graphics for specialist types.
Definition at line 2423 of file tilespec.cpp.
Referenced by handle_ruleset_specialist(), and tilespec_reread().
Set tech_type sprite value; should only happen after tilespec_load_tiles().
Definition at line 2895 of file tilespec.cpp.
Referenced by handle_ruleset_tech(), and tilespec_reread().
Set tile_type sprite values; should only happen after tilespec_load_tiles().
Definition at line 2995 of file tilespec.cpp.
Referenced by handle_ruleset_terrain(), and tilespec_reread().
|
static |
Helper function to load sprite for one unit orientation.
Returns FALSE if a needed sprite was not found.
Definition at line 2763 of file tilespec.cpp.
Set unit_type sprite value; should only happen after tilespec_load_tiles().
Definition at line 2847 of file tilespec.cpp.
Referenced by handle_ruleset_unit(), and tilespec_reread().
|
static |
Try to setup all unit type sprites from single tag.
Definition at line 2807 of file tilespec.cpp.
Referenced by tileset_setup_unit_type().
| 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 523 of file tilespec.cpp.
Referenced by city_dialog::fill_citizens_pixmap(), city_label::mousePressEvent(), and city_dialog::update_citizens().
| 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 495 of file tilespec.cpp.
Referenced by city_dialog::fill_citizens_pixmap(), city_label::mousePressEvent(), and city_dialog::update_citizens().
|
static |
Definition at line 1463 of file tilespec.cpp.
Referenced by tileset_read_toplevel().
| const char* tileset_summary | ( | const struct tileset * | t | ) |
Return tileset description summary.
Definition at line 3841 of file tilespec.cpp.
Referenced by tileset_help().
| 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 383 of file tilespec.cpp.
Referenced by animate_unit_explosion(), info_tile::calc_size(), can_do_cached_drawing(), map_view::center_on_tile(), draw_calculated_trade_routes(), draw_segment(), draw_trade_route_line(), editor_end_selection_rectangle(), freeciv::layer_terrain::fill_blending_sprite_array(), freeciv::layer_darkness::fill_sprite_array(), freeciv::layer_overlays::fill_sprite_array(), freeciv::layer_terrain::fill_terrain_sprite_array(), generate_citydlg_dimensions(), get_mapview_scroll_window(), freeciv::gui_rect_iterator::gui_rect_iterator(), gui_to_map_pos(), gui_to_natural_pos(), freeciv::layer_terrain::initialize_blending(), freeciv::layer_terrain::initialize_cell_hex_corner(), freeciv::layer_background::initialize_player(), freeciv::layer_grid::initialize_player(), link_mark_draw(), freeciv::layer_darkness::load_sprites(), freeciv::layer_editor::load_sprites(), freeciv::layer_overlays::load_sprites(), map_canvas_resized(), map_to_gui_vector(), move_unit_map_canvas(), put_nuke_mushroom_pixmaps(), put_terrain(), put_unit(), mr_menu::save_image(), freeciv::city_icon_widget::sizeHint(), terrain_canvas(), tile_to_canvas_pos(), tile_visible_and_not_on_border_mapcanvas(), tileset_set_offsets(), hud_units::update_actions(), update_map_canvas(), and update_rects().
| 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:
Definition at line 371 of file tilespec.cpp.
Referenced by animate_unit_explosion(), can_do_cached_drawing(), map_view::center_on_tile(), draw_calculated_trade_routes(), draw_segment(), draw_trade_route_line(), editor_end_selection_rectangle(), freeciv::layer_terrain::fill_blending_sprite_array(), freeciv::layer_darkness::fill_sprite_array(), freeciv::layer_overlays::fill_sprite_array(), freeciv::layer_terrain::fill_terrain_sprite_array(), generate_citydlg_dimensions(), get_mapview_scroll_window(), freeciv::gui_rect_iterator::gui_rect_iterator(), gui_to_map_pos(), gui_to_natural_pos(), freeciv::layer_terrain::initialize_blending(), freeciv::layer_terrain::initialize_cell_hex_corner(), freeciv::layer_background::initialize_player(), freeciv::layer_grid::initialize_player(), link_mark_draw(), freeciv::layer_darkness::load_sprites(), freeciv::layer_editor::load_sprites(), freeciv::layer_overlays::load_sprites(), map_canvas_resized(), map_to_gui_vector(), put_nuke_mushroom_pixmaps(), mr_menu::save_image(), show_city_desc(), show_city_descriptions(), show_tile_label(), show_tile_labels(), freeciv::city_icon_widget::sizeHint(), tile_to_canvas_pos(), tile_visible_and_not_on_border_mapcanvas(), and update_rects().
| 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 513 of file tilespec.cpp.
Referenced by show_tile_label().
| int tileset_topo_index | ( | const struct tileset * | t | ) |
Return tileset topology index.
Definition at line 3854 of file tilespec.cpp.
Referenced by freeciv::layer_terrain::initialize_terrain(), and tilespec_try_read().
| int tileset_unit_height | ( | const struct tileset * | t | ) |
Return the unit tile height of the current tileset.
Definition at line 434 of file tilespec.cpp.
Referenced by hud_battle_log::add_combat_info(), units_select::create_pixmap(), unit_list_widget::create_unit_image(), hud_unit_combat::init_images(), move_unit_map_canvas(), choice_dialog::next_unit(), hud_unit_combat::paintEvent(), choice_dialog::prev_unit(), put_terrain(), put_unit(), choice_dialog::set_layout(), tileset_unit_with_upkeep_height(), hud_units::update_actions(), update_rects(), and hud_battle_log::update_size().
| int tileset_unit_layout_offset_y | ( | const struct tileset * | t | ) |
Offset to layout extra unit sprites, such as upkeep.
Definition at line 485 of file tilespec.cpp.
Referenced by unit_list_widget::create_unit_image(), freeciv::upkeep_widget::refresh(), and tileset_unit_with_upkeep_height().
| int tileset_unit_width | ( | const struct tileset * | t | ) |
Return the unit tile width of the current tileset.
Definition at line 426 of file tilespec.cpp.
Referenced by units_select::create_pixmap(), unit_list_widget::create_unit_image(), hud_unit_combat::init_images(), move_unit_map_canvas(), choice_dialog::next_unit(), choice_dialog::prev_unit(), freeciv::upkeep_widget::refresh(), choice_dialog::set_layout(), hud_units::update_actions(), and update_rects().
| int tileset_unit_with_upkeep_height | ( | const struct tileset * | t | ) |
Suitable canvas height for a unit icon that includes upkeep sprites.
Definition at line 473 of file tilespec.cpp.
Referenced by unit_list_widget::create_unit_image(), and freeciv::upkeep_widget::refresh().
|
static |
Get the height of a unit upkeep icons.
Definition at line 464 of file tilespec.cpp.
Referenced by tileset_unit_with_upkeep_height().
| 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 531 of file tilespec.cpp.
| std::array<direction8, 8> tileset_valid_dirs | ( | const struct tileset * | t | ) |
Returns the valid directions for the tileset.
Only the first tileset_num_valid_dirs items should be used.
Definition at line 592 of file tilespec.cpp.
Referenced by freeciv::layer_roads::fill_corners(), freeciv::layer_roads::initialize_all_separate(), freeciv::layer_roads::initialize_corners(), and freeciv::layer_roads::initialize_parity_combined().
| const char* tileset_version | ( | const struct tileset * | t | ) |
|
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 758 of file tilespec.cpp.
Referenced by tileset_read_toplevel().
| void tilespec_init | ( | ) |
Initializes the tilespec system.
Definition at line 709 of file tilespec.cpp.
| bool tilespec_reread | ( | const QString & | name, |
| bool | game_fully_initialized | ||
| ) |
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.
It will also call the necessary functions to redraw the graphics.
Returns TRUE iff new tileset has been succesfully loaded.
Definition at line 916 of file tilespec.cpp.
Referenced by handle_ruleset_control(), mr_menu::load_new_tileset(), popup_tileset_suggestion_dialog(), map_view::shortcut_pressed(), tilespec_reread_callback(), and tilespec_reread_frozen_refresh().
| 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 1063 of file tilespec.cpp.
Referenced by init_client_options().
| void tilespec_reread_frozen_refresh | ( | const QString & | name | ) |
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 1091 of file tilespec.cpp.
Referenced by handle_set_topology(), and tileset_set_option().
| bool tilespec_try_read | ( | const QString & | tileset_name, |
| bool | verbose, | ||
| int | topo_id | ||
| ) |
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 860 of file tilespec.cpp.
Referenced by client_main().
| 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 3232 of file tilespec.cpp.
Referenced by blink_active_unit().
|
static |
Convert properties of the actual topology to an index of different tileset topology types.
Definition at line 689 of file tilespec.cpp.
Referenced by get_tileset_list(), and tileset_read_toplevel().
| 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 3116 of file tilespec.cpp.
Referenced by freeciv::layer_grid::fill_sprite_array(), handle_unit_packet_common(), and freeciv::map_updates_handler::update().
|
static |
This patch unloads all sprites from the sprite hash (the hash itself is left intact).
Definition at line 3267 of file tilespec.cpp.
Referenced by tileset_free_tiles().
|
static |
Unloads the sprite.
Decrease the reference counter. If the last reference is removed the sprite is freed.
Definition at line 2358 of file tilespec.cpp.
Referenced by unload_all_sprites().
| QString valid_index_str | ( | const struct tileset * | t, |
| int | idx | ||
| ) |
Do the same thing as cardinal_str, except including all valid directions.
The returned string is a pointer to static memory.
Definition at line 2251 of file tilespec.cpp.
Referenced by freeciv::layer_roads::initialize_all_combined().
|
static |
The prefix for option sections in the tilespec file.
Definition at line 132 of file tilespec.cpp.
Referenced by tileset_setup_options().
Definition at line 276 of file tilespec.cpp.
Referenced by get_tileset().
|
static |
Definition at line 278 of file tilespec.cpp.
Referenced by tileset_is_fully_loaded(), tilespec_reread_callback(), and tilespec_reread_frozen_refresh().
| QEvent::Type TilesetChanged |
An event type sent to all widgets when the current tileset changes.
Definition at line 719 of file tilespec.cpp.
Referenced by mr_menu::event(), freeciv::city_icon_widget::event(), freeciv::upkeep_widget::event(), tilespec_init(), and tilespec_reread().