50#define THEMESPEC_SDL2_CAPSTR "+Freeciv-sdl2-3.3-themespec-Devel-2023-Jun-07 duplicates_ok"
62#define SPEC_SDL2_CAPSTR "+Freeciv-sdl2-3.3-spec-Devel-2023-Jun-10"
69#define THEMESPEC_SUFFIX ".themespec"
83#define SPECLIST_TAG specfile
84#define SPECLIST_TYPE struct specfile
87#define specfile_list_iterate(list, pitem) \
88 TYPED_LIST_ITERATE(struct specfile, list, pitem)
89#define specfile_list_iterate_end LIST_ITERATE_END
112#define SPECLIST_TAG small_sprite
113#define SPECLIST_TYPE struct small_sprite
116#define small_sprite_list_iterate(list, pitem) \
117 TYPED_LIST_ITERATE(struct small_sprite, list, pitem)
118#define small_sprite_list_iterate_end LIST_ITERATE_END
120#define SPECHASH_TAG small_sprite
121#define SPECHASH_IKEY_TYPE char *
122#define SPECHASH_IDATA_TYPE struct small_sprite *
123#define SPECHASH_IKEY_VAL genhash_str_val_func
124#define SPECHASH_IKEY_COMP genhash_str_comp_func
125#define SPECHASH_IKEY_COPY genhash_str_copy_func
126#define SPECHASH_IKEY_FREE genhash_str_free_func
128#define small_sprite_hash_iterate(hash, tag_name, pitem) \
129 TYPED_HASH_ITERATE(const char *, struct small_sprite *, hash, \
131#define small_sprite_hash_iterate_end HASH_ITERATE_END
202 static const char **themes =
NULL;
219 themes[count] =
NULL;
259 const char *filename)
264 log_debug(
"\"%s\": %s file doesn't have capability string",
270 log_debug(
"\"%s\": %s file appears incompatible:", filename,
which);
278 log_debug(
"\"%s\": %s file requires option(s)"
279 " that client doesn't support:", filename,
which);
353 log_fatal(
_(
"No usable default theme found, aborting!"));
410 "Failed to re-read the currently loaded theme.");
513 log_fatal(
"Could not load gfx file for the spec file \"%s\".",
554 if (
NULL != sections) {
589 log_error(
"Small sprite \"%s.tiles%d\" invalid: %s",
621 log_error(
"warning: already have a sprite for \"%s\".",
642 const char *filename;
647 "extra.sprites%d.tag",
i))
649 "extra.sprites%d.file",
i))) {
650 log_error(
"Small sprite \"extra.sprites%d\" invalid: %s",
671 log_error(
"warning: already have a sprite for \"%s\".", tags[k]);
709 log_fatal(
"Couldn't find a supported gfx file extension for \"%s\".",
873 log_fatal(
"Couldn't load gfx file \"%s\" for sprite '%s'.",
884 log_error(
"Sprite '%s' in file \"%s\" isn't within the image!",
915 if (
ss->ref_count == 0) {
925#define SET_SPRITE(field, tag) \
927 t->sprites.field = theme_load_sprite(t, tag); \
928 fc_assert_exit_msg(NULL != t->sprites.field, \
929 "Sprite tag '%s' missing.", tag); \
933#define SET_SPRITE_ALT(field, tag, alt) \
935 t->sprites.field = theme_load_sprite(t, tag); \
936 if (!t->sprites.field) { \
937 t->sprites.field = theme_load_sprite(t, alt); \
939 fc_assert_exit_msg(NULL != t->sprites.field, \
940 "Sprite tag '%s' and alternate '%s' are " \
941 "both missing.", tag, alt); \
945#define SET_SPRITE_OPT(field, tag) \
946 t->sprites.field = theme_load_sprite(t, tag)
948#define SET_SPRITE_ALT_OPT(field, tag, alt) \
950 t->sprites.field = theme_lookup_sprite_tag_alt(t, LOG_VERBOSE, tag, alt,\
1002 const char *tag,
const char *alt,
1010 "attempt to lookup for %s \"%s\" before "
1020 log_verbose(
"Using alternate graphic \"%s\" (instead of \"%s\") "
1021 "for %s \"%s\".", alt, tag,
what,
name);
1025 log_base(
level,
"Don't have graphics tags \"%s\" or \"%s\" for %s \"%s\".",
1034#define FULL_TILE_X_OFFSET ((t->normal_tile_width - t->full_tile_width) / 2)
1035#define FULL_TILE_Y_OFFSET (t->normal_tile_height - t->full_tile_height)
1037#define ADD_SPRITE(s, draw_fog, x_offset, y_offset) \
1038 (fc_assert(s != NULL), \
1040 sprs->foggable = (draw_fog && t->fogstyle == FOG_AUTO), \
1041 sprs->offset_x = x_offset, \
1042 sprs->offset_y = y_offset, \
1044#define ADD_SPRITE_SIMPLE(s) ADD_SPRITE(s, TRUE, 0, 0)
1045#define ADD_SPRITE_FULL(s) \
1046 ADD_SPRITE(s, TRUE, FULL_TILE_X_OFFSET, FULL_TILE_Y_OFFSET)
1055 while (
ss->ref_count > 0) {
1088 if (sf->big_sprite) {
1090 sf->big_sprite =
NULL;
bool has_capabilities(const char *us, const char *them)
void generate_citydlg_dimensions(void)
enum client_states client_state(void)
static struct fc_sockaddr_list * list
void popdown_all_game_dialogs(void)
void free_sprite(struct sprite *s)
struct sprite * load_gfxfile(const char *filename, bool svgflag)
const char ** gfx_fileextensions(void)
void tilespec_setup_city_gfx(void)
void tilespec_free_city_icons(void)
void tilespec_setup_theme(void)
void tilespec_free_city_gfx(void)
void tilespec_setup_city_icons(void)
void tilespec_free_theme(void)
struct theme_background_system * theme_background_system_read(struct section_file *file)
void theme_background_system_free(struct theme_background_system *backgrounds)
void theme_color_system_free(struct theme_color_system *colors)
struct theme_color_system * theme_color_system_read(struct section_file *file)
static struct sprite * theme_load_sprite(struct theme *t, const char *tag_name)
void theme_free(struct theme *ftheme)
static bool check_themespec_capabilities(struct section_file *file, const char *which, const char *us_capstr, const char *filename)
#define THEMESPEC_SDL2_CAPSTR
#define specfile_list_iterate_end
static void theme_unload_sprite(struct theme *t, const char *tag_name)
struct theme_color_system * theme_get_color_system(const struct theme *t)
const char * theme_font_filename(const struct theme *t)
char * themespec_gfx_filename(const char *gfx_filename)
#define specfile_list_iterate(list, pitem)
static void theme_finish_loading_sprites(struct theme *t)
static void theme_ensure_big_sprite(struct specfile *sf)
static void theme_lookup_sprite_tags(struct theme *t)
#define small_sprite_list_iterate_end
#define small_sprite_list_iterate(list, pitem)
static void theme_free_toplevel(struct theme *t)
static void scan_specfile(struct theme *t, struct specfile *sf, bool duplicates_ok)
void theme_free_sprites(struct theme *t)
void theme_load_sprites(struct theme *t)
const char ** get_theme_list(void)
struct theme_background_system * theme_get_background_system(const struct theme *t)
void themespec_try_read(const char *theme_name)
struct sprite * theme_lookup_sprite_tag_alt(struct theme *t, enum log_level level, const char *tag, const char *alt, const char *what, const char *name)
const char * theme_get_name(const struct theme *t)
struct theme * theme_read_toplevel(const char *theme_name)
#define small_sprite_hash_iterate(hash, tag_name, pitem)
int theme_default_font_size(const struct theme *t)
#define small_sprite_hash_iterate_end
void themespec_reread(const char *new_theme_name)
struct theme * active_theme
static char * themespec_fullname(const char *theme_name)
static void theme_unload_all_sprites(struct theme *t)
static struct theme * theme_new(void)
static struct sprite * load_sdl2_gfx_file(const char *gfx_filename)
#define fc_assert_ret(condition)
#define fc_assert_exit_msg(condition, message,...)
#define log_verbose(message,...)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define log_fatal(message,...)
#define fc_assert_action(condition, action)
#define log_debug(message,...)
#define log_normal(message,...)
#define log_base(level, message,...)
#define log_error(message,...)
#define fc_assert_ret_val_msg(condition, val, message,...)
void update_map_canvas_visible(void)
struct tile * get_center_tile_mapcanvas(void)
void center_tile_mapcanvas(const struct tile *ptile)
const struct tile * center_tile
#define fc_calloc(n, esz)
struct section_file * secfile_load(const char *filename, bool allow_duplicates)
const char * secfile_error(void)
const char * section_name(const struct section *psection)
void secfile_destroy(struct section_file *secfile)
void secfile_check_unused(const struct section_file *secfile)
bool secfile_lookup_int(const struct section_file *secfile, int *ival, const char *path,...)
struct section_list * secfile_sections_by_name_prefix(const struct section_file *secfile, const char *prefix)
const char ** secfile_lookup_str_vec(const struct section_file *secfile, size_t *dim, const char *path,...)
struct entry * secfile_entry_lookup(const struct section_file *secfile, const char *path,...)
const char * secfile_lookup_str(const struct section_file *secfile, const char *path,...)
int secfile_lookup_int_default(const struct section_file *secfile, int def, const char *path,...)
struct entry * secfile_entry_by_path(const struct section_file *secfile, const char *path)
const char * secfile_lookup_str_default(const struct section_file *secfile, const char *def, const char *path,...)
#define section_list_iterate(seclist, psection)
#define section_list_iterate_end
struct setting_list * level[OLEVELS_NUM]
const char * fileinfoname(const struct strvec *dirs, const char *filename)
struct strvec * fileinfolist(const struct strvec *dirs, const char *suffix)
const char * setup_langname(void)
const struct strvec * get_data_dirs(void)
struct sprite int int int int struct sprite int int float bool smooth get_sprite_dimensions
void strvec_destroy(struct strvec *psv)
size_t strvec_size(const struct strvec *psv)
#define strvec_iterate(psv, str)
#define strvec_iterate_end
struct sprite * big_sprite
struct small_sprite_hash * sprite_hash
struct small_sprite_list * small_sprites
struct theme_color_system * color_system
struct specfile_list * specfiles
struct theme_background_system * background_system
int fc_snprintf(char *str, size_t n, const char *format,...)
#define sz_strlcpy(dest, src)
#define sprite_vector_iterate_end
#define sprite_vector_iterate(sprite_vec, psprite)