Author: sveinung Date: Thu Dec 25 22:14:51 2014 New Revision: 27409 URL: http://svn.gna.org/viewcvs/freeciv?rev=27409&view=rev Log: AI: Get a fall back trade route unit to build of one exists.
Request the best unit capable of the action Establish Trade Route in stead of requesting the best unit with the TradeRoute unit type flag and aborting if it can't do Establish Trade Route. This adds support for rulesets where a unit without the TradeRoute unit type flag is capable of the Establish Trade Route action or where a unit with the TradeRoute flag incapable of establishing a trade route is "better" than one that can. See patch #5602 Modified: trunk/ai/default/aicity.c Modified: trunk/ai/default/aicity.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aicity.c?rev=27409&r1=27408&r2=27409&view=diff ============================================================================== --- trunk/ai/default/aicity.c (original) +++ trunk/ai/default/aicity.c Thu Dec 25 22:14:51 2014 @@ -298,11 +298,9 @@ CITY_LOG(LOG_WANT, pcity, "Falling back - didn't want to build soldiers," " workers, caravans, settlers, or buildings!"); city_data->choice.want = 1; - if (best_role_unit(pcity, UTYF_TRADE_ROUTE) - && utype_can_do_action(best_role_unit(pcity, UTYF_TRADE_ROUTE), - ACTION_TRADE_ROUTE)) { + if (best_role_unit(pcity, action_get_role(ACTION_TRADE_ROUTE))) { city_data->choice.value.utype - = best_role_unit(pcity, UTYF_TRADE_ROUTE); + = best_role_unit(pcity, action_get_role(ACTION_TRADE_ROUTE)); city_data->choice.type = CT_CIVILIAN; } else if (best_role_unit(pcity, UTYF_SETTLERS)) { city_data->choice.value.utype _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits