Author: sveinung
Date: Sun Oct 11 19:19:34 2015
New Revision: 30050

URL: http://svn.gna.org/viewcvs/freeciv?rev=30050&view=rev
Log:
ai: hostile actors shouldn't fight en route

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.

Before this patch dai_fill_unit_paramdai_fill_unit_param() would set the
tile behavior for units capable of performing hostile actions in a way that
assumed they could walk through enemy units and cities.

The hostile actions are most of the spy actions, "Capture Units", "Bombard",
"Explode Nuclear", "Destroy City" and "Expel Unit". The actions "Capture
Units", "Bombard" and "Explode Nuclear" were split out from the regular
military attack. "Destroy City" and "Expel Unit" are new.

Before the attack actions were separated from the regular attack to become
action enabler controlled dai_fill_unit_paramdai_fill_unit_param() would set
the tile behavior of units capable of doing them based on their task. In
most cases they would be set to no intermediate fights. That changed when
they became action enabler controlled and labeled hostile.

The code used to perform military attacks, both the regular attack and the
action enabler controlled attacks, shouldn't set path finding parameters via
dai_fill_unit_paramdai_fill_unit_param(). Doing it would result in a unit
capable of performing a regular attack but not capable of performing an
action enabler controlled action labeled hostile having its tile behavior
set to no intermediate fights. That could be exploited by using a low value
target, not worth attacking, to block the path to a high value target.

The code used to perform a spy action doesn't set path finding parameters
via dai_fill_unit_paramdai_fill_unit_param(). It sets tile behavior to no
intermediate fights.

Make dai_fill_unit_paramdai_fill_unit_param() set the path finding tile
behavior of hostile actors to no intermediate fights.

See patch #6400

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=30050&r1=30049&r2=30050&view=diff
==============================================================================
--- trunk/ai/default/aitools.c  (original)
+++ trunk/ai/default/aitools.c  Sun Oct 11 19:19:34 2015
@@ -561,7 +561,7 @@
   }
 
   if (utype_acts_hostile(unit_type(punit))) {
-    /* Default tile behaviour */
+    parameter->get_TB = no_intermediate_fights;
   } else if (unit_has_type_flag(punit, UTYF_SETTLERS)) {
     parameter->get_TB = no_fights;
   } else if (long_path && unit_is_cityfounder(punit)) {


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

Reply via email to