From cce143f3992371ef0d635b348b8bab50e2fb9670 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 3 May 2025 18:26:07 +0300
Subject: [PATCH 22/22] Rename counter_behaviour as counter_behavior

See RM #1365

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 client/packhand.c              |  4 ++--
 common/counters.h              |  6 +++---
 common/fc_types.h              |  4 ++--
 common/networking/packets.def  |  4 ++--
 server/ruleset.c               |  6 +++---
 tools/ruledit/tab_counters.cpp | 17 +++++++++--------
 tools/ruledit/tab_counters.h   |  2 +-
 tools/ruleutil/rulesave.c      |  2 +-
 8 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/client/packhand.c b/client/packhand.c
index e58aa6fe78..46fb7d41e0 100644
--- a/client/packhand.c
+++ b/client/packhand.c
@@ -5608,11 +5608,11 @@ void handle_ruleset_counter(const struct packet_ruleset_counter *packet)
 
   names_set(&curr->name, NULL, packet->name, packet->rule_name);
   curr->checkpoint = packet->checkpoint;
-  curr->type = packet->behaviour;
+  curr->type = packet->behavior;
   curr->target = packet->type;
   curr->def = packet->def;
 
-  if (!counter_behaviour_is_valid(curr->type)
+  if (!counter_behavior_is_valid(curr->type)
       || curr->target != CTGT_CITY) {
     return;
   }
diff --git a/common/counters.h b/common/counters.h
index f253fe15e8..da45742727 100644
--- a/common/counters.h
+++ b/common/counters.h
@@ -28,13 +28,13 @@ struct counter
   struct name_translation name;
   struct strvec *helptext;
   bool ruledit_disabled;
-  enum counter_behaviour type;
+  enum counter_behavior type;
   enum counter_target target;
   int checkpoint;
-  int def;    /* default value for each entity of given type
+  int def;    /* Default value for each entity of given type
                * for this counter */
 
-  int index;  /* index in specific (city/player/world) array */
+  int index;  /* Index in specific (city/player/world) array */
 };
 
 void counters_init(void);
diff --git a/common/fc_types.h b/common/fc_types.h
index 1a01dc362b..bf8f06afcf 100644
--- a/common/fc_types.h
+++ b/common/fc_types.h
@@ -109,7 +109,7 @@ enum output_type_id {
 
 /* Counters related types. See common/counters.h */
 /* Used in the network protocol. */
-#define SPECENUM_NAME counter_behaviour
+#define SPECENUM_NAME counter_behavior
 #define SPECENUM_VALUE1 CB_CITY_OWNED_TURNS
 #define SPECENUM_VALUE1NAME "Owned"
 #define SPECENUM_VALUE2 CB_CITY_CELEBRATION_TURNS
@@ -121,7 +121,7 @@ enum output_type_id {
 
 
 
-#define SPECENUM_COUNT COUNTER_BEHAVIOUR_LAST
+#define SPECENUM_COUNT COUNTER_BEHAVIOR_LAST
 #include "specenum_gen.h"
 
 /* Used in the network protocol. */
diff --git a/common/networking/packets.def b/common/networking/packets.def
index c666a69d10..26d25e9c13 100644
--- a/common/networking/packets.def
+++ b/common/networking/packets.def
@@ -268,7 +268,7 @@ type WONDER_VISIB       = uint8(enum wonder_visib_type)
 type TRANSP_DEF_TYPE    = uint8(enum transp_def_type)
 type AI_LEVEL           = uint8(enum ai_level)
 type COUNTER_TARGET     = uint8(enum counter_target)
-type COUNTER_BEHAVIOUR  = uint8(enum counter_behaviour)
+type COUNTER_BEHAVIOR   = uint8(enum counter_behavior)
 type CITY_WL_CB         = uint8(enum city_wl_cancel_behavior)
 type CITY_ACQUIRE_TYPE  = uint8(enum city_acquire_type)
 
@@ -1925,7 +1925,7 @@ PACKET_RULESET_COUNTER = 513; sc, lsend
   UINT32 def;
   UINT32 checkpoint;
   COUNTER_TARGET type;
-  COUNTER_BEHAVIOUR behaviour;
+  COUNTER_BEHAVIOR behavior;
 end
 
 PACKET_RULESET_MUSIC = 240; sc, lsend
diff --git a/server/ruleset.c b/server/ruleset.c
index 47452640e7..215d73e72b 100644
--- a/server/ruleset.c
+++ b/server/ruleset.c
@@ -7681,9 +7681,9 @@ static bool load_ruleset_game(struct section_file *file, bool act,
                                                              "%s.type",
                                                               sec_name);
 
-        enum counter_behaviour cb = counter_behaviour_by_name(counter_type,
+        enum counter_behavior cb = counter_behavior_by_name(counter_type,
                                         fc_strcasecmp);
-        if (!counter_behaviour_is_valid(cb)) {
+        if (!counter_behavior_is_valid(cb)) {
           ruleset_error(NULL, LOG_ERROR,
                         "\"%s\" unknown counter type \"%s\".",
                         filename, counter_type);
@@ -8392,7 +8392,7 @@ static void send_ruleset_counters(struct conn_list *dest)
     sz_strlcpy(packet.name, untranslated_name(&pcount->name));
     sz_strlcpy(packet.rule_name, rule_name_get(&pcount->name));
     packet.checkpoint = pcount->checkpoint;
-    packet.behaviour = pcount->type;
+    packet.behavior = pcount->type;
     packet.type = pcount->target;
     packet.def = pcount->def;
 
diff --git a/tools/ruledit/tab_counters.cpp b/tools/ruledit/tab_counters.cpp
index bccc70f078..00a16275e0 100644
--- a/tools/ruledit/tab_counters.cpp
+++ b/tools/ruledit/tab_counters.cpp
@@ -115,19 +115,20 @@ tab_counter::tab_counter(ruledit_gui *ui_in) : QWidget()
   widgets_row(label, empty_widget, checkpoint);
 
   {
-    enum counter_behaviour current;
+    enum counter_behavior current;
     type = new QComboBox(this);
 
     label = new QLabel(QString::fromUtf8(R__("Behavior")));
     label->setParent(this);
 
-    for (current = counter_behaviour_begin(); current > counter_behaviour_end(); current = counter_behaviour_next(current)) {
+    for (current = counter_behavior_begin(); current > counter_behavior_end();
+         current = counter_behavior_next(current)) {
       QVariant value(current);
 
-      type->addItem(counter_behaviour_name(current), value);
+      type->addItem(counter_behavior_name(current), value);
     };
 
-    connect(type, SIGNAL(activated(int)), this, SLOT(counter_behaviour_selected(int)));
+    connect(type, SIGNAL(activated(int)), this, SLOT(counter_behavior_selected(int)));
     widgets_row(label, empty_widget, type);
   }
 
@@ -156,9 +157,9 @@ tab_counter::tab_counter(ruledit_gui *ui_in) : QWidget()
 }
 
 /**********************************************************************//**
-  Called when counter behaviour is set by user
+  Called when counter behavior is set by user
 **************************************************************************/
-void tab_counter::counter_behaviour_selected(int item)
+void tab_counter::counter_behavior_selected(int item)
 {
   QVariant item_data;
 
@@ -167,7 +168,7 @@ void tab_counter::counter_behaviour_selected(int item)
     return;
   }
   item_data = type->currentData();
-  selected->type =  (enum counter_behaviour) item_data.toInt();
+  selected->type =  (enum counter_behavior) item_data.toInt();
 
   update_counter_info(selected);
   refresh();
@@ -336,7 +337,7 @@ void tab_counter::add_now()
 
   // Try to reuse freed counter slot
   city_counters_iterate(pcount) {
-    if (pcount->type == COUNTER_BEHAVIOUR_LAST
+    if (pcount->type == COUNTER_BEHAVIOR_LAST
         || pcount->ruledit_disabled) {
       if (initialize_new_counter(pcount)) {
         update_counter_info(pcount);
diff --git a/tools/ruledit/tab_counters.h b/tools/ruledit/tab_counters.h
index 8d379d6456..4d341d4d57 100644
--- a/tools/ruledit/tab_counters.h
+++ b/tools/ruledit/tab_counters.h
@@ -68,7 +68,7 @@ class tab_counter : public QWidget
     void same_name_toggle(bool checked);
     void edit_effects();
     bool initialize_new_counter(struct counter *padv);
-    void counter_behaviour_selected(int item);
+    void counter_behavior_selected(int item);
 };
 
 
diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c
index 3c670c88eb..cd96981a60 100644
--- a/tools/ruleutil/rulesave.c
+++ b/tools/ruleutil/rulesave.c
@@ -1809,7 +1809,7 @@ static bool save_game_ruleset(const char *filename, const char *name)
     save_default_int(sfile, pcounter->def, 0, path, "def");
     save_default_int(sfile, pcounter->checkpoint, 0, path, "checkpoint");
 
-    secfile_insert_str(sfile, counter_behaviour_name(pcounter->type), "%s.type", path);
+    secfile_insert_str(sfile, counter_behavior_name(pcounter->type), "%s.type", path);
     if ((NULL != pcounter->helptext)
         && (0 < strvec_size(pcounter->helptext))) {
       save_strvec(sfile, pcounter->helptext, "%s.helptext", path);
-- 
2.47.2

