From 1affa02d4903783ffac4419b38492cbd9754bce3 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 3 May 2025 18:21:16 +0300
Subject: [PATCH 48/48] 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/ruleload.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 fde5fcba5d..f7ab331991 100644
--- a/client/packhand.c
+++ b/client/packhand.c
@@ -5691,11 +5691,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 bd206fc20d..0ca978fc9d 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 b25e1ec648..a380beb748 100644
--- a/common/networking/packets.def
+++ b/common/networking/packets.def
@@ -271,7 +271,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)
 
@@ -1909,7 +1909,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/ruleload.c b/server/ruleset/ruleload.c
index 4d8ab15592..a507afe988 100644
--- a/server/ruleset/ruleload.c
+++ b/server/ruleset/ruleload.c
@@ -7484,9 +7484,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);
@@ -8248,7 +8248,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 1cbe6bfbdf..340dbcfdd9 100644
--- a/tools/ruleutil/rulesave.c
+++ b/tools/ruleutil/rulesave.c
@@ -1841,7 +1841,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 (pcounter->helptext != nullptr
         && strvec_size(pcounter->helptext) > 0) {
-- 
2.47.2

