From c91b8392dd5ce75313d0beac2ce7afd913f163b7 Mon Sep 17 00:00:00 2001
From: andrew <andrew@arobeia.co.uk>
Date: Mon, 2 Nov 2026 15:14:10 +0000
Subject: [PATCH 1/2] Allow activating units that are not idle

---
 client/control.c                | 2 +-
 client/gui-gtk-4.0/citydlg.c    | 9 ---------
 client/gui-gtk-4.0/unitselect.c | 3 ---
 client/gui-gtk-5.0/citydlg.c    | 3 ---
 client/gui-gtk-5.0/unitselect.c | 3 ---
 5 files changed, 1 insertion(+), 19 deletions(-)

diff --git a/client/control.c b/client/control.c
index 1f1b312783..d66e5d4fe8 100644
--- a/client/control.c
+++ b/client/control.c
@@ -501,7 +501,7 @@ void clear_unit_orders(struct unit *punit)
 **************************************************************************/
 void unit_focus_try(struct unit *punit)
 {
-  if (punit->activity == ACTIVITY_IDLE) {
+  if (can_unit_do_activity_client(punit, ACTIVITY_IDLE)) {
     /* Only idle units can be at focus. */
     unit_focus_set(punit);
   }
diff --git a/client/gui-gtk-4.0/citydlg.c b/client/gui-gtk-4.0/citydlg.c
index 61fcae210a..c20860e9d8 100644
--- a/client/gui-gtk-4.0/citydlg.c
+++ b/client/gui-gtk-4.0/citydlg.c
@@ -2896,9 +2896,6 @@ static void unit_activate_callback(GSimpleAction *action, GVariant *parameter,
     player_unit_by_number(client_player(), GPOINTER_TO_INT(data));
 
   if (NULL != punit) {
-    /* FIXME: If unit is not idle to begin with, we can only request
-     *        idling, and as we have no server reply yet,
-     *        the unit_focus_try() below will fail. */
     request_new_unit_activity(punit, ACTIVITY_IDLE);
     unit_focus_try(punit);
   }
@@ -2921,9 +2918,6 @@ static void supported_unit_activate_close_callback(GSimpleAction *action,
     struct city *pcity =
       player_city_by_number(client_player(), punit->homecity);
 
-    /* FIXME: If unit is not idle to begin with, we can only request
-     *        idling, and as we have no server reply yet,
-     *        the unit_focus_try() below will fail. */
     request_new_unit_activity(punit, ACTIVITY_IDLE);
     unit_focus_try(punit);
 
@@ -2953,9 +2947,6 @@ static void present_unit_activate_close_callback(GSimpleAction *action,
   if (NULL != punit) {
     struct city *pcity = tile_city(unit_tile(punit));
 
-    /* FIXME: If unit is not idle to begin with, we can only request
-     *        idling, and as we have no server reply yet,
-     *        the unit_focus_try() below will fail. */
     request_new_unit_activity(punit, ACTIVITY_IDLE);
     unit_focus_try(punit);
 
diff --git a/client/gui-gtk-4.0/unitselect.c b/client/gui-gtk-4.0/unitselect.c
index 56be52d41b..180c27e7a7 100644
--- a/client/gui-gtk-4.0/unitselect.c
+++ b/client/gui-gtk-4.0/unitselect.c
@@ -1173,9 +1173,6 @@ static void usdlg_cmd_focus_real(GtkTreeView *view)
 
     punit = player_unit_by_number(client_player(), uid);
     if (punit && unit_owner(punit) == client_player()) {
-      /* FIXME: If unit is not idle to begin with, we can only request
-       *        idling, and as we have no server reply yet,
-       *        the unit_focus_try() below will fail. */
       request_new_unit_activity(punit, ACTIVITY_IDLE);
       unit_focus_try(punit);
       usdlg_destroy();
diff --git a/client/gui-gtk-5.0/citydlg.c b/client/gui-gtk-5.0/citydlg.c
index e12faddb13..375568c3ce 100644
--- a/client/gui-gtk-5.0/citydlg.c
+++ b/client/gui-gtk-5.0/citydlg.c
@@ -3174,9 +3174,6 @@ static void unit_activate_callback(GSimpleAction *action, GVariant *parameter,
     player_unit_by_number(client_player(), GPOINTER_TO_INT(data));
 
   if (NULL != punit) {
-    /* FIXME: If unit is not idle to begin with, we can only request
-     *        idling, and as we have no server reply yet,
-     *        the unit_focus_try() below will fail. */
     request_new_unit_activity(punit, ACTIVITY_IDLE);
     unit_focus_try(punit);
   }
diff --git a/client/gui-gtk-5.0/unitselect.c b/client/gui-gtk-5.0/unitselect.c
index 1804d7fc5d..0ae841c9d5 100644
--- a/client/gui-gtk-5.0/unitselect.c
+++ b/client/gui-gtk-5.0/unitselect.c
@@ -1173,9 +1173,6 @@ static void usdlg_cmd_focus_real(GtkTreeView *view)
 
     punit = player_unit_by_number(client_player(), uid);
     if (punit && unit_owner(punit) == client_player()) {
-      /* FIXME: If unit is not idle to begin with, we can only request
-       *        idling, and as we have no server reply yet,
-       *        the unit_focus_try() below will fail. */
       request_new_unit_activity(punit, ACTIVITY_IDLE);
       unit_focus_try(punit);
       usdlg_destroy();
-- 
2.47.3

