Author: sveinung
Date: Sun Aug 16 10:37:51 2015
New Revision: 29543

URL: http://svn.gna.org/viewcvs/freeciv?rev=29543&view=rev
Log:
Isolate force_trade_route handling

from other hard requirements.

See patch #6238

Modified:
    trunk/common/actions.c

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=29543&r1=29542&r2=29543&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Sun Aug 16 10:37:51 2015
@@ -509,6 +509,17 @@
 }
 
 /**************************************************************************
+  Returns TRUE iff trade route establishing is forced and possible.
+**************************************************************************/
+static bool trade_route_blocks(const struct unit *actor_unit,
+                               const struct city *target_city)
+{
+  return (game.info.force_trade_route
+          && is_action_enabled_unit_on_city(ACTION_TRADE_ROUTE,
+                                            actor_unit, target_city));
+}
+
+/**************************************************************************
   Returns TRUE if the specified unit type can perform the wanted action
   given that an action enabler later will enable it.
 
@@ -714,9 +725,7 @@
     /* Allow a ruleset to forbid units from entering the marketplace if a
      * trade route can be established in stead. */
     if (wanted_action == ACTION_MARKETPLACE
-        && game.info.force_trade_route
-        && is_action_enabled_unit_on_city(ACTION_TRADE_ROUTE,
-                                          actor_unit, target_city)) {
+        && trade_route_blocks(actor_unit, target_city)) {
       return FALSE;
     }
 


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

Reply via email to