From 59bd5029290fd10721cf86328e7b81f86d391641 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 12 Sep 2026 20:04:38 +0300
Subject: [PATCH 70/70] Move count_diplomats_on_tile() from server to default
 AI

See RM #2243

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 ai/default/daidiplomat.c | 16 ++++++++++++++++
 server/diplomats.c       | 18 +-----------------
 server/diplomats.h       |  2 --
 3 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/ai/default/daidiplomat.c b/ai/default/daidiplomat.c
index 27b40cf162..45a0bc381d 100644
--- a/ai/default/daidiplomat.c
+++ b/ai/default/daidiplomat.c
@@ -88,6 +88,22 @@ static void find_city_to_diplomat(struct player *pplayer, struct unit *punit,
                                   struct city **ctarget, int *move_dist,
                                   struct pf_map *pfm);
 
+/************************************************************************//**
+  Return number of diplomats on this square.  AJS 20000130
+****************************************************************************/
+static int count_diplomats_on_tile(struct tile *ptile)
+{
+  int count = 0;
+
+  unit_list_iterate((ptile)->units, punit) {
+    if (unit_has_type_flag(punit, UTYF_DIPLOMAT)) {
+      count++;
+    }
+  } unit_list_iterate_end;
+
+  return count;
+}
+
 /**************************************************************************//**
   Number of techs that we don't have and the enemy (tplayer) does.
 ******************************************************************************/
diff --git a/server/diplomats.c b/server/diplomats.c
index a2a0af496e..3b78f55c01 100644
--- a/server/diplomats.c
+++ b/server/diplomats.c
@@ -2481,7 +2481,7 @@ bool spy_escape(struct player *pplayer,
     vlink = tile_link(target_tile);
   }
 
-  /* this may cause a diplomatic incident */
+  /* This may cause a diplomatic incident */
   action_consequence_success(paction, pplayer, act_utype,
                              tile_owner(target_tile),
                              target_tile, vlink);
@@ -2492,19 +2492,3 @@ bool spy_escape(struct player *pplayer,
 
   return TRUE;
 }
-
-/************************************************************************//**
-  Return number of diplomats on this square.  AJS 20000130
-****************************************************************************/
-int count_diplomats_on_tile(struct tile *ptile)
-{
-  int count = 0;
-
-  unit_list_iterate((ptile)->units, punit) {
-    if (unit_has_type_flag(punit, UTYF_DIPLOMAT)) {
-      count++;
-    }
-  } unit_list_iterate_end;
-
-  return count;
-}
diff --git a/server/diplomats.h b/server/diplomats.h
index 7f82fb6faa..3ea7fa2e3e 100644
--- a/server/diplomats.h
+++ b/server/diplomats.h
@@ -62,6 +62,4 @@ bool spy_escape(struct player *pplayer,
                 struct tile *target_tile,
                 const struct action *paction);
 
-int count_diplomats_on_tile(struct tile *ptile);
-
 #endif /* FC__DIPLOMATS_H */
-- 
2.53.0

