Author: cazfi
Date: Mon Nov 16 22:09:56 2015
New Revision: 30647

URL: http://svn.gna.org/viewcvs/freeciv?rev=30647&view=rev
Log:
setup assess_turns outside loop in AI assess_danger()

See patch #6591

Modified:
    branches/S2_6/ai/default/advmilitary.c

Modified: branches/S2_6/ai/default/advmilitary.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/ai/default/advmilitary.c?rev=30647&r1=30646&r2=30647&view=diff
==============================================================================
--- branches/S2_6/ai/default/advmilitary.c      (original)
+++ branches/S2_6/ai/default/advmilitary.c      Mon Nov 16 22:09:56 2015
@@ -474,6 +474,8 @@
   int total_danger = 0;
   int defense_bonuses[U_LAST];
   bool defender_type_handled[U_LAST];
+  int assess_turns;
+  bool omnimap;
 
   TIMING_LOG(AIT_DANGER, TIMER_START);
 
@@ -532,11 +534,17 @@
     }
   } unit_list_iterate_end;
 
+  if (player_is_cpuhog(pplayer)) {
+    assess_turns = 6;
+  } else {
+    assess_turns = 3;
+  }
+
+  omnimap = !has_handicap(pplayer, H_MAP);
 
   /* Check. */
   players_iterate(aplayer) {
     struct pf_reverse_map *pcity_map;
-    int assess_turns;
 
     if (!adv_is_player_dangerous(pplayer, aplayer)) {
       continue;
@@ -544,14 +552,8 @@
     /* Note that we still consider the units of players we are not (yet)
      * at war with. */
 
-    if (player_is_cpuhog(pplayer)) {
-      assess_turns = 6;
-    } else {
-      assess_turns = 3;
-    }
-
     pcity_map = pf_reverse_map_new_for_city(pcity, aplayer, assess_turns,
-                                            !has_handicap(pplayer, H_MAP));
+                                            omnimap);
 
     unit_list_iterate(aplayer->units, punit) {
       int move_time;


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to