Author: sveinung
Date: Wed Dec 10 03:23:53 2014
New Revision: 27226

URL: http://svn.gna.org/viewcvs/freeciv?rev=27226&view=rev
Log:
AI: Don't build a unit to chase a foreign unit that can't do hostile actions.

The AI function find_something_to_kill() tests if it is worth to build a new
unit to chase a foreign unit. Check if the foreign unit is capable of performing
any hostile actions in stead of looking for the TradeRoute flag.

A unit may have the trade route flag without being able to establish a trade
route or entering a market place. A unit may have the trade route flag and still
be able to perform hostile actions. Killing a unit that only is capable of
establishing an embassy isn't worth producing a new unit.

See patch #5495

Modified:
    trunk/ai/default/aiunit.c

Modified: trunk/ai/default/aiunit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aiunit.c?rev=27226&r1=27225&r2=27226&view=diff
==============================================================================
--- trunk/ai/default/aiunit.c   (original)
+++ trunk/ai/default/aiunit.c   Wed Dec 10 03:23:53 2014
@@ -1492,9 +1492,11 @@
       }
 
       if ((unit_has_type_flag(aunit, UTYF_CIVILIAN)
-           || unit_has_type_flag(aunit, UTYF_TRADE_ROUTE))
+           || (is_actor_unit(aunit)
+               && !utype_acts_hostile(unit_type(aunit))))
           && 0 == punit->id) {
-        /* We will not build units just to chase caravans. */
+        /* We will not build units just to chase caravans and
+         * ambassadors. */
         continue;
       }
 


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

Reply via email to