Author: sveinung Date: Wed Sep 16 13:12:55 2015 New Revision: 29904 URL: http://svn.gna.org/viewcvs/freeciv?rev=29904&view=rev Log: Be action enabler aware in can build wonder check
See patch #6355 Modified: branches/S2_6/common/unit.c branches/S2_6/common/unit.h Modified: branches/S2_6/common/unit.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/unit.c?rev=29904&r1=29903&r2=29904&view=diff ============================================================================== --- branches/S2_6/common/unit.c (original) +++ branches/S2_6/common/unit.c Wed Sep 16 13:12:55 2015 @@ -191,36 +191,18 @@ } /************************************************************************** - Return TRUE iff this unit can be disbanded at the given city to get full - shields for building a wonder. -**************************************************************************/ -bool unit_can_help_build_wonder(const struct unit *punit, - const struct city *pcity) -{ - if (!is_tiles_adjacent(unit_tile(punit), pcity->tile) - && !same_pos(unit_tile(punit), pcity->tile)) { - return FALSE; - } - - return (utype_can_do_action(unit_type(punit), ACTION_HELP_WONDER) - && VUT_IMPROVEMENT == pcity->production.kind - && is_wonder(pcity->production.value.building) - && (pcity->shield_stock - < impr_build_shield_cost(pcity->production.value.building))); -} - - -/************************************************************************** - Return TRUE iff this unit can be disbanded at its current position to - get full shields for building a wonder. + Return TRUE unless it is known to be imposible to disband this unit at + its current position to get full shields for building a wonder. **************************************************************************/ bool unit_can_help_build_wonder_here(const struct unit *punit) { struct city *pcity = tile_city(unit_tile(punit)); - return pcity && unit_can_help_build_wonder(punit, pcity); -} - + return (pcity + && action_prob_possible(action_prob_vs_city(punit, + ACTION_HELP_WONDER, + pcity))); +} /************************************************************************** Return TRUE iff this unit can be disbanded at its current location to Modified: branches/S2_6/common/unit.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/unit.h?rev=29904&r1=29903&r2=29904&view=diff ============================================================================== --- branches/S2_6/common/unit.h (original) +++ branches/S2_6/common/unit.h Wed Sep 16 13:12:55 2015 @@ -247,8 +247,6 @@ activity_type_list_iterate_end \ } -bool unit_can_help_build_wonder(const struct unit *punit, - const struct city *pcity); bool unit_can_help_build_wonder_here(const struct unit *punit); bool unit_can_est_trade_route_here(const struct unit *punit); enum unit_airlift_result _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits