From c0a6d78146cccdc41fd64140f3298c674e160957 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Tue, 2 Jan 2024 02:24:43 +0200
Subject: [PATCH 30/30] Fake Generalize Build Road/Base/Irrigation/Mine

See RM #107

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 common/actions.c   | 48 +++++++++++++++++++++++++++++++++++++
 common/actions.h   | 60 ++++++++++++++++++++++++++--------------------
 doc/README.actions | 16 +++++++++++++
 3 files changed, 98 insertions(+), 26 deletions(-)

diff --git a/common/actions.c b/common/actions.c
index c74213ef83..5ac728f370 100644
--- a/common/actions.c
+++ b/common/actions.c
@@ -551,6 +551,10 @@ static void hard_code_actions(void)
       unit_action_new(ACTION_ROAD, ACTRES_ROAD,
                       TRUE, FALSE,
                       MAK_STAYS, 0, 0, FALSE);
+  actions[ACTION_ROAD2] =
+      unit_action_new(ACTION_ROAD2, ACTRES_ROAD,
+                      TRUE, FALSE,
+                      MAK_STAYS, 0, 0, FALSE);
   actions[ACTION_CONVERT] =
       unit_action_new(ACTION_CONVERT, ACTRES_CONVERT,
                       TRUE, FALSE,
@@ -559,14 +563,26 @@ static void hard_code_actions(void)
       unit_action_new(ACTION_BASE, ACTRES_BASE,
                       TRUE, FALSE,
                       MAK_STAYS, 0, 0, FALSE);
+  actions[ACTION_BASE2] =
+      unit_action_new(ACTION_BASE2, ACTRES_BASE,
+                      TRUE, FALSE,
+                      MAK_STAYS, 0, 0, FALSE);
   actions[ACTION_MINE] =
       unit_action_new(ACTION_MINE, ACTRES_MINE,
                       TRUE, FALSE,
                       MAK_STAYS, 0, 0, FALSE);
+  actions[ACTION_MINE2] =
+      unit_action_new(ACTION_MINE2, ACTRES_MINE,
+                      TRUE, FALSE,
+                      MAK_STAYS, 0, 0, FALSE);
   actions[ACTION_IRRIGATE] =
       unit_action_new(ACTION_IRRIGATE, ACTRES_IRRIGATE,
                       TRUE, FALSE,
                       MAK_STAYS, 0, 0, FALSE);
+  actions[ACTION_IRRIGATE2] =
+      unit_action_new(ACTION_IRRIGATE2, ACTRES_IRRIGATE,
+                      TRUE, FALSE,
+                      MAK_STAYS, 0, 0, FALSE);
   actions[ACTION_TRANSPORT_DEBOARD] =
       unit_action_new(ACTION_TRANSPORT_DEBOARD, ACTRES_TRANSPORT_DEBOARD,
                       TRUE, FALSE,
@@ -5794,14 +5810,22 @@ const char *action_ui_name_ruleset_var_name(int act)
     return "ui_name_fortify";
   case ACTION_ROAD:
     return "ui_name_road";
+  case ACTION_ROAD2:
+    return "ui_name_road_2";
   case ACTION_CONVERT:
     return "ui_name_convert_unit";
   case ACTION_BASE:
     return "ui_name_build_base";
+  case ACTION_BASE2:
+    return "ui_name_build_base_2";
   case ACTION_MINE:
     return "ui_name_build_mine";
+  case ACTION_MINE2:
+    return "ui_name_build_mine_2";
   case ACTION_IRRIGATE:
     return "ui_name_irrigate";
+  case ACTION_IRRIGATE2:
+    return "ui_name_irrigate_2";
   case ACTION_TRANSPORT_DEBOARD:
     return "ui_name_transport_deboard";
   case ACTION_TRANSPORT_BOARD:
@@ -6295,10 +6319,14 @@ const char *action_min_range_ruleset_var_name(int act)
   case ACTION_CLEAN:
   case ACTION_FORTIFY:
   case ACTION_ROAD:
+  case ACTION_ROAD2:
   case ACTION_CONVERT:
   case ACTION_BASE:
+  case ACTION_BASE2:
   case ACTION_MINE:
+  case ACTION_MINE2:
   case ACTION_IRRIGATE:
+  case ACTION_IRRIGATE2:
   case ACTION_TRANSPORT_DEBOARD:
   case ACTION_TRANSPORT_BOARD:
   case ACTION_TRANSPORT_BOARD2:
@@ -6537,10 +6565,14 @@ const char *action_max_range_ruleset_var_name(int act)
   case ACTION_CLEAN:
   case ACTION_FORTIFY:
   case ACTION_ROAD:
+  case ACTION_ROAD2:
   case ACTION_CONVERT:
   case ACTION_BASE:
+  case ACTION_BASE2:
   case ACTION_MINE:
+  case ACTION_MINE2:
   case ACTION_IRRIGATE:
+  case ACTION_IRRIGATE2:
   case ACTION_TRANSPORT_DEBOARD:
   case ACTION_TRANSPORT_BOARD:
   case ACTION_TRANSPORT_BOARD2:
@@ -6796,10 +6828,14 @@ const char *action_target_kind_ruleset_var_name(int act)
   case ACTION_CLEAN:
   case ACTION_FORTIFY:
   case ACTION_ROAD:
+  case ACTION_ROAD2:
   case ACTION_CONVERT:
   case ACTION_BASE:
+  case ACTION_BASE2:
   case ACTION_MINE:
+  case ACTION_MINE2:
   case ACTION_IRRIGATE:
+  case ACTION_IRRIGATE2:
   case ACTION_TRANSPORT_DEBOARD:
   case ACTION_TRANSPORT_BOARD:
   case ACTION_TRANSPORT_BOARD2:
@@ -7248,10 +7284,14 @@ const char *action_actor_consuming_always_ruleset_var_name(action_id act)
   case ACTION_CLEAN:
   case ACTION_FORTIFY:
   case ACTION_ROAD:
+  case ACTION_ROAD2:
   case ACTION_CONVERT:
   case ACTION_BASE:
+  case ACTION_BASE2:
   case ACTION_MINE:
+  case ACTION_MINE2:
   case ACTION_IRRIGATE:
+  case ACTION_IRRIGATE2:
   case ACTION_TRANSPORT_DEBOARD:
   case ACTION_TRANSPORT_BOARD:
   case ACTION_TRANSPORT_BOARD2:
@@ -7448,10 +7488,14 @@ const char *action_blocked_by_ruleset_var_name(const struct action *act)
   case ACTION_CLEAN:
   case ACTION_FORTIFY:
   case ACTION_ROAD:
+  case ACTION_ROAD2:
   case ACTION_CONVERT:
   case ACTION_BASE:
+  case ACTION_BASE2:
   case ACTION_MINE:
+  case ACTION_MINE2:
   case ACTION_IRRIGATE:
+  case ACTION_IRRIGATE2:
   case ACTION_TRANSPORT_DEBOARD:
   case ACTION_TRANSPORT_BOARD:
   case ACTION_TRANSPORT_BOARD2:
@@ -7597,10 +7641,14 @@ action_post_success_forced_ruleset_var_name(const struct action *act)
   case ACTION_CLEAN:
   case ACTION_FORTIFY:
   case ACTION_ROAD:
+  case ACTION_ROAD2:
   case ACTION_CONVERT:
   case ACTION_BASE:
+  case ACTION_BASE2:
   case ACTION_MINE:
+  case ACTION_MINE2:
   case ACTION_IRRIGATE:
+  case ACTION_IRRIGATE2:
   case ACTION_TRANSPORT_DEBOARD:
   case ACTION_TRANSPORT_BOARD:
   case ACTION_TRANSPORT_BOARD2:
diff --git a/common/actions.h b/common/actions.h
index 14304fb990..89668cbbd7 100644
--- a/common/actions.h
+++ b/common/actions.h
@@ -168,22 +168,22 @@ const char *gen_action_name_update_cb(const char *old_name);
 #define SPECENUM_VALUE58NAME "Bombard Lethal"
 #define SPECENUM_VALUE59 ACTION_BOMBARD_LETHAL2
 #define SPECENUM_VALUE59NAME "Bombard Lethal 2"
-#define SPECENUM_VALUE60 ACTION_FORTIFY
-#define SPECENUM_VALUE60NAME "Fortify"
-#define SPECENUM_VALUE61 ACTION_CULTIVATE
-#define SPECENUM_VALUE61NAME "Cultivate"
-#define SPECENUM_VALUE62 ACTION_PLANT
-#define SPECENUM_VALUE62NAME "Plant"
-#define SPECENUM_VALUE63 ACTION_TRANSFORM_TERRAIN
-#define SPECENUM_VALUE63NAME "Transform Terrain"
-#define SPECENUM_VALUE64 ACTION_ROAD
-#define SPECENUM_VALUE64NAME "Build Road"
-#define SPECENUM_VALUE65 ACTION_IRRIGATE
-#define SPECENUM_VALUE65NAME "Build Irrigation"
-#define SPECENUM_VALUE66 ACTION_MINE
-#define SPECENUM_VALUE66NAME "Build Mine"
-#define SPECENUM_VALUE67 ACTION_BASE
-#define SPECENUM_VALUE67NAME "Build Base"
+#define SPECENUM_VALUE60 ACTION_ROAD
+#define SPECENUM_VALUE60NAME "Build Road"
+#define SPECENUM_VALUE61 ACTION_ROAD2
+#define SPECENUM_VALUE61NAME "Build Road 2"
+#define SPECENUM_VALUE62 ACTION_IRRIGATE
+#define SPECENUM_VALUE62NAME "Build Irrigation"
+#define SPECENUM_VALUE63 ACTION_IRRIGATE2
+#define SPECENUM_VALUE63NAME "Build Irrigation 2"
+#define SPECENUM_VALUE64 ACTION_MINE
+#define SPECENUM_VALUE64NAME "Build Mine"
+#define SPECENUM_VALUE65 ACTION_MINE2
+#define SPECENUM_VALUE65NAME "Build Mine 2"
+#define SPECENUM_VALUE66 ACTION_BASE
+#define SPECENUM_VALUE66NAME "Build Base"
+#define SPECENUM_VALUE67 ACTION_BASE2
+#define SPECENUM_VALUE67NAME "Build Base 2"
 #define SPECENUM_VALUE68 ACTION_PILLAGE
 #define SPECENUM_VALUE68NAME "Pillage"
 #define SPECENUM_VALUE69 ACTION_TRANSPORT_BOARD
@@ -284,20 +284,28 @@ const char *gen_action_name_update_cb(const char *old_name);
 #define SPECENUM_VALUE116NAME "Clean"
 #define SPECENUM_VALUE117 ACTION_COLLECT_RANSOM
 #define SPECENUM_VALUE117NAME "Collect Ransom"
+#define SPECENUM_VALUE118 ACTION_FORTIFY
+#define SPECENUM_VALUE118NAME "Fortify"
+#define SPECENUM_VALUE119 ACTION_CULTIVATE
+#define SPECENUM_VALUE119NAME "Cultivate"
+#define SPECENUM_VALUE120 ACTION_PLANT
+#define SPECENUM_VALUE120NAME "Plant"
+#define SPECENUM_VALUE121 ACTION_TRANSFORM_TERRAIN
+#define SPECENUM_VALUE121NAME "Transform Terrain"
 
 /* Enabler checks only */
-#define SPECENUM_VALUE118 ACTION_GAIN_VETERANCY
-#define SPECENUM_VALUE118NAME "Gain Veterancy"
+#define SPECENUM_VALUE122 ACTION_GAIN_VETERANCY
+#define SPECENUM_VALUE122NAME "Gain Veterancy"
 
 /* User actions */
-#define SPECENUM_VALUE119 ACTION_USER_ACTION1
-#define SPECENUM_VALUE119NAME "User Action 1"
-#define SPECENUM_VALUE120 ACTION_USER_ACTION2
-#define SPECENUM_VALUE120NAME "User Action 2"
-#define SPECENUM_VALUE121 ACTION_USER_ACTION3
-#define SPECENUM_VALUE121NAME "User Action 3"
-#define SPECENUM_VALUE122 ACTION_USER_ACTION4
-#define SPECENUM_VALUE122NAME "User Action 4"
+#define SPECENUM_VALUE123 ACTION_USER_ACTION1
+#define SPECENUM_VALUE123NAME "User Action 1"
+#define SPECENUM_VALUE124 ACTION_USER_ACTION2
+#define SPECENUM_VALUE124NAME "User Action 2"
+#define SPECENUM_VALUE125 ACTION_USER_ACTION3
+#define SPECENUM_VALUE125NAME "User Action 3"
+#define SPECENUM_VALUE126 ACTION_USER_ACTION4
+#define SPECENUM_VALUE126NAME "User Action 4"
 #define SPECENUM_BITVECTOR bv_actions
 #define SPECENUM_COUNT ACTION_COUNT
 #define SPECENUM_NAME_UPDATER
diff --git a/doc/README.actions b/doc/README.actions
index 778f013067..4496ce045b 100644
--- a/doc/README.actions
+++ b/doc/README.actions
@@ -1226,6 +1226,10 @@ Actions done by a unit against a tile
  * the build requirements of the target extra (see extra type's reqs) must
    be fulfilled
 
+"Build Road 2"        - Build road at the target tile.
+ * UI name can be set using ui_name_road_2
+ * See "Build Road" for everything else.
+
 "Build Base"        - Build base at the target tile.
  * UI name can be set using ui_name_build_base
  * the actor unit has the "Workers" unit type flag (!)
@@ -1243,6 +1247,10 @@ Actions done by a unit against a tile
  * the build requirements of the target extra (see extra type's reqs) must
    be fulfilled
 
+"Build Base 2"        - Build base at the target tile.
+ * UI name can be set using ui_name_build_base_2
+ * See "Build Base" for everything else.
+
 "Build Mine"        - Build mine at the target tile.
  * UI name can be set using ui_name_build_mine
  * actor must be on the same tile as the target.
@@ -1263,6 +1271,10 @@ Actions done by a unit against a tile
  * the build requirements of the target extra (see extra type's reqs) must
    be fulfilled
 
+"Build Mine 2"        - Build mine at the target tile.
+ * UI name can be set using ui_name_build_mine_2
+ * See "Build Mine" for everything else.
+
 "Build Irrigation"  - Build irrigation at the target tile.
  * UI name can be set using ui_name_irrigate
  * actor must be on the same tile as the target.
@@ -1284,6 +1296,10 @@ Actions done by a unit against a tile
  * the build requirements of the target extra (see extra type's reqs) must
    be fulfilled
 
+"Build Irrigation 2"  - Build irrigation at the target tile.
+ * UI name can be set using ui_name_irrigate_2
+ * See "Build Irrigation" for everything else.
+
 "Transport Disembark" - Exit transport to target tile.
 * UI name can be set using ui_name_transport_disembark
 * the actor unit must be on a tile next to the target.
-- 
2.43.0

