Author: cazfi
Date: Wed Dec 17 19:18:33 2014
New Revision: 27327

URL: http://svn.gna.org/viewcvs/freeciv?rev=27327&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:
    branches/S2_5/ai/threaded/taicity.c

Modified: branches/S2_5/ai/threaded/taicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/ai/threaded/taicity.c?rev=27327&r1=27326&r2=27327&view=diff
==============================================================================
--- branches/S2_5/ai/threaded/taicity.c (original)
+++ branches/S2_5/ai/threaded/taicity.c Wed Dec 17 19:18:33 2014
@@ -64,29 +64,31 @@
 
   city_tile_iterate_index(city_map_radius_sq_get(pcity), city_tile(pcity),
                           ptile, cindex) {
-    bool consider = TRUE;
     int orig_value;
 
     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;
-    }
-
     orig_value = city_tile_value(pcity, ptile, 0, 0);
 
     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