From 99f23a217af11d560046ab1e74fe8468e148556d Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sun, 4 Oct 2026 17:56:12 +0300
Subject: [PATCH 85/85] Drop nonfunctional cm parameter allow_specialists

See RM #2328

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 ai/default/daihand.c           |  1 -
 client/agents/cma_fec.c        |  5 -----
 client/gui-qt/citydlg.cpp      |  3 +--
 client/options.c               |  1 -
 common/aicore/cm.c             |  5 -----
 common/aicore/cm.h             |  1 -
 common/networking/dataio_raw.c |  4 +---
 server/cityturn.c              |  1 -
 server/savegame/savecompat.c   | 36 ++++++++++++++++++++++++++++++++++
 server/savegame/savegame3.c    |  8 --------
 10 files changed, 38 insertions(+), 27 deletions(-)

diff --git a/ai/default/daihand.c b/ai/default/daihand.c
index 7956461bb6..232b5746a3 100644
--- a/ai/default/daihand.c
+++ b/ai/default/daihand.c
@@ -256,7 +256,6 @@ static void dai_manage_taxes(struct ai_type *ait, struct player *pplayer)
   cm_init_parameter(&cmp);
   cmp.require_happy = TRUE;    /* Note this one */
   cmp.allow_disorder = FALSE;
-  cmp.allow_specialists = TRUE;
   cmp.factor[O_FOOD] = 20;
   cmp.minimal_surplus[O_GOLD] = -FC_INFINITY;
 
diff --git a/client/agents/cma_fec.c b/client/agents/cma_fec.c
index 89f3acd0c6..aa2ca501f6 100644
--- a/client/agents/cma_fec.c
+++ b/client/agents/cma_fec.c
@@ -389,7 +389,6 @@ void create_default_cma_presets(void)
      .minimal_surplus = {0, 0, 0, -20, 0, 0},
      .require_happy = FALSE,
      .allow_disorder = FALSE,
-     .allow_specialists = TRUE,
      .factor = {10, 5, 0, 4, 0, 4},
      .happy_factor = 25
    },
@@ -397,7 +396,6 @@ void create_default_cma_presets(void)
      .minimal_surplus = {-20, 0, 0, -20, 0, 0},
      .require_happy = FALSE,
      .allow_disorder = FALSE,
-     .allow_specialists = TRUE,
      .factor = {25, 5, 0, 4, 0, 4},
      .happy_factor = 0
    },
@@ -405,7 +403,6 @@ void create_default_cma_presets(void)
      .minimal_surplus = {0, -20, 0, -20, 0, 0},
      .require_happy = FALSE,
      .allow_disorder = FALSE,
-     .allow_specialists = TRUE,
      .factor = {10, 25, 0, 4, 0, 4},
      .happy_factor = 0
    },
@@ -413,7 +410,6 @@ void create_default_cma_presets(void)
      .minimal_surplus = {0, 0, 0, -20, 0, 0},
      .require_happy = FALSE,
      .allow_disorder = FALSE,
-     .allow_specialists = TRUE,
      .factor = {10, 5, 0, 25, 0, 4},
      .happy_factor = 0
    },
@@ -421,7 +417,6 @@ void create_default_cma_presets(void)
      .minimal_surplus = {0, 0, 0, -20, 0, 0},
      .require_happy = FALSE,
      .allow_disorder = FALSE,
-     .allow_specialists = TRUE,
      .factor = {10, 5, 0, 4, 0, 25},
      .happy_factor = 0
    }
diff --git a/client/gui-qt/citydlg.cpp b/client/gui-qt/citydlg.cpp
index 987e770862..e59235d3b7 100644
--- a/client/gui-qt/citydlg.cpp
+++ b/client/gui-qt/citydlg.cpp
@@ -2438,9 +2438,9 @@ void city_dialog::save_cma()
     struct cm_parameter param;
     QByteArray ask_bytes = ask->input_edit.text().toUtf8();
     QString text = ask_bytes.data();
+
     if (!text.isEmpty()) {
       param.allow_disorder = false;
-      param.allow_specialists = true;
       param.require_happy = cma_celeb_checkbox->isChecked();
       param.max_growth = cma_max_growth->isChecked();
       param.happy_factor = slider_tab[2 * O_LAST + 1]->value();
@@ -2481,7 +2481,6 @@ void city_dialog::cma_changed()
   struct cm_parameter param;
 
   param.allow_disorder = false;
-  param.allow_specialists = true;
   param.require_happy = cma_celeb_checkbox->isChecked();
   param.max_growth = cma_max_growth->isChecked();
   param.happy_factor = slider_tab[2 * O_LAST + 1]->value();
diff --git a/client/options.c b/client/options.c
index 54876470ad..3a82b1261b 100644
--- a/client/options.c
+++ b/client/options.c
@@ -5579,7 +5579,6 @@ static void load_cma_preset(struct section_file *file, int i)
   parameter.happy_factor =
       secfile_lookup_int_default(file, 0, "cma.preset%d.happyfactor", i);
   parameter.allow_disorder = FALSE;
-  parameter.allow_specialists = TRUE;
 
   cmafec_preset_add(name, &parameter);
 }
diff --git a/common/aicore/cm.c b/common/aicore/cm.c
index a1da00e5df..b18b04c9fe 100644
--- a/common/aicore/cm.c
+++ b/common/aicore/cm.c
@@ -2157,9 +2157,6 @@ bool cm_are_parameter_equal(const struct cm_parameter *const p1,
   if (p1->allow_disorder != p2->allow_disorder) {
     return FALSE;
   }
-  if (p1->allow_specialists != p2->allow_specialists) {
-    return FALSE;
-  }
   if (p1->happy_factor != p2->happy_factor) {
     return FALSE;
   }
@@ -2192,7 +2189,6 @@ void cm_init_parameter(struct cm_parameter *dest)
   dest->happy_factor = 1;
   dest->require_happy = FALSE;
   dest->allow_disorder = FALSE;
-  dest->allow_specialists = TRUE;
   dest->max_growth = FALSE;
 }
 
@@ -2210,7 +2206,6 @@ void cm_init_emergency_parameter(struct cm_parameter *dest)
   dest->happy_factor = 1;
   dest->require_happy = FALSE;
   dest->allow_disorder = TRUE;
-  dest->allow_specialists = TRUE;
   dest->max_growth = FALSE;
 }
 
diff --git a/common/aicore/cm.h b/common/aicore/cm.h
index db3a7fc5bb..1c5adafc09 100644
--- a/common/aicore/cm.h
+++ b/common/aicore/cm.h
@@ -42,7 +42,6 @@ struct cm_parameter {
   bool max_growth;
   bool require_happy;
   bool allow_disorder;
-  bool allow_specialists;
 
   int factor[O_LAST];
   int happy_factor;
diff --git a/common/networking/dataio_raw.c b/common/networking/dataio_raw.c
index c093dca42c..cae1c4f7bf 100644
--- a/common/networking/dataio_raw.c
+++ b/common/networking/dataio_raw.c
@@ -551,7 +551,6 @@ int dio_put_cm_parameter_raw(struct raw_data_out *d_out,
   e |= dio_put_bool8_raw(d_out, param->max_growth);
   e |= dio_put_bool8_raw(d_out, param->require_happy);
   e |= dio_put_bool8_raw(d_out, param->allow_disorder);
-  e |= dio_put_bool8_raw(d_out, param->allow_specialists);
 
   for (i = 0; i < O_LAST; i++) {
     e |= dio_put_uint16_raw(d_out, param->factor[i]);
@@ -887,8 +886,7 @@ bool dio_get_cm_parameter_raw(struct data_in *din,
 
   if (!dio_get_bool8_raw(din, &param->max_growth)
       || !dio_get_bool8_raw(din, &param->require_happy)
-      || !dio_get_bool8_raw(din, &param->allow_disorder)
-      || !dio_get_bool8_raw(din, &param->allow_specialists)) {
+      || !dio_get_bool8_raw(din, &param->allow_disorder)) {
     log_packet("Got a bad cm_parameter");
     return FALSE;
   }
diff --git a/server/cityturn.c b/server/cityturn.c
index 1f6fc5e74f..2762b4b4f8 100644
--- a/server/cityturn.c
+++ b/server/cityturn.c
@@ -319,7 +319,6 @@ static void set_default_city_manager(struct cm_parameter *cmp,
 
   cmp->require_happy = FALSE;
   cmp->allow_disorder = FALSE;
-  cmp->allow_specialists = TRUE;
 
   /* We used to look at pplayer->ai.xxx_priority to determine the values
    * to be used here. However that doesn't work at all because those values
diff --git a/server/savegame/savecompat.c b/server/savegame/savecompat.c
index c512e56e1b..0b45995a4e 100644
--- a/server/savegame/savecompat.c
+++ b/server/savegame/savecompat.c
@@ -2672,6 +2672,24 @@ static void compat_load_030400(struct loaddata *loading,
   sg_check_ret();
 
   log_debug("Upgrading data from savegame to version 3.4.0");
+
+  player_slots_iterate(pslot) {
+    int plrno = player_slot_index(pslot);
+    int ncities;
+    int cnro;
+
+    if (secfile_section_lookup(loading->file, "player%d", plrno) == nullptr) {
+      continue;
+    }
+
+    ncities = secfile_lookup_int_default(loading->file, 0,
+                                         "player%d.dc_total", plrno);
+
+    for (cnro = 0; cnro < ncities; cnro++) {
+      secfile_entry_ignore(loading->file, "player%d.c%d.allow_specialists",
+                           plrno, cnro);
+    }
+  } player_slots_iterate_end;
 }
 
 /************************************************************************//**
@@ -2696,6 +2714,24 @@ static void compat_load_dev(struct loaddata *loading)
   if (game_version < 3039100) {
     /* Before version number bump to 3.3.91 */
 
+    player_slots_iterate(pslot) {
+      int plrno = player_slot_index(pslot);
+      int ncities;
+      int cnro;
+
+      if (secfile_section_lookup(loading->file, "player%d", plrno) == nullptr) {
+        continue;
+      }
+
+      ncities = secfile_lookup_int_default(loading->file, 0,
+                                           "player%d.dc_total", plrno);
+
+      for (cnro = 0; cnro < ncities; cnro++) {
+        secfile_entry_ignore(loading->file, "player%d.c%d.allow_specialists",
+                             plrno, cnro);
+      }
+    } player_slots_iterate_end;
+
   } /* Version < 3.3.91 */
 
 #endif /* FREECIV_DEV_SAVE_COMPAT_3_4 */
diff --git a/server/savegame/savegame3.c b/server/savegame/savegame3.c
index 2a08cd55e9..07450b0555 100644
--- a/server/savegame/savegame3.c
+++ b/server/savegame/savegame3.c
@@ -5617,8 +5617,6 @@ static bool sg_load_player_city(struct loaddata *loading, struct player *plr,
           loading->file, FALSE, "%s.require_happy", citystr);
       param->allow_disorder = secfile_lookup_bool_default(
           loading->file, FALSE, "%s.allow_disorder", citystr);
-      param->allow_specialists = secfile_lookup_bool_default(
-          loading->file, FALSE, "%s.allow_specialists", citystr);
       param->happy_factor = secfile_lookup_int_default(
           loading->file, 0, "%s.happy_factor", citystr);
       pcity->cm_parameter = param;
@@ -5638,8 +5636,6 @@ static bool sg_load_player_city(struct loaddata *loading, struct player *plr,
                            citystr);
       secfile_entry_ignore(loading->file, "%s.allow_disorder",
                            citystr);
-      secfile_entry_ignore(loading->file, "%s.allow_specialists",
-                           citystr);
       secfile_entry_ignore(loading->file, "%s.happy_factor",
                            citystr);
     }
@@ -6055,9 +6051,6 @@ static void sg_save_player_cities(struct savedata *saving,
                           "%s.require_happy", buf);
       secfile_insert_bool(saving->file, pcity->cm_parameter->allow_disorder,
                           "%s.allow_disorder", buf);
-      secfile_insert_bool(saving->file,
-                          pcity->cm_parameter->allow_specialists,
-                         "%s.allow_specialists", buf);
       secfile_insert_int(saving->file, pcity->cm_parameter->happy_factor,
                         "%s.happy_factor", buf);
     } else {
@@ -6071,7 +6064,6 @@ static void sg_save_player_cities(struct savedata *saving,
       secfile_insert_bool(saving->file, FALSE, "%s.max_growth", buf);
       secfile_insert_bool(saving->file, FALSE, "%s.require_happy", buf);
       secfile_insert_bool(saving->file, FALSE, "%s.allow_disorder", buf);
-      secfile_insert_bool(saving->file, FALSE, "%s.allow_specialists", buf);
       secfile_insert_int(saving->file, 0, "%s.happy_factor", buf);
     }
 
-- 
2.53.0

