Author: cazfi
Date: Mon Dec 22 23:40:31 2014
New Revision: 27388

URL: http://svn.gna.org/viewcvs/freeciv?rev=27388&view=rev
Log:
Fixed Threaded AI workers to improve also already worked tiles.

See bug #23096

Modified:
    trunk/ai/threaded/taicity.c

Modified: trunk/ai/threaded/taicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/threaded/taicity.c?rev=27388&r1=27387&r2=27388&view=diff
==============================================================================
--- trunk/ai/threaded/taicity.c (original)
+++ trunk/ai/threaded/taicity.c Mon Dec 22 23:40:31 2014
@@ -93,6 +93,7 @@
   int uw_max = 0;
   int worst_worked = FC_INFINITY;
   int old_worst_worked = FC_INFINITY;
+  int orig_worst_worked = 0;
   struct unit_list *units = NULL;
 
   switch (limit) {
@@ -115,6 +116,7 @@
     if (tile_worked(ptile) == pcity
         && orig_value < worst_worked) {
       worst_worked = orig_value;
+      orig_worst_worked = orig_value;
       potential_worst_worked = TRUE;
     }
 
@@ -319,7 +321,8 @@
     }
   } city_tile_iterate_end;
 
-  if (old_worst_worked < uw_max || worked.ptile == NULL) {
+  if (worked.ptile == NULL
+      || (old_worst_worked < uw_max && uw_max - orig_worst_worked > 
worked.want)) {
     /* It's better to improve best yet unworked tile and take it to use after 
that,
        than to improve already worked tile. */
     selected = &unworked;


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

Reply via email to