Author: sveinung
Date: Sat Dec 20 20:20:52 2014
New Revision: 27363

URL: http://svn.gna.org/viewcvs/freeciv?rev=27363&view=rev
Log:
Let units without TradeRoute establish trade routes and enter marketplaces.

Move the rule that a unit must have the TradeRoute flag to establish a trade
route or enter a marketplace to the ruleset.

The TradeRoute unit type flag can't become ruleset defined yet since it
still is hard coded in some AI and client code.

See patch #5582

Modified:
    trunk/common/actions.c
    trunk/common/unit.c
    trunk/data/alien/game.ruleset
    trunk/data/civ1/game.ruleset
    trunk/data/civ2/game.ruleset
    trunk/data/civ2civ3/game.ruleset
    trunk/data/classic/game.ruleset
    trunk/data/experimental/game.ruleset
    trunk/doc/README.actions

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=27363&r1=27362&r2=27363&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Sat Dec 20 20:20:52 2014
@@ -384,16 +384,6 @@
                                            TRUE, "Is foreign"));
   }
 
-  if (enabler->action == ACTION_TRADE_ROUTE ||
-      enabler->action == ACTION_MARKETPLACE) {
-    /* There are still places that assumes that units that can establish a
-     * traderoute or enter the market place have the TradeRoute flag. */
-    /* TODO: Move this restriction to the ruleset. */
-    requirement_vector_append(&enabler->actor_reqs,
-                              req_from_str("Unitflag", "Local", FALSE,
-                                           TRUE, "TradeRoute"));
-  }
-
   if (enabler->action == ACTION_HELP_WONDER) {
     /* There are still places that assumes that units that can help build a
      * wonder have the HelpWonder flag. */

Modified: trunk/common/unit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.c?rev=27363&r1=27362&r2=27363&view=diff
==============================================================================
--- trunk/common/unit.c (original)
+++ trunk/common/unit.c Sat Dec 20 20:20:52 2014
@@ -230,7 +230,7 @@
 {
   struct city *phomecity, *pdestcity;
 
-  return (unit_has_type_flag(punit, UTYF_TRADE_ROUTE)
+  return (utype_can_do_action(unit_type(punit), ACTION_TRADE_ROUTE)
           && (pdestcity = tile_city(unit_tile(punit)))
           && (phomecity = game_city_by_number(punit->homecity))
           && can_cities_trade(phomecity, pdestcity));

Modified: trunk/data/alien/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/game.ruleset?rev=27363&r1=27362&r2=27363&view=diff
==============================================================================
--- trunk/data/alien/game.ruleset       (original)
+++ trunk/data/alien/game.ruleset       Sat Dec 20 20:20:52 2014
@@ -263,9 +263,17 @@
 
 [actionenabler_traderoute]
 action = "Establish Trade Route"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "Unitflag", "TradeRoute", "Local", TRUE
+    }
 
 [actionenabler_marketplace]
 action = "Enter Marketplace"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "Unitflag", "TradeRoute", "Local", TRUE
+    }
 
 [actionenabler_help_build_wonder]
 action = "Help Wonder"

Modified: trunk/data/civ1/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/game.ruleset?rev=27363&r1=27362&r2=27363&view=diff
==============================================================================
--- trunk/data/civ1/game.ruleset        (original)
+++ trunk/data/civ1/game.ruleset        Sat Dec 20 20:20:52 2014
@@ -248,9 +248,17 @@
 
 [actionenabler_traderoute]
 action = "Establish Trade Route"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "Unitflag", "TradeRoute", "Local", TRUE
+    }
 
 [actionenabler_marketplace]
 action = "Enter Marketplace"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "Unitflag", "TradeRoute", "Local", TRUE
+    }
 
 [actionenabler_help_build_wonder]
 action = "Help Wonder"

Modified: trunk/data/civ2/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/game.ruleset?rev=27363&r1=27362&r2=27363&view=diff
==============================================================================
--- trunk/data/civ2/game.ruleset        (original)
+++ trunk/data/civ2/game.ruleset        Sat Dec 20 20:20:52 2014
@@ -293,9 +293,17 @@
 
 [actionenabler_traderoute]
 action = "Establish Trade Route"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "Unitflag", "TradeRoute", "Local", TRUE
+    }
 
 [actionenabler_marketplace]
 action = "Enter Marketplace"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "Unitflag", "TradeRoute", "Local", TRUE
+    }
 
 [actionenabler_help_build_wonder]
 action = "Help Wonder"

Modified: trunk/data/civ2civ3/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/game.ruleset?rev=27363&r1=27362&r2=27363&view=diff
==============================================================================
--- trunk/data/civ2civ3/game.ruleset    (original)
+++ trunk/data/civ2civ3/game.ruleset    Sat Dec 20 20:20:52 2014
@@ -336,9 +336,17 @@
 
 [actionenabler_traderoute]
 action = "Establish Trade Route"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "Unitflag", "TradeRoute", "Local", TRUE
+    }
 
 [actionenabler_marketplace]
 action = "Enter Marketplace"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "Unitflag", "TradeRoute", "Local", TRUE
+    }
 
 [actionenabler_help_build_wonder]
 action = "Help Wonder"

Modified: trunk/data/classic/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/game.ruleset?rev=27363&r1=27362&r2=27363&view=diff
==============================================================================
--- trunk/data/classic/game.ruleset     (original)
+++ trunk/data/classic/game.ruleset     Sat Dec 20 20:20:52 2014
@@ -325,9 +325,17 @@
 
 [actionenabler_traderoute]
 action = "Establish Trade Route"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "Unitflag", "TradeRoute", "Local", TRUE
+    }
 
 [actionenabler_marketplace]
 action = "Enter Marketplace"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "Unitflag", "TradeRoute", "Local", TRUE
+    }
 
 [actionenabler_help_build_wonder]
 action = "Help Wonder"

Modified: trunk/data/experimental/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/game.ruleset?rev=27363&r1=27362&r2=27363&view=diff
==============================================================================
--- trunk/data/experimental/game.ruleset        (original)
+++ trunk/data/experimental/game.ruleset        Sat Dec 20 20:20:52 2014
@@ -344,9 +344,17 @@
 
 [actionenabler_traderoute]
 action = "Establish Trade Route"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "Unitflag", "TradeRoute", "Local", TRUE
+    }
 
 [actionenabler_marketplace]
 action = "Enter Marketplace"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "Unitflag", "TradeRoute", "Local", TRUE
+    }
 
 [actionenabler_help_build_wonder]
 action = "Help Wonder"

Modified: trunk/doc/README.actions
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.actions?rev=27363&r1=27362&r2=27363&view=diff
==============================================================================
--- trunk/doc/README.actions    (original)
+++ trunk/doc/README.actions    Sat Dec 20 20:20:52 2014
@@ -171,7 +171,6 @@
  * target must be foreign.
 
 "Establish Trade Route" - Establish a trade route to the target city.
- * actor must have the "TradeRoute" unit flag.
  * actor must be on the same tile as the target or on the tile next to it.
  * actor must have a home city.
  * target must be foreign or trademindist tiles away from that home city.
@@ -182,7 +181,6 @@
    one.)
 
 "Enter Marketplace" - Get a one time bounus without creating a trade route.
- * actor must have the "TradeRoute" unit flag.
  * actor must be on the same tile as the target or on the tile next to it.
  * actor must have a home city.
  * target must be foreign or trademindist tiles away from that home city.


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

Reply via email to