Freeciv21
Develop your civilization from humble roots to a global empire
tilespec.h
Go to the documentation of this file.
1 /*__ ___ ***************************************
2 / \ / \ Copyright (c) 1996-2023 Freeciv21 and Freeciv
3 \_ \ / __/ contributors. This file is part of Freeciv21.
4  _\ \ / /__ Freeciv21 is free software: you can redistribute it
5  \___ \____/ __/ and/or modify it under the terms of the GNU General
6  \_ _/ Public License as published by the Free Software
7  | @ @ \_ Foundation, either version 3 of the License,
8  | or (at your option) any later version.
9  _/ /\ You should have received a copy of the GNU
10  /o) (o/\ \_ General Public License along with Freeciv21.
11  \_____/ / If not, see https://www.gnu.org/licenses/.
12  \____/ ********************************************************/
13 
14 /***********************************************************************
15  Reading and using the tilespec files, which describe
16  the files and contents of tilesets.
17 ***********************************************************************/
18 #pragma once
19 
20 #include "layer.h"
21 #include "options.h"
22 
23 #include <QColor>
24 #include <QEvent>
25 
26 #include <map>
27 
28 struct base_type;
29 struct help_item;
30 struct resource_type;
31 
32 namespace freeciv {
33 class layer_city;
34 }
35 
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"
42 
43 #define NUM_TILES_PROGRESS 8
44 #define NUM_CORNER_DIRS 4
45 
46 #define MAX_NUM_CITIZEN_SPRITES 6
47 
49 
50 // This could be moved to common/map.h if there's more use for it.
52 
53 constexpr direction8 DIR4_TO_DIR8[4] = {DIR8_NORTH, DIR8_SOUTH, DIR8_EAST,
54  DIR8_WEST};
55 
57  QtMsgType level;
58  QString message;
59 };
60 
65  QString
67  bool enabled;
69 };
70 
71 struct tileset;
72 
73 extern struct tileset *tileset;
74 
75 void tilespec_init();
76 const QVector<QString> *get_tileset_list(const struct option *poption);
77 
78 extern QEvent::Type TilesetChanged;
79 
80 void tileset_error(struct tileset *t, QtMsgType level, const char *format,
81  ...);
82 
83 void tileset_init(struct tileset *t);
84 void tileset_free(struct tileset *tileset);
85 void tileset_load_tiles(struct tileset *t);
86 void tileset_free_tiles(struct tileset *t);
87 void tileset_ruleset_reset(struct tileset *t);
89 
90 std::vector<tileset_log_entry> tileset_log(const struct tileset *t);
91 bool tileset_has_error(const struct tileset *t);
92 
93 bool tileset_has_options(const struct tileset *t);
94 bool tileset_has_option(const struct tileset *t, const QString &name);
95 std::map<QString, tileset_option>
96 tileset_get_options(const struct tileset *t);
97 bool tileset_option_is_enabled(const struct tileset *t, const QString &name);
98 bool tileset_set_option(struct tileset *t, const QString &name,
99  bool enabled);
100 
101 void finish_loading_sprites(struct tileset *t);
102 
103 bool tilespec_try_read(const QString &name, bool verbose, int topo_id);
104 bool tilespec_reread(const QString &tileset_name,
105  bool game_fully_initialized);
106 void tilespec_reread_callback(struct option *poption);
107 void tilespec_reread_frozen_refresh(const QString &name);
108 
109 void assign_digit_sprites(struct tileset *t,
110  QPixmap *units[NUM_TILES_DIGITS],
111  QPixmap *tens[NUM_TILES_DIGITS],
112  QPixmap *hundreds[NUM_TILES_DIGITS],
113  const QStringList &patterns);
114 
116 void tileset_setup_unit_type(struct tileset *t, struct unit_type *punittype);
117 void tileset_setup_impr_type(struct tileset *t, struct impr_type *pimprove);
118 void tileset_setup_tech_type(struct tileset *t, struct advance *padvance);
119 void tileset_setup_tile_type(struct tileset *t,
120  const struct terrain *pterrain);
121 
122 QStringList make_tag_terrain_list(const QString &prefix,
123  const QString &suffix,
124  const struct terrain *pterrain);
125 void tileset_setup_extra(struct tileset *t, struct extra_type *pextra);
126 void tileset_setup_government(struct tileset *t, struct government *gov);
127 void tileset_setup_nation_flag(struct tileset *t,
128  struct nation_type *nation);
129 void tileset_setup_city_tiles(struct tileset *t, int style);
130 
131 void tileset_player_init(struct tileset *t, struct player *pplayer);
132 
133 // Layer order
134 const std::vector<std::unique_ptr<freeciv::layer>> &
135 tileset_get_layers(const struct tileset *t);
136 
137 // Gfx support
138 QPixmap *load_sprite(struct tileset *t, const QStringList &possible_names,
139  bool required, bool verbose = true);
140 
141 std::vector<drawn_sprite>
143  struct terrain *pterrain);
144 const freeciv::layer_city *tileset_layer_city(const struct tileset *t);
145 
146 int get_focus_unit_toggle_timeout(const struct tileset *t);
147 void reset_focus_unit_state(struct tileset *t);
148 void focus_unit_in_combat(struct tileset *t);
149 void toggle_focus_unit_state(struct tileset *t);
150 struct unit *get_drawable_unit(const struct tileset *t, const ::tile *ptile);
151 bool unit_drawn_with_city_outline(const struct unit *punit,
152  bool check_focus);
153 
167 };
168 
169 #define NUM_CURSOR_FRAMES 6
170 
176 };
177 
187 };
188 
191  std::vector<QPixmap *> occupancy;
192 };
193 
198 };
199 
200 const QPixmap *get_spaceship_sprite(const struct tileset *t,
201  enum spaceship_part part);
202 const QPixmap *get_citizen_sprite(const struct tileset *t,
203  enum citizen_category type,
204  int citizen_index,
205  const struct city *pcity);
206 const QPixmap *get_city_flag_sprite(const struct tileset *t,
207  const struct city *pcity);
208 void build_tile_data(const struct tile *ptile, struct terrain *pterrain,
209  struct terrain **tterrain_near,
210  bv_extras *textras_near);
211 QPixmap *get_unit_nation_flag_sprite(const struct tileset *t,
212  const struct unit *punit);
213 const QPixmap *get_activity_sprite(const struct tileset *t,
214  enum unit_activity activity,
215  extra_type *target);
216 const QPixmap *get_nation_flag_sprite(const struct tileset *t,
217  const struct nation_type *nation);
218 const QPixmap *get_nation_shield_sprite(const struct tileset *t,
219  const struct nation_type *nation);
220 const QPixmap *get_tech_sprite(const struct tileset *t, Tech_type_id tech);
221 const QPixmap *get_building_sprite(const struct tileset *t,
222  const struct impr_type *pimprove);
223 const QPixmap *get_government_sprite(const struct tileset *t,
224  const struct government *gov);
225 const QPixmap *get_unittype_sprite(const struct tileset *t,
226  const struct unit_type *punittype,
227  enum direction8 facing,
228  const QColor &replace = QColor());
229 const QPixmap *get_sample_city_sprite(const struct tileset *t,
230  int style_idx);
231 const QPixmap *get_tax_sprite(const struct tileset *t, Output_type_id otype);
232 const QPixmap *get_treaty_thumb_sprite(const struct tileset *t, bool on_off);
233 const std::vector<QPixmap *> &
234 get_unit_explode_animation(const struct tileset *t);
235 const QPixmap *get_nuke_explode_sprite(const struct tileset *t);
236 const QPixmap *get_cursor_sprite(const struct tileset *t,
237  enum cursor_type cursor, int *hot_x,
238  int *hot_y, int frame);
239 const struct citybar_sprites *get_citybar_sprites(const struct tileset *t);
240 const struct editor_sprites *get_editor_sprites(const struct tileset *t);
241 const QPixmap *get_attention_crosshair_sprite(const struct tileset *t);
242 const QPixmap *get_indicator_sprite(const struct tileset *t,
243  enum indicator_type indicator,
244  int index);
245 const QPixmap *get_unit_unhappy_sprite(const struct tileset *t,
246  const struct unit *punit,
247  int happy_cost);
248 const QPixmap *get_unit_upkeep_sprite(const struct tileset *t,
249  Output_type_id otype,
250  const struct unit *punit,
251  const int *upkeep_cost);
252 std::vector<drawn_sprite>
253 fill_basic_extra_sprite_array(const struct tileset *t,
254  const struct extra_type *pextra);
255 
256 bool is_extra_drawing_enabled(const extra_type *pextra);
257 const QPixmap *get_event_sprite(const struct tileset *t,
258  enum event_type event);
259 const QPixmap *get_dither_sprite(const struct tileset *t);
260 const QPixmap *get_mask_sprite(const struct tileset *t);
261 
262 QPixmap *tiles_lookup_sprite_tag_alt(struct tileset *t, QtMsgType level,
263  const char *tag, const char *alt,
264  const char *what, const char *name,
265  bool scale);
266 
267 struct color_system;
268 struct color_system *get_color_system(const struct tileset *t);
269 
270 // Tileset accessor functions.
271 struct tileset *get_tileset();
272 const char *tileset_basename(const struct tileset *t);
273 bool tileset_is_isometric(const struct tileset *t);
274 int tileset_hex_width(const struct tileset *t);
275 int tileset_hex_height(const struct tileset *t);
276 int tileset_tile_width(const struct tileset *t);
277 int tileset_tile_height(const struct tileset *t);
278 int tileset_full_tile_width(const struct tileset *t);
279 int tileset_full_tile_height(const struct tileset *t);
280 QPoint tileset_full_tile_offset(const struct tileset *t);
281 int tileset_unit_width(const struct tileset *t);
282 int tileset_unit_height(const struct tileset *t);
283 int tileset_unit_with_upkeep_height(const struct tileset *t);
284 int tileset_unit_layout_offset_y(const struct tileset *t);
285 int tileset_small_sprite_width(const struct tileset *t);
286 int tileset_small_sprite_height(const struct tileset *t);
287 int tileset_citybar_offset_y(const struct tileset *t);
288 int tileset_tilelabel_offset_y(const struct tileset *t);
289 bool tileset_use_hard_coded_fog(const struct tileset *t);
290 double tileset_preferred_scale(const struct tileset *t);
291 int tileset_replaced_hue(const struct tileset *t);
292 
293 int tileset_num_cardinal_dirs(const struct tileset *t);
294 int tileset_num_index_cardinals(const struct tileset *t);
295 std::array<direction8, 8> tileset_cardinal_dirs(const struct tileset *t);
296 int tileset_num_valid_dirs(const struct tileset *t);
297 std::array<direction8, 8> tileset_valid_dirs(const struct tileset *t);
298 QString cardinal_index_str(const struct tileset *t, int idx);
299 QString valid_index_str(const struct tileset *t, int idx);
300 QString dir_get_tileset_name(enum direction8 dir);
301 bool is_cardinal_tileset_dir(const struct tileset *t, enum direction8 dir);
302 
303 /* These are used as array index -> can't be changed freely to values
304  bigger than size of those arrays. */
305 #define TS_TOPO_SQUARE 0
306 #define TS_TOPO_HEX 1
307 #define TS_TOPO_ISOHEX 2
308 
309 const char *tileset_name_get(const struct tileset *t);
310 const char *tileset_version(const struct tileset *t);
311 const char *tileset_summary(const struct tileset *t);
312 const char *tileset_description(const struct tileset *t);
313 int tileset_topo_index(const struct tileset *t);
314 help_item *tileset_help(const struct tileset *t);
citizen_category
Definition: city.h:239
enum event_type event
Definition: events.cpp:68
int Tech_type_id
Definition: fc_types.h:294
int Specialist_type_id
Definition: fc_types.h:292
enum output_type_id Output_type_id
Definition: fc_types.h:295
const char * name
Definition: inputfile.cpp:118
#define NUM_TILES_DIGITS
Definition: layer.h:78
Definition: path.cpp:10
struct setting_list * level[OLEVELS_NUM]
Definition: settings.cpp:167
Definition: tech.h:113
Definition: base.h:43
Definition: city.h:291
QPixmap * trade
Definition: tilespec.h:190
QPixmap * occupied
Definition: tilespec.h:190
std::vector< QPixmap * > occupancy
Definition: tilespec.h:191
QPixmap * shields
Definition: tilespec.h:190
QPixmap * food
Definition: tilespec.h:190
QPixmap * background
Definition: tilespec.h:190
QPixmap * vision
Definition: tilespec.h:196
QPixmap * terrain
Definition: tilespec.h:195
QPixmap * properties
Definition: tilespec.h:197
QPixmap * copy
Definition: tilespec.h:195
QPixmap * copypaste
Definition: tilespec.h:195
QPixmap * unit
Definition: tilespec.h:196
QPixmap * brush
Definition: tilespec.h:195
QPixmap * paste
Definition: tilespec.h:195
QPixmap * road
Definition: tilespec.h:197
QPixmap * terrain_resource
Definition: tilespec.h:196
QPixmap * startpos
Definition: tilespec.h:195
QPixmap * terrain_special
Definition: tilespec.h:196
QPixmap * city
Definition: tilespec.h:196
QPixmap * military_base
Definition: tilespec.h:197
QPixmap * territory
Definition: tilespec.h:196
QPixmap * erase
Definition: tilespec.h:195
The base class for options.
Definition: options.cpp:209
Definition: player.h:231
Definition: tile.h:42
Definition: tilespec.h:56
QtMsgType level
Definition: tilespec.h:57
QString message
Definition: tilespec.h:58
Tileset options allow altering the behavior of a tileset.
Definition: tilespec.h:64
QString description
One-line description for use in the UI (translated)
Definition: tilespec.h:66
bool enabled_by_default
< Current status
Definition: tilespec.h:68
bool enabled
Definition: tilespec.h:67
Definition: unit.h:134
void tileset_load_tiles(struct tileset *t)
Load the tiles; requires tilespec_read_toplevel() called previously.
Definition: tilespec.cpp:2714
const QPixmap * get_nuke_explode_sprite(const struct tileset *t)
Return a sprite contining the single nuke graphic.
Definition: tilespec.cpp:3515
struct tileset * tileset
Definition: tilespec.cpp:276
int tileset_hex_width(const struct tileset *t)
Return the hex_width of the current tileset.
Definition: tilespec.cpp:345
const QPixmap * get_activity_sprite(const struct tileset *t, enum unit_activity activity, extra_type *target)
void tilespec_init()
Initializes the tilespec system.
Definition: tilespec.cpp:709
const char * tileset_name_get(const struct tileset *t)
Return tileset name.
Definition: tilespec.cpp:3828
int tileset_unit_width(const struct tileset *t)
Return the unit tile width of the current tileset.
Definition: tilespec.cpp:426
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...
Definition: tilespec.cpp:3642
int tileset_unit_height(const struct tileset *t)
Return the unit tile height of the current tileset.
Definition: tilespec.cpp:434
indicator_type
Definition: tilespec.h:171
@ INDICATOR_COOLING
Definition: tilespec.h:174
@ INDICATOR_WARMING
Definition: tilespec.h:173
@ INDICATOR_COUNT
Definition: tilespec.h:175
@ INDICATOR_BULB
Definition: tilespec.h:172
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.
Definition: tilespec.cpp:3337
int tileset_num_cardinal_dirs(const struct tileset *t)
Returns the number of cardinal directions used by the tileset.
Definition: tilespec.cpp:554
int tileset_small_sprite_width(const struct tileset *t)
Return the small sprite width of the current tileset.
Definition: tilespec.cpp:495
const freeciv::layer_city * tileset_layer_city(const struct tileset *t)
Returns the layer_city of the tileset.
Definition: tilespec.cpp:3665
const char * tileset_basename(const struct tileset *t)
Return the name of the given tileset.
Definition: tilespec.cpp:331
const char * tileset_summary(const struct tileset *t)
Return tileset description summary.
Definition: tilespec.cpp:3841
direction4
Definition: tilespec.h:51
@ DIR4_EAST
Definition: tilespec.h:51
@ DIR4_NORTH
Definition: tilespec.h:51
@ DIR4_SOUTH
Definition: tilespec.h:51
@ DIR4_WEST
Definition: tilespec.h:51
const std::vector< std::unique_ptr< freeciv::layer > > & tileset_get_layers(const struct tileset *t)
Definition: tilespec.cpp:3700
void tileset_setup_government(struct tileset *t, struct government *gov)
Set government sprite value; should only happen after tilespec_load_tiles().
Definition: tilespec.cpp:3007
std::array< direction8, 8 > tileset_cardinal_dirs(const struct tileset *t)
Returns the cardinal directions used by the tileset.
Definition: tilespec.cpp:574
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...
Definition: tilespec.cpp:3603
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.
Definition: tilespec.cpp:2322
int tileset_full_tile_height(const struct tileset *t)
Return the full tile height of the current tileset.
Definition: tilespec.cpp:407
const QPixmap * get_attention_crosshair_sprite(const struct tileset *t)
Returns a sprite with the "user-attention" crosshair graphic.
Definition: tilespec.cpp:3557
void tileset_setup_specialist_type(struct tileset *t, Specialist_type_id id)
Setup the graphics for specialist types.
Definition: tilespec.cpp:2423
arrow_type
Definition: tilespec.h:48
@ ARROW_LAST
Definition: tilespec.h:48
@ ARROW_MINUS
Definition: tilespec.h:48
@ ARROW_RIGHT
Definition: tilespec.h:48
@ ARROW_PLUS
Definition: tilespec.h:48
bool tilespec_reread(const QString &tileset_name, bool game_fully_initialized)
Read a new tilespec in from scratch.
Definition: tilespec.cpp:916
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: tilespec.cpp:2995
int get_focus_unit_toggle_timeout(const struct tileset *t)
Return the amount of time between calls to toggle_focus_unit_state.
Definition: tilespec.cpp:3200
void tileset_player_init(struct tileset *t, struct player *pplayer)
Setup tiles for one player using the player color.
Definition: tilespec.cpp:3708
int tileset_unit_layout_offset_y(const struct tileset *t)
Offset to layout extra unit sprites, such as upkeep.
Definition: tilespec.cpp:485
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: tilespec.cpp:504
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.
Definition: tilespec.cpp:3116
const QPixmap * get_nation_shield_sprite(const struct tileset *t, const struct nation_type *nation)
Return the shield sprite for the nation.
Definition: tilespec.cpp:3376
bool tileset_has_option(const struct tileset *t, const QString &name)
Checks if the tileset has supports the given user-settable option.
Definition: tilespec.cpp:3780
void tileset_free_tiles(struct tileset *t)
Free all sprites from tileset.
Definition: tilespec.cpp:3285
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: tilespec.cpp:2879
const QPixmap * get_city_flag_sprite(const struct tileset *t, const struct city *pcity)
Return the flag graphic to be used by the city.
Definition: tilespec.cpp:3052
int tileset_topo_index(const struct tileset *t)
Return tileset topology index.
Definition: tilespec.cpp:3854
const QPixmap * get_event_sprite(const struct tileset *t, enum event_type event)
Return event icon sprite.
Definition: tilespec.cpp:3469
QString valid_index_str(const struct tileset *t, int idx)
Do the same thing as cardinal_str, except including all valid directions.
Definition: tilespec.cpp:2251
void tileset_setup_tech_type(struct tileset *t, struct advance *padvance)
Set tech_type sprite value; should only happen after tilespec_load_tiles().
Definition: tilespec.cpp:2895
bool tilespec_try_read(const QString &name, bool verbose, int topo_id)
Read a new tilespec in when first starting the game.
Definition: tilespec.cpp:860
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: tilespec.cpp:3505
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.
Definition: tilespec.cpp:3566
void tileset_free(struct tileset *tileset)
Clean up.
Definition: tilespec.cpp:840
const QPixmap * get_tech_sprite(const struct tileset *t, Tech_type_id tech)
Return the sprite for the technology/advance.
Definition: tilespec.cpp:3385
const struct citybar_sprites * get_citybar_sprites(const struct tileset *t)
Return all the sprites used for city bar drawing.
Definition: tilespec.cpp:3523
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: tilespec.cpp:3679
const QPixmap * get_nation_flag_sprite(const struct tileset *t, const struct nation_type *nation)
Return the sprite for the nation.
Definition: tilespec.cpp:3367
struct color_system * get_color_system(const struct tileset *t)
Return the tileset's color system.
Definition: tilespec.cpp:3622
bool tileset_option_is_enabled(const struct tileset *t, const QString &name)
Checks if an user-settable tileset option is enabled.
Definition: tilespec.cpp:3799
bool tileset_is_isometric(const struct tileset *t)
Return whether the current tileset is isometric.
Definition: tilespec.cpp:336
bool tileset_use_hard_coded_fog(const struct tileset *t)
Return TRUE if the client will use the code to generate the fog.
Definition: tilespec.cpp:531
QPoint tileset_full_tile_offset(const struct tileset *t)
Return the x and y offsets of full tiles in the tileset.
Definition: tilespec.cpp:416
void tileset_setup_city_tiles(struct tileset *t, int style)
Set city tiles sprite values; should only happen after tilespec_load_tiles().
Definition: tilespec.cpp:3188
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.
Definition: tilespec.cpp:3080
const char * tileset_version(const struct tileset *t)
Return tileset version.
Definition: tilespec.cpp:3836
std::map< QString, tileset_option > tileset_get_options(const struct tileset *t)
Gets the user-settable options of the tileset.
Definition: tilespec.cpp:3789
void toggle_focus_unit_state(struct tileset *t)
Toggle/increment the focus unit state.
Definition: tilespec.cpp:3232
int tileset_small_sprite_height(const struct tileset *t)
Return the small sprite height of the current tileset.
Definition: tilespec.cpp:523
void focus_unit_in_combat(struct tileset *t)
Setup tileset for showing combat where focus unit participates.
Definition: tilespec.cpp:3221
const QPixmap * get_mask_sprite(const struct tileset *t)
Return tile mask sprite.
Definition: tilespec.cpp:3486
const QPixmap * get_dither_sprite(const struct tileset *t)
Return dither sprite.
Definition: tilespec.cpp:3478
bool is_cardinal_tileset_dir(const struct tileset *t, enum direction8 dir)
Return TRUE iff the dir is cardinal in this tileset.
Definition: tilespec.cpp:675
QEvent::Type TilesetChanged
An event type sent to all widgets when the current tileset changes.
Definition: tilespec.cpp:719
void tileset_setup_extra(struct tileset *t, struct extra_type *pextra)
Set extra sprite values; should only happen after tilespec_load_tiles().
Definition: tilespec.cpp:2937
bool tileset_is_fully_loaded()
Is tileset in sane state?
Definition: tilespec.cpp:3750
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: tilespec.cpp:3495
void tileset_init(struct tileset *t)
Initialize tileset structure.
Definition: tilespec.cpp:3630
int tileset_tile_height(const struct tileset *t)
Return the tile height of the current tileset.
Definition: tilespec.cpp:383
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).
Definition: tilespec.cpp:3416
bool tileset_set_option(struct tileset *t, const QString &name, bool enabled)
Enable or disable a user-settable tileset option.
Definition: tilespec.cpp:3812
struct tileset * get_tileset()
Returns the tileset.
Definition: tilespec.cpp:326
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.
Definition: tilespec.cpp:2408
int tileset_unit_with_upkeep_height(const struct tileset *t)
Suitable canvas height for a unit icon that includes upkeep sprites.
Definition: tilespec.cpp:473
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: tilespec.cpp:548
const QPixmap * get_government_sprite(const struct tileset *t, const struct government *gov)
Return the sprite for the government.
Definition: tilespec.cpp:3404
int tileset_hex_height(const struct tileset *t)
Return the hex_height of the current tileset.
Definition: tilespec.cpp:351
void reset_focus_unit_state(struct tileset *t)
Reset the focus unit state.
Definition: tilespec.cpp:3213
void tileset_setup_unit_type(struct tileset *t, struct unit_type *punittype)
Set unit_type sprite value; should only happen after tilespec_load_tiles().
Definition: tilespec.cpp:2847
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...
Definition: tilespec.cpp:725
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,...
Definition: tilespec.cpp:2724
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.
Definition: tilespec.cpp:3772
void finish_loading_sprites(struct tileset *t)
Frees any internal buffers which are created by load_sprite.
Definition: tilespec.cpp:2698
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...
Definition: tilespec.cpp:3582
int tileset_num_valid_dirs(const struct tileset *t)
Returns the number of valid directions in the tileset.
Definition: tilespec.cpp:582
void tileset_error(struct tileset *t, QtMsgType level, const char *format,...)
Called when ever there's problem in ruleset/tileset compatibility.
Definition: tilespec.cpp:291
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...
Definition: tilespec.cpp:1063
const char * tileset_description(const struct tileset *t)
Return tileset description body.
Definition: tilespec.cpp:3846
int tileset_full_tile_width(const struct tileset *t)
Return the full tile width of the current tileset.
Definition: tilespec.cpp:394
QString cardinal_index_str(const struct tileset *t, int idx)
Return a directional string for the cardinal directions.
Definition: tilespec.cpp:2233
help_item * tileset_help(const struct tileset *t)
Creates the help item for the given tileset.
Definition: tilespec.cpp:3859
int tileset_num_index_cardinals(const struct tileset *t)
Returns the number of cardinal indices used by the tileset.
Definition: tilespec.cpp:564
const QPixmap * get_spaceship_sprite(const struct tileset *t, enum spaceship_part part)
Return the sprite for drawing the given spaceship part.
Definition: tilespec.cpp:3324
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: tilespec.cpp:3448
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.
Definition: tilespec.cpp:3542
QPixmap * get_unit_nation_flag_sprite(const struct tileset *t, const struct unit *punit)
Return a sprite for the national flag for this unit.
Definition: tilespec.cpp:3061
bool is_extra_drawing_enabled(const extra_type *pextra)
Should the given extra be drawn FIXME: Some extras can not be switched.
Definition: tilespec.cpp:3133
void tilespec_reread_frozen_refresh(const QString &name)
Read a new tilespec in from scratch.
Definition: tilespec.cpp:1091
std::array< direction8, 8 > tileset_valid_dirs(const struct tileset *t)
Returns the valid directions for the tileset.
Definition: tilespec.cpp:592
double tileset_preferred_scale(const struct tileset *t)
Returns the preferred scale (zoom level) of the tileset.
Definition: tilespec.cpp:539
struct unit * get_drawable_unit(const struct tileset *t, const ::tile *ptile)
Find unit that we can display from given tile.
Definition: tilespec.cpp:3246
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: tilespec.cpp:2914
const QPixmap * get_building_sprite(const struct tileset *t, const struct impr_type *pimprove)
Return the sprite for the building/improvement.
Definition: tilespec.cpp:3394
spaceship_part
Definition: tilespec.h:178
@ SPACESHIP_STRUCTURAL
Definition: tilespec.h:182
@ SPACESHIP_HABITATION
Definition: tilespec.h:181
@ SPACESHIP_COUNT
Definition: tilespec.h:186
@ SPACESHIP_EXHAUST
Definition: tilespec.h:185
@ SPACESHIP_FUEL
Definition: tilespec.h:183
@ SPACESHIP_PROPULSION
Definition: tilespec.h:184
@ SPACESHIP_SOLAR_PANEL
Definition: tilespec.h:179
@ SPACESHIP_LIFE_SUPPORT
Definition: tilespec.h:180
QString dir_get_tileset_name(enum direction8 dir)
Return the tileset name of the direction.
Definition: tilespec.cpp:613
bool tileset_has_error(const struct tileset *t)
Checks if the tileset had any error message (LOG_ERROR).
Definition: tilespec.cpp:3763
int tileset_tile_width(const struct tileset *t)
Return the tile width of the current tileset.
Definition: tilespec.cpp:371
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: tilespec.cpp:513
const struct editor_sprites * get_editor_sprites(const struct tileset *t)
Return all the sprites used for editor icons, images, etc.
Definition: tilespec.cpp:3531
constexpr direction8 DIR4_TO_DIR8[4]
Definition: tilespec.h:53
std::vector< tileset_log_entry > tileset_log(const struct tileset *t)
Get tileset log (warnings, errors, etc.)
Definition: tilespec.cpp:3755
cursor_type
Definition: tilespec.h:154
@ CURSOR_GOTO
Definition: tilespec.h:155
@ CURSOR_INVALID
Definition: tilespec.h:160
@ CURSOR_PATROL
Definition: tilespec.h:156
@ CURSOR_WAIT
Definition: tilespec.h:164
@ CURSOR_EDIT_ADD
Definition: tilespec.h:163
@ CURSOR_SELECT
Definition: tilespec.h:159
@ CURSOR_DEFAULT
Definition: tilespec.h:166
@ CURSOR_PARADROP
Definition: tilespec.h:157
@ CURSOR_LAST
Definition: tilespec.h:165
@ CURSOR_NUKE
Definition: tilespec.h:158
@ CURSOR_ATTACK
Definition: tilespec.h:161
@ CURSOR_EDIT_PAINT
Definition: tilespec.h:162
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: tilespec.cpp:3020
void tileset_ruleset_reset(struct tileset *t)
Reset tileset data specific to ruleset.
Definition: tilespec.cpp:3740