Author: sveinung
Date: Sat Dec 20 20:20:45 2014
New Revision: 27362

URL: http://svn.gna.org/viewcvs/freeciv?rev=27362&view=rev
Log:
Put the only-domestic-wonder-building-can-receive-help-rule in the ruleset.

The restriction against helping foreign wonders is added to the Help Wonder
action of all bundled rulesets.

The AI won't help an other player to build a wonder.

See patch #5569

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/data/multiplayer/game.ruleset
    trunk/doc/README.actions
    trunk/server/unithand.c

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=27362&r1=27361&r2=27362&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Sat Dec 20 20:20:45 2014
@@ -401,13 +401,6 @@
     requirement_vector_append(&enabler->actor_reqs,
                               req_from_str("Unitflag", "Local", FALSE,
                                            TRUE, "HelpWonder"));
-
-    /* The Freeciv code assumes that it it is impossible to help a foreign
-     * nation build a foreign wonder. */
-    /* TODO: Move this restriction to the ruleset. */
-    requirement_vector_append(&enabler->actor_reqs,
-                              req_from_str("DiplRel", "Local", FALSE,
-                                           FALSE, "Is foreign"));
   }
 }
 
@@ -528,6 +521,8 @@
 
   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))) {
@@ -537,6 +532,11 @@
     /* 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. */
     if (!(target_city->shield_stock
           < impr_build_shield_cost(
             target_city->production.value.building))) {

Modified: trunk/common/unit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.c?rev=27362&r1=27361&r2=27362&view=diff
==============================================================================
--- trunk/common/unit.c (original)
+++ trunk/common/unit.c Sat Dec 20 20:20:45 2014
@@ -203,7 +203,6 @@
   }
 
   return (unit_has_type_flag(punit, UTYF_HELP_WONDER)
-         && unit_owner(punit) == city_owner(pcity)
          && VUT_IMPROVEMENT == pcity->production.kind
          && is_wonder(pcity->production.value.building)
          && (pcity->shield_stock

Modified: trunk/data/alien/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/game.ruleset?rev=27362&r1=27361&r2=27362&view=diff
==============================================================================
--- trunk/data/alien/game.ruleset       (original)
+++ trunk/data/alien/game.ruleset       Sat Dec 20 20:20:45 2014
@@ -269,6 +269,10 @@
 
 [actionenabler_help_build_wonder]
 action = "Help Wonder"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "DiplRel", "Is foreign", "Local", FALSE
+    }
 
 [borders]
 ; Base border radius from city.

Modified: trunk/data/civ1/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/game.ruleset?rev=27362&r1=27361&r2=27362&view=diff
==============================================================================
--- trunk/data/civ1/game.ruleset        (original)
+++ trunk/data/civ1/game.ruleset        Sat Dec 20 20:20:45 2014
@@ -254,6 +254,10 @@
 
 [actionenabler_help_build_wonder]
 action = "Help Wonder"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "DiplRel", "Is foreign", "Local", FALSE
+    }
 
 [borders]
 ; Base border radius from city.

Modified: trunk/data/civ2/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/game.ruleset?rev=27362&r1=27361&r2=27362&view=diff
==============================================================================
--- trunk/data/civ2/game.ruleset        (original)
+++ trunk/data/civ2/game.ruleset        Sat Dec 20 20:20:45 2014
@@ -299,6 +299,10 @@
 
 [actionenabler_help_build_wonder]
 action = "Help Wonder"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "DiplRel", "Is foreign", "Local", FALSE
+    }
 
 [borders]
 ; Base border radius from city.

Modified: trunk/data/civ2civ3/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/game.ruleset?rev=27362&r1=27361&r2=27362&view=diff
==============================================================================
--- trunk/data/civ2civ3/game.ruleset    (original)
+++ trunk/data/civ2civ3/game.ruleset    Sat Dec 20 20:20:45 2014
@@ -342,6 +342,10 @@
 
 [actionenabler_help_build_wonder]
 action = "Help Wonder"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "DiplRel", "Is foreign", "Local", FALSE
+    }
 
 [borders]
 ; Base border radius from city.

Modified: trunk/data/classic/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/game.ruleset?rev=27362&r1=27361&r2=27362&view=diff
==============================================================================
--- trunk/data/classic/game.ruleset     (original)
+++ trunk/data/classic/game.ruleset     Sat Dec 20 20:20:45 2014
@@ -331,6 +331,10 @@
 
 [actionenabler_help_build_wonder]
 action = "Help Wonder"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "DiplRel", "Is foreign", "Local", FALSE
+    }
 
 [borders]
 ; Base border radius from city.

Modified: trunk/data/experimental/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/game.ruleset?rev=27362&r1=27361&r2=27362&view=diff
==============================================================================
--- trunk/data/experimental/game.ruleset        (original)
+++ trunk/data/experimental/game.ruleset        Sat Dec 20 20:20:45 2014
@@ -350,6 +350,10 @@
 
 [actionenabler_help_build_wonder]
 action = "Help Wonder"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "DiplRel", "Is foreign", "Local", FALSE
+    }
 
 [borders]
 ; Base border radius from city.

Modified: trunk/data/multiplayer/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/game.ruleset?rev=27362&r1=27361&r2=27362&view=diff
==============================================================================
--- trunk/data/multiplayer/game.ruleset (original)
+++ trunk/data/multiplayer/game.ruleset Sat Dec 20 20:20:45 2014
@@ -329,6 +329,10 @@
 
 [actionenabler_help_build_wonder]
 action = "Help Wonder"
+actor_reqs    =
+    { "type",   "name", "range", "present"
+      "DiplRel", "Is foreign", "Local", FALSE
+    }
 
 [borders]
 ; Base border radius from city.

Modified: trunk/doc/README.actions
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.actions?rev=27362&r1=27361&r2=27362&view=diff
==============================================================================
--- trunk/doc/README.actions    (original)
+++ trunk/doc/README.actions    Sat Dec 20 20:20:45 2014
@@ -191,7 +191,6 @@
 "Help Wonder" - Add the shields used to build the actor to the target city.
  * actor must have the "HelpWonder" unit flag.
  * actor must be on the same tile as the target or on the tile next to it.
- * target must be domestic.
  * target must be building a wonder.
  * target city must still need the extra sheilds to build the wonder.
 

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=27362&r1=27361&r2=27362&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Sat Dec 20 20:20:45 2014
@@ -2107,6 +2107,8 @@
     work = _("surplus");
   }
 
+  /* Let the player that just donated shields to the wonder building know
+   * the result of his donation. */
   notify_player(pplayer, city_tile(pcity_dest), E_CARAVAN_ACTION,
                 ftc_server,
                 /* TRANS: Your Caravan helps build the Pyramids in Bergen
@@ -2118,6 +2120,24 @@
                 city_link(pcity_dest), 
                 abs(build_points_left(pcity_dest)),
                 work);
+
+  if (city_owner(pcity_dest) != unit_owner(punit)) {
+    /* Tell the city owner about the gift he just received. */
+
+    notify_player(city_owner(pcity_dest), city_tile(pcity_dest),
+                  E_CARAVAN_ACTION, ftc_server,
+                  /* TRANS: Help building the Pyramids in Bergen received
+                   * from Persian Caravan (4 surplus). */
+                  _("Help building the %s in %s received from %s %s "
+                    "(%d %s)."),
+                  improvement_name_translation(
+                    pcity_dest->production.value.building),
+                  city_link(pcity_dest),
+                  nation_adjective_for_player(pplayer),
+                  unit_link(punit),
+                  abs(build_points_left(pcity_dest)),
+                  work);
+  }
 
   wipe_unit(punit, ULR_USED, NULL);
   send_player_info_c(pplayer, pplayer->connections);


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

Reply via email to