Author: sveinung
Date: Sun Sep 20 13:11:02 2015
New Revision: 29943

URL: http://svn.gna.org/viewcvs/freeciv?rev=29943&view=rev
Log:
Unhardcode that Caravans only can help wonders

Move the rule that the production being helped by the "Help Wonder" action
must be a wonder to the ruleset.

See patch #6362

Modified:
    trunk/common/actions.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/data/multiplayer/game.ruleset
    trunk/doc/README.actions
    trunk/fc_version
    trunk/server/rscompat.c

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=29943&r1=29942&r2=29943&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Sun Sep 20 13:11:02 2015
@@ -896,26 +896,19 @@
   }
 
   if (wanted_action == ACTION_HELP_WONDER) {
-    /* It is only possible to help the production of a wonder. */
-    /* Info leak: It is already known when a foreign city is building a
-     * wonder. */
-    /* TODO: Do this rule belong in the ruleset? */
-    if (!(VUT_IMPROVEMENT == target_city->production.kind
-        && is_wonder(target_city->production.value.building))) {
-      return TRI_NO;
-    }
-
     /* It is only possible to help the production if the production needs
-     * the help. (If not it would be possible to add shields for a non
-     * wonder if it is build after a wonder) */
-    /* Info leak: No new information is sent with the old rules. When the
-     * ruleset is changed to make helping foreign wonders legal the
-     * information that a wonder have been hurried (bought, helped) leaks.
-     * That a foreign wonder will be ready next turn (from work) is already
-     * known. That it will be finished because of help is not. */
+     * the help. (If not it would be possible to add shields for something
+     * that can't legally receive help if it is build later) */
+    /* Info leak: The player knows that the production in his own city has
+     * been hurried (bought or helped). The information isn't revealed when
+     * asking for action probabilities since omniscient is FALSE. */
+    if (!omniscient
+        && !can_player_see_city_internals(actor_player, target_city)) {
+      return TRI_MAYBE;
+    }
+
     if (!(target_city->shield_stock
-          < impr_build_shield_cost(
-            target_city->production.value.building))) {
+          < city_production_build_shield_cost(target_city))) {
       return TRI_NO;
     }
   }

Modified: trunk/data/alien/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/game.ruleset?rev=29943&r1=29942&r2=29943&view=diff
==============================================================================
--- trunk/data/alien/game.ruleset       (original)
+++ trunk/data/alien/game.ruleset       Sun Sep 20 13:11:02 2015
@@ -394,6 +394,22 @@
       "UnitFlag", "AddToCity", "Local", TRUE
       "DiplRel", "Is foreign", "Local", FALSE
       "MinMoveFrags", "1", "Local", TRUE
+    }
+target_reqs    =
+    { "type",   "name", "range"
+      "BuildingGenus", "GreatWonder", "Local"
+    }
+
+[actionenabler_help_build_small_wonder]
+action = "Help Wonder"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "UnitFlag", "HelpWonder", "Local", TRUE
+      "DiplRel", "Is foreign", "Local", FALSE
+    }
+target_reqs    =
+    { "type",   "name", "range"
+      "BuildingGenus", "SmallWonder", "Local"
     }
 
 [borders]

Modified: trunk/data/civ1/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/game.ruleset?rev=29943&r1=29942&r2=29943&view=diff
==============================================================================
--- trunk/data/civ1/game.ruleset        (original)
+++ trunk/data/civ1/game.ruleset        Sun Sep 20 13:11:02 2015
@@ -334,6 +334,22 @@
     { "type",   "name", "range", "present"
       "UnitFlag", "HelpWonder", "Local", TRUE
       "DiplRel", "Is foreign", "Local", FALSE
+    }
+target_reqs    =
+    { "type",   "name", "range"
+      "BuildingGenus", "GreatWonder", "Local"
+    }
+
+[actionenabler_help_build_small_wonder]
+action = "Help Wonder"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "UnitFlag", "HelpWonder", "Local", TRUE
+      "DiplRel", "Is foreign", "Local", FALSE
+    }
+target_reqs    =
+    { "type",   "name", "range"
+      "BuildingGenus", "SmallWonder", "Local"
     }
 
 [actionenabler_build_city_pioneer]

Modified: trunk/data/civ2/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/game.ruleset?rev=29943&r1=29942&r2=29943&view=diff
==============================================================================
--- trunk/data/civ2/game.ruleset        (original)
+++ trunk/data/civ2/game.ruleset        Sun Sep 20 13:11:02 2015
@@ -413,6 +413,22 @@
     { "type",   "name", "range", "present"
       "UnitFlag", "HelpWonder", "Local", TRUE
       "DiplRel", "Is foreign", "Local", FALSE
+    }
+target_reqs    =
+    { "type",   "name", "range"
+      "BuildingGenus", "GreatWonder", "Local"
+    }
+
+[actionenabler_help_build_small_wonder]
+action = "Help Wonder"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "UnitFlag", "HelpWonder", "Local", TRUE
+      "DiplRel", "Is foreign", "Local", FALSE
+    }
+target_reqs    =
+    { "type",   "name", "range"
+      "BuildingGenus", "SmallWonder", "Local"
     }
 
 [actionenabler_build_city_pioneer]

Modified: trunk/data/civ2civ3/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/game.ruleset?rev=29943&r1=29942&r2=29943&view=diff
==============================================================================
--- trunk/data/civ2civ3/game.ruleset    (original)
+++ trunk/data/civ2civ3/game.ruleset    Sun Sep 20 13:11:02 2015
@@ -417,6 +417,22 @@
 actor_reqs    =
     { "type",   "name", "range", "present"
       "UnitFlag", "TradeRoute", "Local", TRUE
+    }
+target_reqs    =
+    { "type",   "name", "range"
+      "BuildingGenus", "GreatWonder", "Local"
+    }
+
+[actionenabler_help_build_small_wonder]
+action = "Help Wonder"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "UnitFlag", "HelpWonder", "Local", TRUE
+      "DiplRel", "Is foreign", "Local", FALSE
+    }
+target_reqs    =
+    { "type",   "name", "range"
+      "BuildingGenus", "SmallWonder", "Local"
     }
 
 [actionenabler_marketplace]

Modified: trunk/data/classic/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/game.ruleset?rev=29943&r1=29942&r2=29943&view=diff
==============================================================================
--- trunk/data/classic/game.ruleset     (original)
+++ trunk/data/classic/game.ruleset     Sun Sep 20 13:11:02 2015
@@ -415,6 +415,22 @@
     { "type",   "name", "range", "present"
       "UnitFlag", "HelpWonder", "Local", TRUE
       "DiplRel", "Is foreign", "Local", FALSE
+    }
+target_reqs    =
+    { "type",   "name", "range"
+      "BuildingGenus", "GreatWonder", "Local"
+    }
+
+[actionenabler_help_build_small_wonder]
+action = "Help Wonder"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "UnitFlag", "HelpWonder", "Local", TRUE
+      "DiplRel", "Is foreign", "Local", FALSE
+    }
+target_reqs    =
+    { "type",   "name", "range"
+      "BuildingGenus", "SmallWonder", "Local"
     }
 
 [actionenabler_build_city_pioneer]

Modified: trunk/data/experimental/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/game.ruleset?rev=29943&r1=29942&r2=29943&view=diff
==============================================================================
--- trunk/data/experimental/game.ruleset        (original)
+++ trunk/data/experimental/game.ruleset        Sun Sep 20 13:11:02 2015
@@ -433,6 +433,22 @@
     { "type",   "name", "range", "present"
       "UnitFlag", "HelpWonder", "Local", TRUE
       "DiplRel", "Is foreign", "Local", FALSE
+    }
+target_reqs    =
+    { "type",   "name", "range"
+      "BuildingGenus", "GreatWonder", "Local"
+    }
+
+[actionenabler_help_build_small_wonder]
+action = "Help Wonder"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "UnitFlag", "HelpWonder", "Local", TRUE
+      "DiplRel", "Is foreign", "Local", FALSE
+    }
+target_reqs    =
+    { "type",   "name", "range"
+      "BuildingGenus", "SmallWonder", "Local"
     }
 
 [actionenabler_build_city_pioneer]

Modified: trunk/data/multiplayer/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/game.ruleset?rev=29943&r1=29942&r2=29943&view=diff
==============================================================================
--- trunk/data/multiplayer/game.ruleset (original)
+++ trunk/data/multiplayer/game.ruleset Sun Sep 20 13:11:02 2015
@@ -399,6 +399,22 @@
     { "type",   "name", "range", "present"
       "UnitFlag", "HelpWonder", "Local", TRUE
       "DiplRel", "Is foreign", "Local", FALSE
+    }
+target_reqs    =
+    { "type",   "name", "range"
+      "BuildingGenus", "GreatWonder", "Local"
+    }
+
+[actionenabler_help_build_small_wonder]
+action = "Help Wonder"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "UnitFlag", "HelpWonder", "Local", TRUE
+      "DiplRel", "Is foreign", "Local", FALSE
+    }
+target_reqs    =
+    { "type",   "name", "range"
+      "BuildingGenus", "SmallWonder", "Local"
     }
 
 [actionenabler_build_city_pioneer]

Modified: trunk/doc/README.actions
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.actions?rev=29943&r1=29942&r2=29943&view=diff
==============================================================================
--- trunk/doc/README.actions    (original)
+++ trunk/doc/README.actions    Sun Sep 20 13:11:02 2015
@@ -230,8 +230,7 @@
 "Help Wonder" - Add the shields used to build the actor to the target city.
  * UI name can be set using ui_name_help_wonder
  * actor must be on the same tile as the target or on the tile next to it.
- * target must be building a wonder.
- * target city must still need the extra sheilds to build the wonder.
+ * target city must need the extra shields to complete its production.
 
 "Join City" - Add the actor to the target city's population.
  * UI name can be set using ui_name_join_city

Modified: trunk/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=29943&r1=29942&r2=29943&view=diff
==============================================================================
--- trunk/fc_version    (original)
+++ trunk/fc_version    Sun Sep 20 13:11:02 2015
@@ -54,7 +54,7 @@
 #   - Avoid adding a new mandatory capability to the development branch for
 #     as long as possible.  We want to maintain network compatibility with
 #     the stable branch for as long as possible.
-NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2015.Sep.18"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2015.Sep.20"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""

Modified: trunk/server/rscompat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/rscompat.c?rev=29943&r1=29942&r2=29943&view=diff
==============================================================================
--- trunk/server/rscompat.c     (original)
+++ trunk/server/rscompat.c     Sun Sep 20 13:11:02 2015
@@ -406,6 +406,28 @@
                                            TRUE, TRUE, "Nuclear"));
 
     action_enabler_add(enabler);
+
+    /* Update action enablers. */
+    action_enablers_iterate(ae) {
+      /* The rule that Help Wonder only can help wonders now lives in the
+       * ruleset. */
+      if (ae->action == ACTION_HELP_WONDER) {
+        /* The old rule is represented with two action enablers. */
+        enabler = action_enabler_copy(ae);
+        action_enabler_add(enabler);
+
+        /* One allows doing "Help Wonder" to great wonders. */
+        requirement_vector_append(&ae->target_reqs,
+                                  req_from_str("BuildingGenus", "Local", FALSE,
+                                               TRUE, TRUE, "GreatWonder"));
+
+        /* The other allows doing "Help Wonder" to small wonders. */
+        requirement_vector_append(&enabler->target_reqs,
+                                  req_from_str("BuildingGenus", "Local", FALSE,
+                                               TRUE, TRUE, "SmallWonder"));
+
+      }
+    } action_enablers_iterate_end;
   }
 
   if (info->ver_effects < 10) {


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

Reply via email to