From 6ea1797232680c62685b2ebc44607e4cb7f32a4d Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 4 Feb 2023 07:11:38 +0200 Subject: [PATCH 28/28] Add tileset name to Tileset Error dialog Reported by VulcanScout See osdn #46558 Signed-off-by: Marko Lindqvist --- client/gui-gtk-3.22/dialogs.c | 20 +++-- client/gui-gtk-3.22/tileset_dlg.c | 4 +- client/gui-gtk-4.0/dialogs.c | 20 +++-- client/gui-gtk-4.0/tileset_dlg.c | 4 +- client/gui-qt/dialogs.cpp | 18 ++-- client/gui-sdl2/dialogs.c | 2 +- client/gui-stub/dialogs.c | 2 +- client/include/dialogs_g.h | 6 +- client/packhand.c | 3 +- client/tilespec.c | 131 +++++++++++++++++++----------- client/tilespec.h | 3 +- 11 files changed, 137 insertions(+), 76 deletions(-) diff --git a/client/gui-gtk-3.22/dialogs.c b/client/gui-gtk-3.22/dialogs.c index d372c9257f..2d8975cc65 100644 --- a/client/gui-gtk-3.22/dialogs.c +++ b/client/gui-gtk-3.22/dialogs.c @@ -1536,15 +1536,25 @@ void show_tech_gained_dialog(Tech_type_id tech) Show tileset error dialog. It's blocking as client will shutdown as soon as this function returns. **************************************************************************/ -void show_tileset_error(const char *msg) +void show_tileset_error(const char *tset_name, const char *msg) { if (is_gui_up()) { GtkWidget *dialog; - dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - _("Tileset problem, it's probably incompatible with the ruleset:\n%s"), - msg); + if (tset_name != NULL) { + dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("Tileset \"%s\" problem, " + "it's probably incompatible with the ruleset:\n%s"), + tset_name, msg); + } else { + dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("Tileset problem, " + "it's probably incompatible with the ruleset:\n%s"), + msg); + } + setup_dialog(dialog, toplevel); gtk_dialog_run(GTK_DIALOG(dialog)); diff --git a/client/gui-gtk-3.22/tileset_dlg.c b/client/gui-gtk-3.22/tileset_dlg.c index 5497b81552..95cd9629b9 100644 --- a/client/gui-gtk-3.22/tileset_dlg.c +++ b/client/gui-gtk-3.22/tileset_dlg.c @@ -45,8 +45,8 @@ static void tileset_suggestion_callback(GtkWidget *dlg, gint arg) /* User accepted tileset loading */ sz_strlcpy(forced_tileset_name, game.control.preferred_tileset); if (!tilespec_reread(game.control.preferred_tileset, TRUE, 1.0)) { - tileset_error(LOG_ERROR, _("Can't load requested tileset %s."), - game.control.preferred_tileset); + tileset_error(LOG_ERROR, game.control.preferred_tileset, + _("Can't load requested tileset.")); } } } diff --git a/client/gui-gtk-4.0/dialogs.c b/client/gui-gtk-4.0/dialogs.c index bb15b0f466..2dcdd23b74 100644 --- a/client/gui-gtk-4.0/dialogs.c +++ b/client/gui-gtk-4.0/dialogs.c @@ -1561,15 +1561,25 @@ void show_tech_gained_dialog(Tech_type_id tech) Show tileset error dialog. It's blocking as client will shutdown as soon as this function returns. **************************************************************************/ -void show_tileset_error(const char *msg) +void show_tileset_error(const char *tset_name, const char *msg) { if (is_gui_up()) { GtkWidget *dialog; - dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - _("Tileset problem, it's probably incompatible with the ruleset:\n%s"), - msg); + if (tset_name != NULL) { + dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("Tileset \"%s\" problem, " + "it's probably incompatible with the ruleset:\n%s"), + tset_name, msg); + } else { + dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("Tileset problem, " + "it's probably incompatible with the ruleset:\n%s"), + msg); + } + setup_dialog(dialog, toplevel); blocking_dialog(dialog); diff --git a/client/gui-gtk-4.0/tileset_dlg.c b/client/gui-gtk-4.0/tileset_dlg.c index af6eb8eb78..3fd3093f8a 100644 --- a/client/gui-gtk-4.0/tileset_dlg.c +++ b/client/gui-gtk-4.0/tileset_dlg.c @@ -44,8 +44,8 @@ static void tileset_suggestion_response(gint arg) /* User accepted tileset loading */ sz_strlcpy(forced_tileset_name, game.control.preferred_tileset); if (!tilespec_reread(game.control.preferred_tileset, TRUE, 1.0)) { - tileset_error(LOG_ERROR, _("Can't load requested tileset %s."), - game.control.preferred_tileset); + tileset_error(LOG_ERROR, game.control.preferred_tileset, + _("Can't load requested tileset.")); } } } diff --git a/client/gui-qt/dialogs.cpp b/client/gui-qt/dialogs.cpp index 37cd0bcfdc..d7cfe01435 100644 --- a/client/gui-qt/dialogs.cpp +++ b/client/gui-qt/dialogs.cpp @@ -3996,8 +3996,8 @@ void popup_tileset_suggestion_dialog(void) sz_strlcpy(forced_tileset_name, game.control.preferred_tileset); if (!tilespec_reread(game.control.preferred_tileset, true, gui()->map_scale)) { - tileset_error(LOG_ERROR, _("Can't load requested tileset %s."), - game.control.preferred_tileset); + tileset_error(LOG_ERROR, game.control.preferred_tileset, + _("Can't load requested tileset.")); } }); ask->show(); @@ -4347,13 +4347,19 @@ void show_tech_gained_dialog(Tech_type_id tech) /***********************************************************************//** Show tileset error dialog. ***************************************************************************/ -void show_tileset_error(const char *msg) +void show_tileset_error(const char *tset_name, const char *msg) { char buf[1024]; - fc_snprintf(buf, sizeof(buf), - _("Tileset problem, it's probably incompatible with the" - " ruleset:\n%s"), msg); + if (tset_name != NULL) { + fc_snprintf(buf, sizeof(buf), + _("Tileset \"%s\" problem, it's probably incompatible with the" + " ruleset:\n%s"), tset_name, msg); + } else { + fc_snprintf(buf, sizeof(buf), + _("Tileset problem, it's probably incompatible with the" + " ruleset:\n%s"), msg); + } if (QCoreApplication::instance() != nullptr) { QMessageBox *ask = new QMessageBox(gui()->central_wdg); diff --git a/client/gui-sdl2/dialogs.c b/client/gui-sdl2/dialogs.c index 92587b7140..5515f8ff01 100644 --- a/client/gui-sdl2/dialogs.c +++ b/client/gui-sdl2/dialogs.c @@ -3637,7 +3637,7 @@ void show_tech_gained_dialog(Tech_type_id tech) /**********************************************************************//** Show tileset error dialog. **************************************************************************/ -void show_tileset_error(const char *msg) +void show_tileset_error(const char *tset_name, const char *msg) { /* PORTME */ } diff --git a/client/gui-stub/dialogs.c b/client/gui-stub/dialogs.c index f1bfd18c0f..00545fbab3 100644 --- a/client/gui-stub/dialogs.c +++ b/client/gui-stub/dialogs.c @@ -331,7 +331,7 @@ void show_tech_gained_dialog(Tech_type_id tech) /**********************************************************************//** Show tileset error dialog. **************************************************************************/ -void show_tileset_error(const char *msg) +void show_tileset_error(const char *tset_name, const char *msg) { /* PORTME */ } diff --git a/client/include/dialogs_g.h b/client/include/dialogs_g.h index dacb0409c7..45534b95d2 100644 --- a/client/include/dialogs_g.h +++ b/client/include/dialogs_g.h @@ -20,8 +20,8 @@ #include "actions.h" #include "fc_types.h" #include "featured_text.h" /* struct text_tag_list */ -#include "nation.h" /* Nation_type_id */ -#include "terrain.h" /* enum tile_special_type */ +#include "nation.h" /* Nation_type_id */ +#include "terrain.h" /* enum tile_special_type */ #include "unitlist.h" /* client */ @@ -81,7 +81,7 @@ GUI_FUNC_PROTO(void, popup_soundset_suggestion_dialog, void) GUI_FUNC_PROTO(void, popup_musicset_suggestion_dialog, void) GUI_FUNC_PROTO(bool, popup_theme_suggestion_dialog, const char *theme_name) GUI_FUNC_PROTO(void, show_tech_gained_dialog, Tech_type_id tech) -GUI_FUNC_PROTO(void, show_tileset_error, const char *msg) +GUI_FUNC_PROTO(void, show_tileset_error, const char *tset_name, const char *msg) GUI_FUNC_PROTO(bool, handmade_scenario_warning, void) GUI_FUNC_PROTO(void, popdown_all_game_dialogs, void) diff --git a/client/packhand.c b/client/packhand.c index 3349c019c1..b40a0f52b8 100644 --- a/client/packhand.c +++ b/client/packhand.c @@ -2208,7 +2208,8 @@ void handle_map_info(const struct packet_map_info *packet) wld.map.south_latitude = packet->south_latitude; if (tileset_map_topo_compatible(packet->topology_id, tileset, &ts_topo) == TOPO_INCOMP_HARD) { - tileset_error(LOG_NORMAL, _("Map topology (%s) and tileset (%s) incompatible."), + tileset_error(LOG_NORMAL, tileset_name_get(tileset), + _("Map topology (%s) and tileset (%s) incompatible."), describe_topology(packet->topology_id), describe_topology(ts_topo)); } diff --git a/client/tilespec.c b/client/tilespec.c index b59a8428ec..4e53d06bef 100644 --- a/client/tilespec.c +++ b/client/tilespec.c @@ -613,7 +613,8 @@ static void tileset_setup_citizen_types(struct tileset *t, /************************************************************************//** Called when ever there's problem in ruleset/tileset compatibility ****************************************************************************/ -void tileset_error(enum log_level level, const char *format, ...) +void tileset_error(enum log_level level, const char *tset_name, + const char *format, ...) { char buf[2048]; va_list args; @@ -625,7 +626,7 @@ void tileset_error(enum log_level level, const char *format, ...) log_base(level, "%s", buf); if (level <= LOG_NORMAL) { - show_tileset_error(buf); + show_tileset_error(tset_name, buf); } if (level == LOG_FATAL) { @@ -1295,8 +1296,8 @@ bool tilespec_try_read(const char *tileset_name, bool verbose, int topo_id, } strvec_iterate_end; strvec_destroy(list); - if (!tileset) { - tileset_error(LOG_FATAL, _("No usable default tileset found, aborting!")); + if (tileset == NULL) { + tileset_error(LOG_FATAL, NULL, _("No usable default tileset found, aborting!")); } log_verbose("Trying tileset \"%s\".", tileset->name); @@ -1416,7 +1417,8 @@ bool tilespec_reread(const char *new_tileset_name, if (tileset_map_topo_compatible(wld.map.topology_id, tileset, &ts_topo) == TOPO_INCOMP_HARD) { - tileset_error(LOG_NORMAL,_("Map topology (%s) and tileset (%s) incompatible."), + tileset_error(LOG_NORMAL, tileset_name, + _("Map topology (%s) and tileset (%s) incompatible."), describe_topology(wld.map.topology_id), describe_topology(ts_topo)); } @@ -1560,7 +1562,7 @@ static struct sprite *load_gfx_file(const char *gfx_filename, bool flag) /************************************************************************//** Ensure that the big sprite of the given spec file is loaded. ****************************************************************************/ -static void ensure_big_sprite(struct specfile *sf) +static void ensure_big_sprite(struct specfile *sf, const char *tset_name) { struct section_file *file; const char *gfx_filename; @@ -1574,12 +1576,14 @@ static void ensure_big_sprite(struct specfile *sf) * to be reloaded, but most of the time it's just loaded once, the small * sprites are extracted, and then it's freed. */ if (!(file = secfile_load(sf->file_name, TRUE))) { - tileset_error(LOG_FATAL, _("Could not open '%s':\n%s"), sf->file_name, secfile_error()); + tileset_error(LOG_FATAL, tset_name, + _("Could not open '%s':\n%s"), sf->file_name, secfile_error()); } if (!check_tilespec_capabilities(file, "spec", SPEC_CAPSTR, sf->file_name, TRUE)) { - tileset_error(LOG_FATAL, _("Incompatible tileset capabilities")); + tileset_error(LOG_FATAL, tset_name, + _("Specfile %s has incompatible capabilities"), sf->file_name); } gfx_filename = secfile_lookup_str(file, "file.gfx"); @@ -1587,7 +1591,8 @@ static void ensure_big_sprite(struct specfile *sf) sf->big_sprite = load_gfx_file(gfx_filename, FALSE); if (!sf->big_sprite) { - tileset_error(LOG_FATAL, _("Could not load gfx file for the spec file \"%s\"."), + tileset_error(LOG_FATAL, tset_name, + _("Could not load gfx file for the spec file \"%s\"."), sf->file_name); } secfile_destroy(file); @@ -1606,11 +1611,13 @@ static void scan_specfile(struct tileset *t, struct specfile *sf, int i; if (!(file = secfile_load(sf->file_name, TRUE))) { - tileset_error(LOG_FATAL, _("Could not open '%s':\n%s"), sf->file_name, secfile_error()); + tileset_error(LOG_FATAL, tileset_name_get(t), + _("Could not open '%s':\n%s"), sf->file_name, secfile_error()); } if (!check_tilespec_capabilities(file, "spec", SPEC_CAPSTR, sf->file_name, TRUE)) { - tileset_error(LOG_FATAL, _("Specfile %s has incompatible capabilities"), sf->file_name); + tileset_error(LOG_FATAL, tileset_name_get(t), + _("Specfile %s has incompatible capabilities"), sf->file_name); } /* Currently unused */ @@ -1761,7 +1768,8 @@ static void scan_specfile(struct tileset *t, struct specfile *sf, Returns the correct name of the gfx file (with path and extension) Must be free'd when no longer used ****************************************************************************/ -static char *tilespec_gfx_filename(const char *gfx_filename) +static char *tilespec_gfx_filename(const char *gfx_filename, + const char *tset_name) { const char *gfx_current_fileext; const char **gfx_fileexts = gfx_fileextensions(); @@ -1781,7 +1789,8 @@ static char *tilespec_gfx_filename(const char *gfx_filename) } } - tileset_error(LOG_FATAL, _("Couldn't find a supported gfx file extension for \"%s\"."), + tileset_error(LOG_FATAL, tset_name, + _("Couldn't find a supported gfx file extension for \"%s\"."), gfx_filename); return NULL; @@ -2207,8 +2216,8 @@ static struct tileset *tileset_read_toplevel(const char *tileset_name, dir = dir_by_tileset_name(c); if (!direction8_is_valid(dir)) { - tileset_error(LOG_ERROR, "Tileset \"%s\": unknown " - "unit_default_orientation \"%s\"", t->name, c); + tileset_error(LOG_ERROR, tileset_name, + _("Unknown unit_default_orientation \"%s\""), c); goto ON_ERROR; } else { /* Default orientation is allowed to not be a valid one for the @@ -2218,7 +2227,7 @@ static struct tileset *tileset_read_toplevel(const char *tileset_name, } c = secfile_lookup_str(file, "tilespec.main_intro_file"); - t->main_intro_filename = tilespec_gfx_filename(c); + t->main_intro_filename = tilespec_gfx_filename(c, tileset_name_get(t)); log_debug("intro file %s", t->main_intro_filename); /* Layer order */ @@ -2288,8 +2297,9 @@ static struct tileset *tileset_read_toplevel(const char *tileset_name, for (k = 0; k < j; k++) { if (tslp->match_types[k][0] == tslp->match_types[j][0]) { - tileset_error(LOG_FATAL, _("[layer%d] match_types: \"%s\" initial " - "('%c') is not unique."), + tileset_error(LOG_FATAL, tileset_name, + _("[layer%d] match_types: \"%s\" initial " + "('%c') is not unique."), i, tslp->match_types[j], tslp->match_types[j][0]); /* FIXME: Returns NULL. */ } @@ -2300,8 +2310,9 @@ static struct tileset *tileset_read_toplevel(const char *tileset_name, /* Tile drawing info. */ sections = secfile_sections_by_name_prefix(file, TILE_SECTION_PREFIX); if (NULL == sections || 0 == section_list_size(sections)) { - tileset_error(LOG_ERROR, _("No [%s] sections supported by tileset \"%s\"."), - TILE_SECTION_PREFIX, fname); + tileset_error(LOG_ERROR, tileset_name, + _("No [%s] sections supported."), + TILE_SECTION_PREFIX); goto ON_ERROR; } @@ -2667,17 +2678,19 @@ static struct sprite *load_sprite(struct tileset *t, const char *tag_name, ss->sprite = load_gfx_file(ss->file, flag); } if (!ss->sprite) { - tileset_error(LOG_FATAL, _("Couldn't load gfx file \"%s\" for sprite '%s'."), + tileset_error(LOG_FATAL, tileset_name_get(t), + _("Couldn't load gfx file \"%s\" for sprite '%s'."), ss->file, tag_name); } } else { int sf_w, sf_h; - ensure_big_sprite(ss->sf); + ensure_big_sprite(ss->sf, tileset_name_get(t)); get_sprite_dimensions(ss->sf->big_sprite, &sf_w, &sf_h); if (ss->x < 0 || ss->x + ss->width > sf_w || ss->y < 0 || ss->y + ss->height > sf_h) { - tileset_error(LOG_ERROR, _("Sprite '%s' in file \"%s\" isn't within the image!"), + tileset_error(LOG_ERROR, tileset_name_get(t), + _("Sprite '%s' in file \"%s\" isn't within the image!"), tag_name, ss->sf->file_name); return NULL; } @@ -2754,7 +2767,8 @@ static bool sprite_exists(const struct tileset *t, const char *tag_name) do { \ t->sprites.field = load_sprite(t, tag, TRUE, TRUE, FALSE); \ if (t->sprites.field == NULL) { \ - tileset_error(LOG_FATAL, _("Sprite for tag '%s' missing."), tag); \ + tileset_error(LOG_FATAL, tileset_name_get(t), \ + _("Sprite for tag '%s' missing."), tag); \ } \ } while (FALSE) @@ -2763,7 +2777,8 @@ static bool sprite_exists(const struct tileset *t, const char *tag_name) do { \ t->sprites.field = load_sprite(t, tag, TRUE, FALSE, FALSE); \ if (t->sprites.field == NULL) { \ - tileset_error(LOG_FATAL, _("Sprite for tag '%s' missing."), tag); \ + tileset_error(LOG_FATAL, tileset_name_get(t), \ + _("Sprite for tag '%s' missing."), tag); \ } \ } while (FALSE) @@ -2771,7 +2786,8 @@ static bool sprite_exists(const struct tileset *t, const char *tag_name) do { \ t->sprites.field = load_sprite(t, tag, FALSE, FALSE, FALSE); \ if (t->sprites.field == NULL) { \ - tileset_error(LOG_FATAL, _("Sprite for tag '%s' missing."), tag); \ + tileset_error(LOG_FATAL, tileset_name_get(t), \ + _("Sprite for tag '%s' missing."), tag); \ } \ } while (FALSE) @@ -2783,8 +2799,9 @@ static bool sprite_exists(const struct tileset *t, const char *tag_name) t->sprites.field = load_sprite(t, alt, TRUE, TRUE, FALSE); \ } \ if (t->sprites.field == NULL) { \ - tileset_error(LOG_FATAL, _("Sprite for tags '%s' and alternate '%s' are " \ - "both missing."), tag, alt); \ + tileset_error(LOG_FATAL, tileset_name_get(t), \ + _("Sprite for tags '%s' and alternate '%s' are " \ + "both missing."), tag, alt); \ } \ } while (FALSE) @@ -2886,7 +2903,8 @@ static void tileset_setup_specialist_type(struct tileset *t, if (j == 0 && required) { /* TRANS: First %s is a graphics tag of the specialist, second one * is a citizen set name; 'citizen_graphic' from styles.ruleset */ - tileset_error(LOG_FATAL, _("No graphics for specialist \"%s\" in %s."), + tileset_error(LOG_FATAL, tileset_name_get(t), + _("No graphics for specialist \"%s\" in %s."), tag, set_name); } } @@ -2931,7 +2949,8 @@ static void tileset_setup_citizen_types(struct tileset *t, if (j == 0 && required) { /* TRANS: First %s is type of the citizen ("happy" ... "angry"), second one * is a citizen set name; 'citizen_graphic' from styles.ruleset */ - tileset_error(LOG_FATAL, _("No graphics for citizen \"%s\" in %s."), + tileset_error(LOG_FATAL, tileset_name_get(t), + _("No graphics for citizen \"%s\" in %s."), name, set_name); } } @@ -3229,7 +3248,8 @@ static void tileset_lookup_sprite_tags(struct tileset *t) sprite_vector_append(&t->sprites.citybar.occupancy, sprite); } if (t->sprites.citybar.occupancy.size < 2) { - tileset_error(LOG_FATAL, _("Missing necessary citybar.occupancy_N sprites.")); + tileset_error(LOG_FATAL, tileset_name_get(t), + _("Missing necessary citybar.occupancy_N sprites.")); } #define SET_EDITOR_SPRITE(x) SET_SPRITE(editor.x, "editor." #x) @@ -3351,7 +3371,8 @@ static void tileset_lookup_sprite_tags(struct tileset *t) sprite_vector_append(&t->sprites.colors.overlays, sprite); } if (i == 0) { - tileset_error(LOG_FATAL, _("Missing overlay-color sprite colors.overlay_0.")); + tileset_error(LOG_FATAL, tileset_name_get(t), + _("Missing overlay-color sprite colors.overlay_0.")); } /* Chop up and build the overlay graphics. */ @@ -3425,7 +3446,8 @@ static void tileset_lookup_sprite_tags(struct tileset *t) int offsets[4][2] = {{ntw / 2, 0}, {0, nth / 2}, {ntw / 2, nth / 2}, {0, 0}}; if (!darkness) { - tileset_error(LOG_FATAL, _("Sprite tx.darkness missing.")); + tileset_error(LOG_FATAL, tileset_name_get(t), + _("Sprite tx.darkness missing.")); } for (i = 0; i < 4; i++) { t->sprites.tx.darkness[i] = crop_sprite(darkness, offsets[i][0], @@ -3566,8 +3588,9 @@ struct sprite *tiles_lookup_sprite_tag_alt(struct tileset *t, return sp; } - tileset_error(level, _("Don't have graphics tags \"%s\" or \"%s\" for %s \"%s\"."), - tag, alt, what, name); + tileset_error(level, tileset_name_get(t), + _("Don't have graphics tags \"%s\" or \"%s\" for %s \"%s\"."), + tag, alt, what, name); return NULL; } @@ -3703,14 +3726,16 @@ void tileset_setup_unit_type(struct tileset *t, struct unit_type *ut) if (!tileset_setup_unit_type_from_tag(t, uidx, ut->graphic_str) && !tileset_setup_unit_type_from_tag(t, uidx, ut->graphic_alt)) { - tileset_error(LOG_FATAL, _("Missing %s unit sprite for tags \"%s\" and alternative \"%s\"."), + tileset_error(LOG_FATAL, tileset_name_get(t), + _("Missing %s unit sprite for tags \"%s\" and alternative \"%s\"."), utype_rule_name(ut), ut->graphic_str, ut->graphic_alt); } if (!t->sprites.units.icon[uidx][ACTIVITY_IDLE]) { if (!direction8_is_valid(t->unit_default_orientation)) { - tileset_error(LOG_FATAL, "Unit type %s has no unoriented sprite and " - "tileset has no unit_default_orientation.", + tileset_error(LOG_FATAL, tileset_name_get(t), + _("Unit type %s has no unoriented sprite and " + "tileset has no unit_default_orientation."), utype_rule_name(ut)); } else { /* We're guaranteed to have an oriented sprite corresponding to @@ -3776,7 +3801,8 @@ void tileset_setup_extra(struct tileset *t, if (!estyle_hash_lookup(t->estyle_hash, tag, &extrastyle)) { tag = pextra->graphic_alt; if (!estyle_hash_lookup(t->estyle_hash, tag, &extrastyle)) { - tileset_error(LOG_FATAL, _("No extra style for \"%s\" or \"%s\"."), + tileset_error(LOG_FATAL, tileset_name_get(t), + _("No extra style for \"%s\" or \"%s\"."), pextra->graphic_str, pextra->graphic_alt); } else { @@ -3830,7 +3856,7 @@ void tileset_setup_extra(struct tileset *t, TRUE, TRUE, FALSE); } if (!t->sprites.extras[id].u.cardinals[i]) { - tileset_error(LOG_FATAL, + tileset_error(LOG_FATAL, tileset_name_get(t), _("No cardinal-style graphics \"%s*\" for " "extra \"%s\""), tag, extra_rule_name(pextra)); @@ -3857,7 +3883,8 @@ void tileset_setup_extra(struct tileset *t, TRUE, TRUE, FALSE); } if (t->sprites.extras[id].activity == NULL) { - tileset_error(LOG_FATAL, _("Missing %s building activity sprite for tags \"%s\" and alternatives \"%s\" and \"%s\"."), + tileset_error(LOG_FATAL, tileset_name_get(t), + _("Missing %s building activity sprite for tags \"%s\" and alternatives \"%s\" and \"%s\"."), extra_rule_name(pextra), pextra->activity_gfx, pextra->act_gfx_alt, pextra->act_gfx_alt2); } @@ -3872,7 +3899,8 @@ void tileset_setup_extra(struct tileset *t, t->sprites.extras[id].rmact = load_sprite(t, pextra->rmact_gfx_alt, TRUE, TRUE, FALSE); if (t->sprites.extras[id].rmact == NULL) { - tileset_error(LOG_FATAL, _("Missing %s removal activity sprite for tags \"%s\" and alternative \"%s\"."), + tileset_error(LOG_FATAL, tileset_name_get(t), + _("Missing %s removal activity sprite for tags \"%s\" and alternative \"%s\"."), extra_rule_name(pextra), pextra->rmact_gfx, pextra->rmact_gfx_alt); } } @@ -3960,7 +3988,7 @@ static void tileset_setup_road(struct tileset *t, } } else if (extrastyle == ESTYLE_RIVER) { if (!load_river_sprites(t, &t->sprites.extras[id].u.road.ru.rivers, tag)) { - tileset_error(LOG_FATAL, + tileset_error(LOG_FATAL, tileset_name_get(t), _("No river-style graphics \"%s*\" for extra \"%s\""), tag, extra_rule_name(pextra)); } @@ -4019,7 +4047,7 @@ static void tileset_setup_base(struct tileset *t, && t->sprites.extras[id].u.bmf.middleground == NULL && t->sprites.extras[id].u.bmf.foreground == NULL) { /* There was an extra style definition but no matching graphics */ - tileset_error(LOG_FATAL, + tileset_error(LOG_FATAL, tileset_name_get(t), _("No graphics with tag \"%s_bg/mg/fg\" for extra \"%s\""), tag, extra_rule_name(pextra)); } @@ -4039,7 +4067,8 @@ void tileset_setup_tile_type(struct tileset *t, if (!drawing_hash_lookup(t->tile_hash, pterrain->graphic_str, &draw) && !drawing_hash_lookup(t->tile_hash, pterrain->graphic_alt, &draw)) { - tileset_error(LOG_FATAL, _("Terrain \"%s\": no graphic tile \"%s\" or \"%s\"."), + tileset_error(LOG_FATAL, tileset_name_get(t), + _("Terrain \"%s\": no graphic tile \"%s\" or \"%s\"."), terrain_rule_name(pterrain), pterrain->graphic_str, pterrain->graphic_alt); } @@ -4074,7 +4103,8 @@ void tileset_setup_tile_type(struct tileset *t, /* Check for base sprite, allowing missing sprites above base */ if (0 == i && 0 == l) { /* TRANS: 'base' means 'base of terrain gfx', not 'military base' */ - tileset_error(LOG_FATAL, _("Missing base sprite for tag \"%s\"."), buffer); + tileset_error(LOG_FATAL, tileset_name_get(t), + _("Missing base sprite for tag \"%s\"."), buffer); } break; case MATCH_SAME: @@ -4327,7 +4357,8 @@ void tileset_setup_nation_flag(struct tileset *t, } if (!flag || !shield) { /* Should never get here because of the f.unknown fallback. */ - tileset_error(LOG_FATAL, _("Nation %s: no national flag."), nation_rule_name(nation)); + tileset_error(LOG_FATAL, tileset_name_get(t), + _("Nation %s: no national flag."), nation_rule_name(nation)); } sprite_vector_reserve(&t->sprites.nation_flag, nation_count()); @@ -6367,11 +6398,13 @@ void tileset_setup_city_tiles(struct tileset *t, int style) if (style == game.control.num_city_styles - 1) { for (style = 0; style < game.control.num_city_styles; style++) { if (t->sprites.city.tile->styles[style].land_num_thresholds == 0) { - tileset_error(LOG_FATAL, _("City style \"%s\": no city graphics."), + tileset_error(LOG_FATAL, tileset_name_get(t), + _("City style \"%s\": no city graphics."), city_style_rule_name(style)); } if (t->sprites.city.occupied->styles[style].land_num_thresholds == 0) { - tileset_error(LOG_FATAL, _("City style \"%s\": no occupied graphics."), + tileset_error(LOG_FATAL, tileset_name_get(t), + _("City style \"%s\": no occupied graphics."), city_style_rule_name(style)); } } diff --git a/client/tilespec.h b/client/tilespec.h index d88f145f85..2134541745 100644 --- a/client/tilespec.h +++ b/client/tilespec.h @@ -213,7 +213,8 @@ extern struct tileset *unscaled_tileset; struct strvec; const struct strvec *get_tileset_list(const struct option *poption); -void tileset_error(enum log_level level, const char *format, ...); +void tileset_error(enum log_level level, const char *tset_name, + const char *format, ...); void tileset_init(struct tileset *t); void tileset_free(struct tileset *tileset); -- 2.39.1