From f45c540de23435d004485868202ebe546a0e6308 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Wed, 5 Feb 2025 21:02:00 +0200
Subject: [PATCH 37/37] AI: Pass civ_map to kill_something_with()

See RM #1235

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 ai/default/daimilitary.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ai/default/daimilitary.c b/ai/default/daimilitary.c
index 0e3a51b2f8..778a493817 100644
--- a/ai/default/daimilitary.c
+++ b/ai/default/daimilitary.c
@@ -1516,6 +1516,7 @@ static void process_attacker_want(struct ai_type *ait,
   to carry a land attack unit, instead of the land attack unit itself.
 **************************************************************************/
 static struct adv_choice *kill_something_with(struct ai_type *ait,
+                                              const struct civ_map *nmap,
                                               struct player *pplayer,
                                               struct city *pcity, struct unit *myunit,
                                               struct adv_choice *choice)
@@ -1542,7 +1543,6 @@ static struct adv_choice *kill_something_with(struct ai_type *ait,
   struct adv_choice *best_choice;
   struct ai_city *city_data = def_ai_city_data(pcity, ait);
   struct ai_city *acity_data;
-  struct civ_map *nmap = &(wld.map);
 
   best_choice = adv_new_choice();
   best_choice->value.utype = unit_type_get(myunit);
@@ -2027,7 +2027,7 @@ struct adv_choice *military_advisor_choose_build(struct ai_type *ait,
     virtualunit = unit_virtual_create(
       pplayer, pcity, punittype,
       city_production_unit_veteran_level(pcity, punittype));
-    choice = kill_something_with(ait, pplayer, pcity, virtualunit, choice);
+    choice = kill_something_with(ait, nmap, pplayer, pcity, virtualunit, choice);
     unit_virtual_destroy(virtualunit);
   }
 
@@ -2037,7 +2037,7 @@ struct adv_choice *military_advisor_choose_build(struct ai_type *ait,
   punittype = dai_choose_attacker(ait, nmap, pcity, TC_LAND, allow_gold_upkeep);
   if (punittype) {
     virtualunit = unit_virtual_create(pplayer, pcity, punittype, 1);
-    choice = kill_something_with(ait, pplayer, pcity, virtualunit, choice);
+    choice = kill_something_with(ait, nmap, pplayer, pcity, virtualunit, choice);
     unit_virtual_destroy(virtualunit);
   }
 
-- 
2.47.2

