Author: cazfi
Date: Wed Dec 17 19:18:25 2014
New Revision: 27326

URL: http://svn.gna.org/viewcvs/freeciv?rev=27326&view=rev
Log:
Avoid Threaded AI cities from switch to a new Worker Task too early. Wait until
worker has really started the previous one.

See bug #23081

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=27326&r1=27325&r2=27326&view=diff
==============================================================================
--- trunk/ai/threaded/taicity.c (original)
+++ trunk/ai/threaded/taicity.c Wed Dec 17 19:18:25 2014
@@ -103,24 +103,10 @@
 
   city_tile_iterate_index(city_map_radius_sq_get(pcity), city_tile(pcity),
                           ptile, cindex) {
-    bool consider = TRUE;
     int orig_value;
     bool potential_worst_worked = FALSE;
 
     if (!city_can_work_tile(pcity, ptile)) {
-      continue;
-    }
-
-    /* Do not go to tiles that already have workers there. */
-    unit_list_iterate(ptile->units, aunit) {
-      if (unit_owner(aunit) == pplayer
-          && unit_has_type_flag(aunit, UTYF_SETTLERS)) {
-        consider = FALSE;
-        break;
-      }
-    } unit_list_iterate_end;
-
-    if (!consider) {
       continue;
     }
 
@@ -133,6 +119,22 @@
     }
 
     activity_type_iterate(act) {
+      bool consider = TRUE;
+
+      /* Do not request activities that already are under way. */
+      unit_list_iterate(ptile->units, punit) {
+        if (unit_owner(punit) == pplayer
+            && unit_has_type_flag(punit, UTYF_SETTLERS)
+            && punit->activity == act) {
+          consider = FALSE;
+          break;
+        }
+      } unit_list_iterate_end;
+
+      if (!consider) {
+        continue;
+      }
+
       if (act == ACTIVITY_IRRIGATE
           || act == ACTIVITY_MINE
           || act == ACTIVITY_POLLUTION


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

Reply via email to