Author: cazfi
Date: Sun Nov  1 18:55:12 2015
New Revision: 30353

URL: http://svn.gna.org/viewcvs/freeciv?rev=30353&view=rev
Log:
Work around a problem of defense bonus originating from a source not counting as
'wall', in the default AI terminology, reducing defender want.

See bug #23997

Modified:
    trunk/ai/default/advmilitary.c

Modified: trunk/ai/default/advmilitary.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/advmilitary.c?rev=30353&r1=30352&r2=30353&view=diff
==============================================================================
--- trunk/ai/default/advmilitary.c      (original)
+++ trunk/ai/default/advmilitary.c      Sun Nov  1 18:55:12 2015
@@ -795,9 +795,15 @@
       int limit_cost = pcity->shield_stock + 40;
 
       if (walls && !utype_has_flag(punittype, UTYF_BADCITYDEFENDER)) {
-       desire *= city_data->wallvalue;
-       /* TODO: More use of POWER_FACTOR ! */
-       desire /= POWER_FACTOR;
+        /* FIXME: Below if() is just workaround to make sure desire
+         *        is not made zero when 'walls' above is not actually
+         *        walls that increase wallvalue, but misdiagnosed
+         *        because of some other defense bonus the city gets. */
+        if (city_data->wallvalue > POWER_FACTOR) {
+          desire *= city_data->wallvalue;
+          /* TODO: More use of POWER_FACTOR ! */
+          desire /= POWER_FACTOR;
+        }
       }
 
       if ((best_unit_cost > limit_cost


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

Reply via email to