Author: cazfi
Date: Sun Nov 23 03:58:54 2014
New Revision: 27112

URL: http://svn.gna.org/viewcvs/freeciv?rev=27112&view=rev
Log:
Give workers zero want if they are not an viable option at all. This used to 
remember previous
want, potentially causing workers to be built when it made no sense at all.

See bug #22972

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

Modified: branches/S2_5/ai/default/aicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/ai/default/aicity.c?rev=27112&r1=27111&r2=27112&view=diff
==============================================================================
--- branches/S2_5/ai/default/aicity.c   (original)
+++ branches/S2_5/ai/default/aicity.c   Sun Nov 23 03:58:54 2014
@@ -657,6 +657,9 @@
   struct unit_type *unit_type = dai_role_utype_for_move_type(pcity, 
UTYF_SETTLERS,
                                                              UMT_LAND);
   Continent_id place = tile_continent(pcenter);
+  struct ai_city *city_data = def_ai_city_data(pcity, ait);
+
+  city_data->settler_want = 0; /* Make sure old want does not stay if we don't 
want now */
 
   if (unit_type == NULL) {
     log_debug("No UTYF_SETTLERS role unit available");
@@ -699,7 +702,7 @@
            ai->stats.cities[place]);
   fc_assert(want >= 0);
 
-  def_ai_city_data(pcity, ait)->settler_want = want;
+  city_data->settler_want = want;
 }
 
 /**************************************************************************


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

Reply via email to