From 4b81d574a0db93331b1a0b22569766d67ed03b66 Mon Sep 17 00:00:00 2001
From: Ihnatus <ignatus31oct@mail.ru>
Date: Tue, 1 Jul 2025 00:16:38 +0300
Subject: [PATCH] Create new action actor kinds and put them in right places

See RM#1549

Signed-off-by: Ihnatus <ignatus31oct@mail.ru>
---
 common/actions.c     | 21 ++++++++++++++++-----
 common/actions.h     |  4 ++++
 common/improvement.c |  4 ++++
 3 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/common/actions.c b/common/actions.c
index 99680d5da6..a4d48f4a6e 100644
--- a/common/actions.c
+++ b/common/actions.c
@@ -964,6 +964,7 @@ bool actions_are_ready(void)
   Create a new action.
 **************************************************************************/
 static struct action *action_new(action_id id,
+                                 enum action_actor_kind aak,
                                  enum action_result result,
                                  const int min_distance,
                                  const int max_distance,
@@ -991,7 +992,7 @@ static struct action *action_new(action_id id,
   /* Not set here */
   BV_CLR_ALL(action->sub_results);
 
-  action->actor_kind = AAK_UNIT;
+  action->actor_kind = aak;
   action->target_kind = actres_target_kind_default(result);
   action->sub_target_kind = actres_sub_target_kind_default(result);
   action->target_complexity = actres_target_compl_calc(result);
@@ -1036,7 +1037,7 @@ unit_action_new(action_id id,
                 const int max_distance,
                 bool actor_consuming_always)
 {
-  struct action *act = action_new(id, result,
+  struct action *act = action_new(id, AAK_UNIT, result,
                                   min_distance, max_distance,
                                   actor_consuming_always);
 
@@ -1056,7 +1057,7 @@ static struct action *
 player_action_new(action_id id,
                   enum action_result result)
 {
-  struct action *act = action_new(id, result,
+  struct action *act = action_new(id, AAK_PLAYER, result,
                                   0, 0, FALSE);
 
   return act;
@@ -2300,8 +2301,10 @@ struct action *action_is_blocked_by(const struct civ_map *nmap,
   action_iterate(blocker_id) {
     struct action *blocker = action_by_number(blocker_id);
 
-    fc_assert_action(action_get_actor_kind(blocker) == AAK_UNIT,
-                     continue);
+    if (action_get_actor_kind(blocker) != AAK_UNIT) {
+      /* Currently, only unit's actions may block each other */
+      continue;
+    }
 
     if (!action_would_be_blocked_by(act, blocker)) {
       /* It doesn't matter if it is legal. It won't block the action. */
@@ -5631,6 +5634,10 @@ bool action_enabler_possible_actor(const struct action_enabler *ae)
 
     /* No actor detected. */
     return FALSE;
+  case AAK_CITY:
+  case AAK_PLAYER:
+    /* Currently can't detect */
+    return TRUE;
   case AAK_COUNT:
     fc_assert(action_get_actor_kind(paction) != AAK_COUNT);
     break;
@@ -5657,6 +5664,10 @@ static bool action_has_possible_actor_hard_reqs(struct action *paction)
       }
     } unit_type_iterate_end;
     break;
+  case AAK_CITY:
+  case AAK_PLAYER:
+    /* No ruleset hard reqs atm */
+    return TRUE;
   case AAK_COUNT:
     fc_assert(action_get_actor_kind(paction) != AAK_COUNT);
     break;
diff --git a/common/actions.h b/common/actions.h
index cab561207b..bd729e0f61 100644
--- a/common/actions.h
+++ b/common/actions.h
@@ -41,6 +41,10 @@ extern "C" {
 #define SPECENUM_NAME action_actor_kind
 #define SPECENUM_VALUE0 AAK_UNIT
 #define SPECENUM_VALUE0NAME N_("a unit")
+#define SPECENUM_VALUE1 AAK_CITY
+#define SPECENUM_VALUE1NAME N_("a city")
+#define SPECENUM_VALUE2 AAK_PLAYER
+#define SPECENUM_VALUE2NAME N_("a player")
 #define SPECENUM_COUNT AAK_COUNT
 #include "specenum_gen.h"
 
diff --git a/common/improvement.c b/common/improvement.c
index 9b752fcc78..9b56aaac06 100644
--- a/common/improvement.c
+++ b/common/improvement.c
@@ -560,6 +560,10 @@ static bool impr_allows_actions(const struct city *pcity,
           }
         } unit_type_iterate_end;
         break;
+      case AAK_CITY:
+      case AAK_PLAYER:
+        /* No traceable limitations */
+        return TRUE;
       case AAK_COUNT:
         fc_assert(action_id_get_actor_kind(act) != AAK_COUNT);
         break;
-- 
2.45.2

