Author: sveinung Date: Wed Dec 24 14:45:54 2014 New Revision: 27400 URL: http://svn.gna.org/viewcvs/freeciv?rev=27400&view=rev Log: SDL clients: Enable the trade route button based on ability to trade
A unit may have the TradeRoute unit flag and not be able to establish a trade route. Another unit may not have the TradeRoute unit flag and still be able to establish a trade route. Check for the ability to establish a trade route in stead of the TradeRoute flag when deciding if the establish trade route button should be shown or not. See patch #5599 Modified: trunk/client/gui-sdl/menu.c trunk/client/gui-sdl2/menu.c Modified: trunk/client/gui-sdl/menu.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl/menu.c?rev=27400&r1=27399&r2=27400&view=diff ============================================================================== --- trunk/client/gui-sdl/menu.c (original) +++ trunk/client/gui-sdl/menu.c Wed Dec 24 14:45:54 2014 @@ -1140,8 +1140,9 @@ set_wflag(pOrder_Road_Button, WF_HIDDEN); } - /* unit_can_est_trade_route_here(pUnit) */ - if (pCity && unit_has_type_flag(pUnit, UTYF_TRADE_ROUTE) + /* unit_can_est_trade_route_here(pUnit) */ + if (pCity && utype_can_do_action(unit_type(pUnit), + ACTION_TRADE_ROUTE) && (pHomecity = game_city_by_number(pUnit->homecity)) && can_cities_trade(pHomecity, pCity)) { int revenue = get_caravan_enter_city_trade_bonus(pHomecity, pCity); Modified: trunk/client/gui-sdl2/menu.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/menu.c?rev=27400&r1=27399&r2=27400&view=diff ============================================================================== --- trunk/client/gui-sdl2/menu.c (original) +++ trunk/client/gui-sdl2/menu.c Wed Dec 24 14:45:54 2014 @@ -1131,7 +1131,8 @@ } /* unit_can_est_trade_route_here(pUnit) */ - if (pCity && unit_has_type_flag(pUnit, UTYF_TRADE_ROUTE) + if (pCity && utype_can_do_action(unit_type(pUnit), + ACTION_TRADE_ROUTE) && (pHomecity = game_city_by_number(pUnit->homecity)) && can_cities_trade(pHomecity, pCity)) { int revenue = get_caravan_enter_city_trade_bonus(pHomecity, pCity); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits