From 1757efa705258343da8a472131feab7222176b19 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sun, 25 Aug 2024 04:38:45 +0300
Subject: [PATCH 14/14] Generate enum action_result by generate_enums.py

See RM #804

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 ai/default/daicity.c                 |   2 -
 common/actions.c                     |   4 -
 common/actres.c                      |   3 -
 common/actres.h                      |   3 -
 common/fc_types.h                    | 145 ---------------------------
 gen_headers/enums/fc_types_enums.def |  78 ++++++++++++++
 6 files changed, 78 insertions(+), 157 deletions(-)

diff --git a/ai/default/daicity.c b/ai/default/daicity.c
index ad341679de..5b09ad4223 100644
--- a/ai/default/daicity.c
+++ b/ai/default/daicity.c
@@ -1318,8 +1318,6 @@ static int action_target_neg_util(action_id act_id,
   case ACTRES_TELEPORT_CONQUER:
   case ACTRES_HOMELESS:
   case ACTRES_ENABLER_CHECK:
-
-  case ACTRES_UNUSED_1:
     fc_assert_msg(action_id_get_target_kind(act_id) == ATK_CITY,
                   "Action not aimed at cities");
     break;
diff --git a/common/actions.c b/common/actions.c
index 61857eec4a..4c097ef851 100644
--- a/common/actions.c
+++ b/common/actions.c
@@ -4077,10 +4077,6 @@ action_prob(const struct civ_map *nmap,
      * Lua? */
     chance = ACTPROB_NOT_IMPLEMENTED;
     break;
-
-  case ACTRES_UNUSED_1:
-    chance = ACTPROB_NOT_IMPLEMENTED;
-    break;
   }
 
   /* Non signal action probabilities should be in range. */
diff --git a/common/actres.c b/common/actres.c
index 9f97429ac7..886625ba94 100644
--- a/common/actres.c
+++ b/common/actres.c
@@ -172,9 +172,6 @@ static struct actres act_results[ACTRES_LAST] = {
   { ACT_TGT_COMPL_SIMPLE, ABK_STANDARD,      /* ACTRES_COLLECT_RANSOM */
     TRUE, ACTIVITY_LAST, DRT_NONE,
     EC_NONE, ERM_NONE, ATK_UNITS },
-  { ACT_TGT_COMPL_FLEXIBLE, ABK_NONE,        /* ACTRES_UNUSED_1 */
-    FALSE, ACTIVITY_LAST, DRT_NONE,
-    EC_NONE, ERM_NONE, RS_DEFAULT_USER_ACTION_TARGET_KIND },
   { ACT_TGT_COMPL_SIMPLE, ABK_NONE,          /* ACTRES_TRANSPORT_DEBOARD */
     FALSE, ACTIVITY_LAST, DRT_NONE,
     EC_NONE, ERM_NONE, ATK_UNIT },
diff --git a/common/actres.h b/common/actres.h
index 5e9a7bb0b4..05fa47b841 100644
--- a/common/actres.h
+++ b/common/actres.h
@@ -35,9 +35,6 @@ struct req_context;
  *     break;
  */
 #define ASSERT_UNUSED_ACTRES_CASES            \
-  case ACTRES_UNUSED_1:                       \
-    fc_assert_msg(FALSE, "ACTRES_UNUSED_1");  \
-    break;
 
 /* When making changes to this, update also atk_helpnames at actions.c */
 #define SPECENUM_NAME action_target_kind
diff --git a/common/fc_types.h b/common/fc_types.h
index f9c6798bf4..44e9dd16c3 100644
--- a/common/fc_types.h
+++ b/common/fc_types.h
@@ -185,151 +185,6 @@ enum counter_target { CTGT_CITY };
 #define SPECENUM_COUNT ACTIVITY_LAST
 #include "specenum_gen.h"
 
-/* Values used in the network protocol. */
-/* Update also properties table on actres.c when touching this. */
-#define SPECENUM_NAME action_result
-#define SPECENUM_VALUE0 ACTRES_ESTABLISH_EMBASSY
-#define SPECENUM_VALUE0NAME "Unit Establish Embassy"
-#define SPECENUM_VALUE1 ACTRES_SPY_INVESTIGATE_CITY
-#define SPECENUM_VALUE1NAME "Unit Investigate City"
-#define SPECENUM_VALUE2 ACTRES_SPY_POISON
-#define SPECENUM_VALUE2NAME "Unit Poison City"
-#define SPECENUM_VALUE3 ACTRES_SPY_STEAL_GOLD
-#define SPECENUM_VALUE3NAME "Unit Steal Gold"
-#define SPECENUM_VALUE4 ACTRES_SPY_SABOTAGE_CITY
-#define SPECENUM_VALUE4NAME "Unit Sabotage City"
-#define SPECENUM_VALUE5 ACTRES_SPY_TARGETED_SABOTAGE_CITY
-#define SPECENUM_VALUE5NAME "Unit Targeted Sabotage City"
-#define SPECENUM_VALUE6 ACTRES_SPY_SABOTAGE_CITY_PRODUCTION
-#define SPECENUM_VALUE6NAME "Unit Sabotage City Production"
-#define SPECENUM_VALUE7 ACTRES_SPY_STEAL_TECH
-#define SPECENUM_VALUE7NAME "Unit Steal Tech"
-#define SPECENUM_VALUE8 ACTRES_SPY_TARGETED_STEAL_TECH
-#define SPECENUM_VALUE8NAME "Unit Targeted Steal Tech"
-#define SPECENUM_VALUE9 ACTRES_SPY_INCITE_CITY
-#define SPECENUM_VALUE9NAME "Unit Incite City"
-#define SPECENUM_VALUE10 ACTRES_TRADE_ROUTE
-#define SPECENUM_VALUE10NAME "Unit Establish Trade Route"
-#define SPECENUM_VALUE11 ACTRES_MARKETPLACE
-#define SPECENUM_VALUE11NAME "Unit Enter Marketplace"
-#define SPECENUM_VALUE12 ACTRES_HELP_WONDER
-#define SPECENUM_VALUE12NAME "Unit Help Wonder"
-#define SPECENUM_VALUE13 ACTRES_SPY_BRIBE_UNIT
-#define SPECENUM_VALUE13NAME "Unit Bribe Unit"
-#define SPECENUM_VALUE14 ACTRES_SPY_SABOTAGE_UNIT
-#define SPECENUM_VALUE14NAME "Unit Sabotage Unit"
-#define SPECENUM_VALUE15 ACTRES_CAPTURE_UNITS
-#define SPECENUM_VALUE15NAME "Unit Capture Units"
-#define SPECENUM_VALUE16 ACTRES_FOUND_CITY
-#define SPECENUM_VALUE16NAME "Unit Found City"
-#define SPECENUM_VALUE17 ACTRES_JOIN_CITY
-#define SPECENUM_VALUE17NAME "Unit Join City"
-#define SPECENUM_VALUE18 ACTRES_STEAL_MAPS
-#define SPECENUM_VALUE18NAME "Unit Steal Maps"
-#define SPECENUM_VALUE19 ACTRES_BOMBARD
-#define SPECENUM_VALUE19NAME "Unit Bombard"
-#define SPECENUM_VALUE20 ACTRES_SPY_NUKE
-#define SPECENUM_VALUE20NAME "Unit Suitcase Nuke"
-#define SPECENUM_VALUE21 ACTRES_NUKE
-#define SPECENUM_VALUE21NAME "Unit Nuke"
-#define SPECENUM_VALUE22 ACTRES_NUKE_UNITS
-#define SPECENUM_VALUE22NAME "Unit Nuke Units"
-#define SPECENUM_VALUE23 ACTRES_DESTROY_CITY
-#define SPECENUM_VALUE23NAME "Unit Destroy City"
-#define SPECENUM_VALUE24 ACTRES_EXPEL_UNIT
-#define SPECENUM_VALUE24NAME "Unit Expel Unit"
-#define SPECENUM_VALUE25 ACTRES_DISBAND_UNIT_RECOVER
-#define SPECENUM_VALUE25NAME "Unit Disband Recover"
-#define SPECENUM_VALUE26 ACTRES_DISBAND_UNIT
-#define SPECENUM_VALUE26NAME "Unit Disband"
-#define SPECENUM_VALUE27 ACTRES_HOME_CITY
-#define SPECENUM_VALUE27NAME "Unit Home City"
-#define SPECENUM_VALUE28 ACTRES_UPGRADE_UNIT
-#define SPECENUM_VALUE28NAME "Unit Upgrade"
-#define SPECENUM_VALUE29 ACTRES_PARADROP
-#define SPECENUM_VALUE29NAME "Unit Paradrop"
-#define SPECENUM_VALUE30 ACTRES_AIRLIFT
-#define SPECENUM_VALUE30NAME "Unit Airlift"
-#define SPECENUM_VALUE31 ACTRES_ATTACK
-#define SPECENUM_VALUE31NAME "Unit Attack"
-#define SPECENUM_VALUE32 ACTRES_STRIKE_BUILDING
-#define SPECENUM_VALUE32NAME "Unit Surgical Strike Building"
-#define SPECENUM_VALUE33 ACTRES_STRIKE_PRODUCTION
-#define SPECENUM_VALUE33NAME "Unit Surgical Strike Production"
-#define SPECENUM_VALUE34 ACTRES_CONQUER_CITY
-#define SPECENUM_VALUE34NAME "Unit Conquer City"
-#define SPECENUM_VALUE35 ACTRES_HEAL_UNIT
-#define SPECENUM_VALUE35NAME "Unit Heal Unit"
-#define SPECENUM_VALUE36 ACTRES_TRANSFORM_TERRAIN
-#define SPECENUM_VALUE36NAME "Unit Transform Terrain"
-#define SPECENUM_VALUE37 ACTRES_CULTIVATE
-#define SPECENUM_VALUE37NAME "Unit Cultivate"
-#define SPECENUM_VALUE38 ACTRES_PLANT
-#define SPECENUM_VALUE38NAME "Unit Plant"
-#define SPECENUM_VALUE39 ACTRES_PILLAGE
-#define SPECENUM_VALUE39NAME "Unit Pillage"
-#define SPECENUM_VALUE40 ACTRES_FORTIFY
-#define SPECENUM_VALUE40NAME "Unit Fortify"
-#define SPECENUM_VALUE41 ACTRES_ROAD
-#define SPECENUM_VALUE41NAME "Unit Build Road"
-#define SPECENUM_VALUE42 ACTRES_CONVERT
-#define SPECENUM_VALUE42NAME "Unit Convert"
-#define SPECENUM_VALUE43 ACTRES_BASE
-#define SPECENUM_VALUE43NAME "Unit Build Base"
-#define SPECENUM_VALUE44 ACTRES_MINE
-#define SPECENUM_VALUE44NAME "Unit Build Mine"
-#define SPECENUM_VALUE45 ACTRES_IRRIGATE
-#define SPECENUM_VALUE45NAME "Unit Build Irrigation"
-#define SPECENUM_VALUE46 ACTRES_COLLECT_RANSOM
-#define SPECENUM_VALUE46NAME "Collect Ransom"
-/* TODO: Rearrange action results to get rid of this */
-#define SPECENUM_VALUE47 ACTRES_UNUSED_1
-#define SPECENUM_VALUE47NAME "Unused1"
-#define SPECENUM_VALUE48 ACTRES_TRANSPORT_DEBOARD
-#define SPECENUM_VALUE48NAME "Unit Transport Deboard"
-#define SPECENUM_VALUE49 ACTRES_TRANSPORT_UNLOAD
-#define SPECENUM_VALUE49NAME "Unit Transport Unload"
-#define SPECENUM_VALUE50 ACTRES_TRANSPORT_DISEMBARK
-#define SPECENUM_VALUE50NAME "Unit Transport Disembark"
-#define SPECENUM_VALUE51 ACTRES_TRANSPORT_BOARD
-#define SPECENUM_VALUE51NAME "Unit Transport Board"
-#define SPECENUM_VALUE52 ACTRES_TRANSPORT_EMBARK
-#define SPECENUM_VALUE52NAME "Unit Transport Embark"
-#define SPECENUM_VALUE53 ACTRES_SPY_SPREAD_PLAGUE
-#define SPECENUM_VALUE53NAME "Unit Spread Plague"
-#define SPECENUM_VALUE54 ACTRES_SPY_ATTACK
-#define SPECENUM_VALUE54NAME "Unit Spy Attack"
-#define SPECENUM_VALUE55 ACTRES_CONQUER_EXTRAS
-#define SPECENUM_VALUE55NAME "Unit Conquer Extras"
-#define SPECENUM_VALUE56 ACTRES_HUT_ENTER
-#define SPECENUM_VALUE56NAME "Unit Enter Hut"
-#define SPECENUM_VALUE57 ACTRES_HUT_FRIGHTEN
-#define SPECENUM_VALUE57NAME "Unit Frighten Hut"
-#define SPECENUM_VALUE58 ACTRES_UNIT_MOVE
-#define SPECENUM_VALUE58NAME "Unit Move"
-#define SPECENUM_VALUE59 ACTRES_PARADROP_CONQUER
-#define SPECENUM_VALUE59NAME "Unit Paradrop Conquer"
-#define SPECENUM_VALUE60 ACTRES_HOMELESS
-#define SPECENUM_VALUE60NAME "Unit Make Homeless"
-#define SPECENUM_VALUE61 ACTRES_WIPE_UNITS
-#define SPECENUM_VALUE61NAME "Wipe Units"
-#define SPECENUM_VALUE62 ACTRES_SPY_ESCAPE
-#define SPECENUM_VALUE62NAME "Unit Spy Escape"
-#define SPECENUM_VALUE63 ACTRES_TRANSPORT_LOAD
-#define SPECENUM_VALUE63NAME "Unit Transport Load"
-#define SPECENUM_VALUE64 ACTRES_CLEAN
-#define SPECENUM_VALUE64NAME "Clean"
-/* TODO: Move close to "Move" */
-#define SPECENUM_VALUE65 ACTRES_TELEPORT
-#define SPECENUM_VALUE65NAME "Teleport"
-#define SPECENUM_VALUE66 ACTRES_TELEPORT_CONQUER
-#define SPECENUM_VALUE66NAME "Teleport Conquer"
-/* Hardcoded action that's just controlled by enablers */
-#define SPECENUM_VALUE67 ACTRES_ENABLER_CHECK
-/* All consequences are handled as (ruleset) action data. */
-#define SPECENUM_COUNT ACTRES_LAST
-#include "specenum_gen.h"
-
 #define ACTRES_NONE ACTRES_LAST
 
 /* Used in the network protocol. */
diff --git a/gen_headers/enums/fc_types_enums.def b/gen_headers/enums/fc_types_enums.def
index 473737c034..edf0d419d9 100644
--- a/gen_headers/enums/fc_types_enums.def
+++ b/gen_headers/enums/fc_types_enums.def
@@ -120,3 +120,81 @@ values
   SAME_REGION       "Same Region"
   SAME_TCLASS       "Same Terrain Class"
 end
+
+/* Values used in the network protocol.
+ * Update also properties table on actres.c when touching this. */
+enum action_result
+  prefix ACTRES_
+  count  LAST
+values
+  ESTABLISH_EMBASSY            "Unit Establish Embassy"
+  SPY_INVESTIGATE_CITY         "Unit Investigate City"
+  SPY_POISON                   "Unit Poison City"
+  SPY_STEAL_GOLD               "Unit Steal Gold"
+  SPY_SABOTAGE_CITY            "Unit Sabotage City"
+  SPY_TARGETED_SABOTAGE_CITY   "Unit Targeted Sabotage City"
+  SPY_SABOTAGE_CITY_PRODUCTION "Unit Sabotage City Production"
+  SPY_STEAL_TECH               "Unit Steal Tech"
+  SPY_TARGETED_STEAL_TECH      "Unit Targeted Steal Tech"
+  SPY_INCITE_CITY              "Unit Incite City"
+  TRADE_ROUTE                  "Unit Establish Trade Route"
+  MARKETPLACE                  "Unit Enter Marketplace"
+  HELP_WONDER                  "Unit Help Wonder"
+  SPY_BRIBE_UNIT               "Unit Bribe Unit"
+  SPY_SABOTAGE_UNIT            "Unit Sabotage Unit"
+  CAPTURE_UNITS                "Unit Capture Units"
+  FOUND_CITY                   "Unit Found City"
+  JOIN_CITY                    "Unit Join City"
+  STEAL_MAPS                   "Unit Steal Maps"
+  BOMBARD                      "Unit Bombard"
+  SPY_NUKE                     "Unit Suitcase Nuke"
+  NUKE                         "Unit Nuke"
+  NUKE_UNITS                   "Unit Nuke Units"
+  DESTROY_CITY                 "Unit Destroy City"
+  EXPEL_UNIT                   "Unit Expel Unit"
+  DISBAND_UNIT_RECOVER         "Unit Disband Recover"
+  DISBAND_UNIT                 "Unit Disband"
+  HOME_CITY                    "Unit Home City"
+  UPGRADE_UNIT                 "Unit Upgrade"
+  PARADROP                     "Unit Paradrop"
+  AIRLIFT                      "Unit Airlift"
+  ATTACK                       "Unit Attack"
+  STRIKE_BUILDING              "Unit Surgical Strike Building"
+  STRIKE_PRODUCTION            "Unit Surgical Strike Production"
+  CONQUER_CITY                 "Unit Conquer City"
+  HEAL_UNIT                    "Unit Heal Unit"
+  TRANSFORM_TERRAIN            "Unit Transform Terrain"
+  CULTIVATE                    "Unit Cultivate"
+  PLANT                        "Unit Plant"
+  PILLAGE                      "Unit Pillage"
+  FORTIFY                      "Unit Fortify"
+  ROAD                         "Unit Build Road"
+  CONVERT                      "Unit Convert"
+  BASE                         "Unit Build Base"
+  MINE                         "Unit Build Mine"
+  IRRIGATE                     "Unit Build Irrigation"
+  COLLECT_RANSOM               "Collect Ransom"
+  TRANSPORT_DEBOARD            "Unit Transport Deboard"
+  TRANSPORT_UNLOAD             "Unit Transport Unload"
+  TRANSPORT_DISEMBARK          "Unit Transport Disembark"
+  TRANSPORT_BOARD              "Unit Transport Board"
+  TRANSPORT_EMBARK             "Unit Transport Embark"
+  SPY_SPREAD_PLAGUE            "Unit Spread Plague"
+  SPY_ATTACK                   "Unit Spy Attack"
+  CONQUER_EXTRAS               "Unit Conquer Extras"
+  HUT_ENTER                    "Unit Enter Hut"
+  HUT_FRIGHTEN                 "Unit Frighten Hut"
+  UNIT_MOVE                    "Unit Move"
+  PARADROP_CONQUER             "Unit Paradrop Conquer"
+  HOMELESS                     "Unit Make Homeless"
+  WIPE_UNITS                   "Wipe Units"
+  SPY_ESCAPE                   "Unit Spy Escape"
+  TRANSPORT_LOAD               "Unit Transport Load"
+  CLEAN                        "Clean"
+  /* TODO: Move close to "Move" */
+  TELEPORT                     "Teleport"
+  TELEPORT_CONQUER             "Teleport Conquer"
+
+  /* Hardcoded action that's just controlled by enablers */
+  ENABLER_CHECK
+end
-- 
2.45.2

