Author: sveinung Date: Tue Oct 13 19:34:42 2015 New Revision: 30067 URL: http://svn.gna.org/viewcvs/freeciv?rev=30067&view=rev Log: ai pf: handle actors like military units
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 the custom path finding tile behavior assignment of military units handle units capable of doing a non specific action too. A consequence is that an actor's AI task starts to matter for what tile behavior the unit gets. It is mostly theoretical. A unit's ability to perform a certain action tends to correlate with its mission. See patch #6408 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=30067&r1=30066&r2=30067&view=diff ============================================================================== --- trunk/ai/default/aitools.c (original) +++ trunk/ai/default/aitools.c Tue Oct 13 19:34:42 2015 @@ -560,9 +560,7 @@ parameter->get_zoc = NULL; } - if (utype_acts_hostile(unit_type_get(punit))) { - parameter->get_TB = no_intermediate_fights; - } else if (unit_has_type_flag(punit, UTYF_SETTLERS)) { + if (unit_has_type_flag(punit, UTYF_SETTLERS)) { parameter->get_TB = no_fights; } else if (long_path && unit_is_cityfounder(punit)) { /* Default tile behaviour; @@ -573,12 +571,6 @@ } else if (unit_is_cityfounder(punit)) { /* Short path */ parameter->get_TB = no_fights; - } else if (utype_may_act_at_all(unit_type_get(punit)) - && !(utype_acts_hostile(unit_type_get(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; } else if (unit_has_type_role(punit, L_BARBARIAN_LEADER)) { /* Avoid capture */ parameter->get_TB = no_fights; @@ -588,7 +580,8 @@ } else if (is_losing_hp(punit)) { /* Losing hitpoints over time (helicopter in default rules) */ /* Default tile behaviour */ - } else if (is_military_unit(punit)) { + } else if (is_military_unit(punit) + || utype_may_act_at_all(unit_type_get(punit))) { switch (unit_data->task) { case AIUNIT_AUTO_SETTLER: case AIUNIT_BUILD_CITY: @@ -596,7 +589,7 @@ parameter->get_TB = no_fights; break; case AIUNIT_DEFEND_HOME: - case AIUNIT_ATTACK: + case AIUNIT_ATTACK: /* Includes spy actions */ case AIUNIT_ESCORT: case AIUNIT_HUNTER: case AIUNIT_TRADE: _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits