Author: sveinung
Date: Wed Dec 10 14:29:36 2014
New Revision: 27234

URL: http://svn.gna.org/viewcvs/freeciv?rev=27234&view=rev
Log:
Client: Make the sanity test in key_unit_trade_route() stricter.

The common client code's function key_unit_trade_route() checks that the actor
unit given to it by the client has the TradeRoute unit type flag before
forwarding the request to the server. This way the server won't be bothered by
theoretically impossible requests.

Because action enablers now control the establish trade route action it is
possible to have a unit type with the TradeRoute flag that never can establish a
trade route. Change the test to check for the unit type's ability to do the
establish trade route action instead.

See patch #5516

Modified:
    trunk/client/control.c

Modified: trunk/client/control.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/control.c?rev=27234&r1=27233&r2=27234&view=diff
==============================================================================
--- trunk/client/control.c      (original)
+++ trunk/client/control.c      Wed Dec 10 14:29:36 2014
@@ -2812,7 +2812,9 @@
 void key_unit_trade_route(void)
 {
   unit_list_iterate(get_units_in_focus(), punit) {
-    if (unit_has_type_flag(punit, UTYF_TRADE_ROUTE)) {
+    /* TODO: Is falling back on ACTION_MARKETPLACE if not able to establish
+     * a trade route trade a good idea or an unplecant surprice? */
+    if (unit_can_do_action(punit, ACTION_TRADE_ROUTE)) {
       request_unit_caravan_action(punit, ACTION_TRADE_ROUTE);
     }
   } unit_list_iterate_end;


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

Reply via email to