From 3f4536a76a711ba3acebdf2fecd9cb45db95816e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Lach?= Date: Thu, 30 Mar 2023 18:45:00 +0200 Subject: [PATCH] =?UTF-8?q?!OSDN:=20#47804:=20S=C5=82awomir=20Lach=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Code to generate help for counter in place diff --git a/client/helpdata.c b/client/helpdata.c index ac69603fde..e9228ff19a 100644 --- a/client/helpdata.c +++ b/client/helpdata.c @@ -35,6 +35,7 @@ #include "support.h" /* common */ +#include "counters.h" #include "effects.h" #include "game.h" #include "government.h" @@ -69,7 +70,7 @@ static const char * const help_type_names[] = { "(Any)", "(Text)", "Units", "Improvements", "Wonders", "Techs", "Terrain", "Extras", "Goods", "Specialists", "Governments", - "Ruleset", "Tileset", "Nations", "Multipliers", NULL + "Ruleset", "Tileset", "Nations", "Multipliers", "Counters", NULL }; #define SPECLIST_TAG help @@ -1106,6 +1107,28 @@ void boot_help_texts(void) help_list_append(help_nodes, pitem); } multipliers_iterate_end; break; + case HELP_COUNTER: + { + int j; + for (j = 0; j < game.control.num_counters; j++) { + struct counter *pcount = counter_by_id(j); + + help_text_buffer[0] = '\0'; + pitem = new_help_item(current_type); + fc_snprintf(name, sizeof(name), "%*s%s", level, "", + counter_name_translation(pcount)); + pitem->topic = fc_strdup(name); + if (pcount->helptext) { + strvec_iterate(pcount->helptext, text) { + cat_snprintf(help_text_buffer, sizeof(help_text_buffer), + "%s%s", "\n\n", text); + } strvec_iterate_end; + } + pitem->text = fc_strdup(help_text_buffer); + help_list_append(help_nodes, pitem); + } + } + break; default: log_error("Bad current_type: %d.", current_type); break; diff --git a/client/include/helpdlg_g.h b/client/include/helpdlg_g.h index e6038ad82f..360cd462d3 100644 --- a/client/include/helpdlg_g.h +++ b/client/include/helpdlg_g.h @@ -21,7 +21,7 @@ enum help_page_type { HELP_ANY, HELP_TEXT, HELP_UNIT, HELP_IMPROVEMENT, HELP_WONDER, HELP_TECH, HELP_TERRAIN, HELP_EXTRA, HELP_GOODS, HELP_SPECIALIST, HELP_GOVERNMENT, HELP_RULESET, HELP_TILESET, HELP_NATIONS, - HELP_MULTIPLIER, HELP_LAST }; + HELP_MULTIPLIER, HELP_COUNTER, HELP_LAST }; GUI_FUNC_PROTO(void, popup_help_dialog_string, const char *item) GUI_FUNC_PROTO(void, popup_help_dialog_typed, const char *item, @@ -56,5 +56,6 @@ GUI_FUNC_PROTO(void, popdown_help_dialog, void) #define HELP_COPYING_ITEM N_("Copying") #define HELP_ABOUT_ITEM N_("About Freeciv") #define HELP_MULTIPLIER_ITEM N_("Policies") +#define HELP_COUNTER_ITEM N_("Counters") #endif /* FC__HELPDLG_G_H */ diff --git a/data/helpdata.txt b/data/helpdata.txt index a6e9d359e8..ce0389e301 100644 --- a/data/helpdata.txt +++ b/data/helpdata.txt @@ -1344,6 +1344,13 @@ expect to lose about 60% of its hit points during the fight, and should \ expect to have no movement points left.\ ") +[help_counters] +name = "Counters" +text = "SAAAASDSWDWWDWD" + +[help_gen_counters] +generate = " Counters" + [help_zones_of_control] name = _("Zones of Control") text = _("\ -- 2.40.1