Author: cazfi
Date: Mon Nov 16 22:10:01 2015
New Revision: 30648

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

See patch #6591

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

Modified: branches/S2_5/ai/default/advmilitary.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/ai/default/advmilitary.c?rev=30648&r1=30647&r2=30648&view=diff
==============================================================================
--- branches/S2_5/ai/default/advmilitary.c      (original)
+++ branches/S2_5/ai/default/advmilitary.c      Mon Nov 16 22:10:01 2015
@@ -464,6 +464,7 @@
   int total_danger = 0;
   int defense_bonuses[U_LAST];
   bool defender_type_handled[U_LAST];
+  int assess_turns;
 
   TIMING_LOG(AIT_DANGER, TIMER_START);
 
@@ -522,23 +523,21 @@
     }
   } unit_list_iterate_end;
 
+  if (player_is_cpuhog(pplayer)) {
+    assess_turns = 6;
+  } else {
+    assess_turns = 3;
+  }
 
   /* Check. */
   players_iterate(aplayer) {
     struct pf_reverse_map *pcity_map;
-    int assess_turns;
 
     if (!adv_is_player_dangerous(pplayer, aplayer)) {
       continue;
     }
     /* 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);
 


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

Reply via email to