From a9a5163f8425f6d70d9c82c46f6de191b88bdf8f Mon Sep 17 00:00:00 2001
From: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Date: Sat, 14 Nov 2026 13:55:07 -0800
Subject: [PATCH] find_rampage_target(): Accept a want equal to the threshold

dai_rampage_want() rates an empty enemy city at exactly
RAMPAGE_FREE_CITY_OR_BETTER, and callers that should move only for
such a city pass that same value as thresh_move. The test was
want > thresh, so those callers never take an empty enemy city:
bodyguards, defenders, units recovering hit points and landed
paratroopers walk past one within a move.

Test want >= thresh, as the "_OR_BETTER" names say. "Nothing" is want
0, so RAMPAGE_ANYTHING still means any positive want.

See RM #2484

Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
---
 ai/default/daiunit.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ai/default/daiunit.c b/ai/default/daiunit.c
index 997db790d5..9b0c38cf79 100644
--- a/ai/default/daiunit.c
+++ b/ai/default/daiunit.c
@@ -633,9 +633,9 @@ static struct pf_path *find_rampage_target(struct unit *punit,
     thresh = (move_needed ? thresh_move : thresh_adj);
     want = (want < 0 ? -want : want);
 
-    if (want > max_want && want > thresh) {
-      /* The new want exceeds both the previous maximum
-       * and the relevant threshold, so it's worth recording */
+    if (want > max_want && want >= thresh) {
+      /* The new want exceeds the previous maximum and reaches
+       * the relevant threshold, so it's worth recording */
       max_want = want;
       ptile = iter_tile;
     }
-- 
2.55.0

