From d1e63d11141bea7213b357fa82b0e813fc785e98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Lach?= <slawek@lach.art.pl>
Date: Thu, 30 Mar 2023 18:45:00 +0200
Subject: [PATCH 3/3] =?UTF-8?q?!OSDN:=20TICKET=20#47697:=20S=C5=82awomir?=
 =?UTF-8?q?=20Lach=20<slawek@lach.art.pl>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Helptext of counters are available in manual

diff --git a/client/helpdata.c b/client/helpdata.c
index 02b4364862..7dc7fab50a 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
@@ -1080,6 +1081,28 @@ void boot_help_texts(void)
               help_list_append(help_nodes, pitem);
             } multipliers_iterate_end;
             break;
+          case HELP_COUNTER:
+            {
+              int i;
+              for (i = 0; i < game.control.num_counters; i++) {
+                struct counter *pcount = counter_by_id(i);
+
+                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 fb264b8d62..3a51297c87 100644
--- a/data/helpdata.txt
+++ b/data/helpdata.txt
@@ -1345,6 +1345,16 @@ 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 = _("Counter are currently hard-coded entity, which value could been \
+tested to fire various possibilities, like allowing to build unit, or to \
+enabling effect (reduce/increase production), etc. Currently only city\
+counters are supported.")
+
+[help_gen_counters]
+generate = " Counters"
+
 [help_zones_of_control]
 name = _("Zones of Control")
 text = _("\
-- 
2.40.0

