Author: sveinung
Date: Fri Oct  9 06:52:36 2015
New Revision: 30035

URL: http://svn.gna.org/viewcvs/freeciv?rev=30035&view=rev
Log:
ai path finding: check mission for armed actors

It is reasonable to assume that a military unit is capable of performing a
hostile action. The particular action doesn't have to be action enabler
controlled.

The function dai_fill_unit_paramdai_fill_unit_param() sets the path finding
parameters for an ai unit in some situations. Examples are moving a unit to
a safe city and moving a barbarian leader to a safe tile.

Have it assign path finding tile behavior for military AI units based on
their task even if all action enabler controlled actions they can perform
are non hostile.

See patch #6399

Modified:
    trunk/ai/default/aitools.c

Modified: trunk/ai/default/aitools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aitools.c?rev=30035&r1=30034&r2=30035&view=diff
==============================================================================
--- trunk/ai/default/aitools.c  (original)
+++ trunk/ai/default/aitools.c  Fri Oct  9 06:52:36 2015
@@ -574,7 +574,8 @@
     /* Short path */
     parameter->get_TB = no_fights;
   } else if (utype_may_act_at_all(unit_type(punit))
-             && !utype_acts_hostile(unit_type(punit))) {
+             && !(utype_acts_hostile(unit_type(punit))
+                                     || is_military_unit(punit))) {
     /* While the AI currently won't establish a trade route to a non ally
      * it will establish an embassy. */
     parameter->get_TB = no_intermediate_fights;
@@ -598,6 +599,8 @@
     case AIUNIT_ATTACK:
     case AIUNIT_ESCORT:
     case AIUNIT_HUNTER:
+    case AIUNIT_TRADE:
+    case AIUNIT_WONDER:
       parameter->get_TB = no_intermediate_fights;
       break;
     case AIUNIT_EXPLORE:


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

Reply via email to