Author: cazfi
Date: Sun Aug  7 07:40:02 2016
New Revision: 33482

URL: http://svn.gna.org/viewcvs/freeciv?rev=33482&view=rev
Log:
Removed premature optimization that lead AI caravans not to check target city 
suitability
when planning missions.

See bug #24920

Modified:
    branches/S2_6/common/aicore/caravan.c

Modified: branches/S2_6/common/aicore/caravan.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/aicore/caravan.c?rev=33482&r1=33481&r2=33482&view=diff
==============================================================================
--- branches/S2_6/common/aicore/caravan.c       (original)
+++ branches/S2_6/common/aicore/caravan.c       Sun Aug  7 07:40:02 2016
@@ -474,32 +474,21 @@
     return FALSE;
   }
 
-  /* Make sure that the caravan gets a new target in cases were the old
-   * target turned out to be of no use because of action enablers. */
-  if (real_map_distance(dest->tile, unit_tile(caravan)) <= 1) {
-    /* The caravan is close enought to its target to do a full check.
-     * A caravan can be close enough to max 9 cities in the worst
-     * theoretically possible case. (More than one city is rare.) The
-     * computations are therefore worth it. */
-
-    consider_wonder = is_action_enabled_unit_on_city_full(ACTION_HELP_WONDER,
-                                                          caravan, dest,
-                                                          src);
-    consider_trade = is_action_enabled_unit_on_city_full(ACTION_TRADE_ROUTE,
-                                                         caravan, dest,
-                                                         src);
-    consider_windfall = is_action_enabled_unit_on_city_full(ACTION_MARKETPLACE,
-                                                            caravan, dest,
-                                                            src);
-    if (!consider_wonder && !consider_trade && !consider_windfall) {
-      /* No caravan action is possible against this target. */
-      caravan_result_init_zero(result);
-      return FALSE;
-    }
-  } else {
-    consider_wonder = parameter->consider_wonders;
-    consider_trade = parameter->consider_trade;
-    consider_windfall = parameter->consider_windfall;
+  consider_wonder = parameter->consider_wonders
+    && is_action_enabled_unit_on_city_full(ACTION_HELP_WONDER,
+                                           caravan, dest, src);
+  consider_trade = parameter->consider_trade
+    && is_action_enabled_unit_on_city_full(ACTION_TRADE_ROUTE,
+                                           caravan, dest, src);
+  consider_windfall = parameter->consider_windfall
+    && is_action_enabled_unit_on_city_full(ACTION_MARKETPLACE,
+                                           caravan, dest, src);
+
+  if (!consider_wonder && !consider_trade && !consider_windfall) {
+    /* No caravan action is possible against this target. */
+    caravan_result_init_zero(result);
+
+    return FALSE;
   }
 
   trade = trade_benefit(pplayer_src, src, dest, parameter);


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

Reply via email to