Author: sveinung
Date: Thu Jun 30 10:27:29 2016
New Revision: 33118

URL: http://svn.gna.org/viewcvs/freeciv?rev=33118&view=rev
Log:
Helpdata: Bombard is done to foreign unit stacks.

Force "Bombard" action enablers to mention that it only can be done to unit
stacks the actor is at war with. Having the hard requirement in the action
enablers makes the code that auto generates help text understand that the
"Bombard" action is done to foreign unit stacks.

See patch #7347

Modified:
    trunk/common/actions.c
    trunk/data/alien/game.ruleset
    trunk/data/civ2civ3/game.ruleset
    trunk/data/sandbox/game.ruleset
    trunk/doc/README.actions
    trunk/fc_version
    trunk/server/rscompat.c
    trunk/server/rssanity.c

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=33118&r1=33117&r2=33118&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Thu Jun 30 10:27:29 2016
@@ -1503,11 +1503,6 @@
     break;
 
   case ACTION_BOMBARD:
-    /* TODO: Move to the ruleset. */
-    if (!pplayers_at_war(unit_owner(target_unit), actor_player)) {
-      return TRI_NO;
-    }
-
     /* FIXME: Target of Bombard should be city and units. */
     if (tile_city(target_tile)
         && !pplayers_at_war(city_owner(tile_city(target_tile)),

Modified: trunk/data/alien/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/game.ruleset?rev=33118&r1=33117&r2=33118&view=diff
==============================================================================
--- trunk/data/alien/game.ruleset       (original)
+++ trunk/data/alien/game.ruleset       Thu Jun 30 10:27:29 2016
@@ -439,10 +439,11 @@
 [actionenabler_bombard]
 action = "Bombard"
 actor_reqs    =
-    { "type",   "name", "range", "present"
-      "UnitFlag", "Bombarder", "Local", TRUE
-      "UnitState", "Transported", "Local", FALSE
-      "MinMoveFrags", "1", "Local", TRUE
+    { "type",         "name",        "range", "present"
+      "UnitFlag",     "Bombarder",   "Local", TRUE
+      "UnitState",    "Transported", "Local", FALSE
+      "MinMoveFrags", "1",           "Local", TRUE
+      "DiplRel",      "War",         "Local", TRUE
     }
 target_reqs    =
     { "type",   "name", "range", "present"

Modified: trunk/data/civ2civ3/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/game.ruleset?rev=33118&r1=33117&r2=33118&view=diff
==============================================================================
--- trunk/data/civ2civ3/game.ruleset    (original)
+++ trunk/data/civ2civ3/game.ruleset    Thu Jun 30 10:27:29 2016
@@ -522,10 +522,11 @@
 [actionenabler_bombard]
 action = "Bombard"
 actor_reqs    =
-    { "type",   "name", "range", "present"
-      "UnitFlag", "Bombarder", "Local", TRUE
-      "UnitState", "Transported", "Local", FALSE
-      "MinMoveFrags", "1", "Local", TRUE
+    { "type",         "name",        "range", "present"
+      "UnitFlag",     "Bombarder",   "Local", TRUE
+      "UnitState",    "Transported", "Local", FALSE
+      "MinMoveFrags", "1",           "Local", TRUE
+      "DiplRel",      "War",         "Local", TRUE
     }
 target_reqs    =
     { "type",   "name", "range", "present"

Modified: trunk/data/sandbox/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/sandbox/game.ruleset?rev=33118&r1=33117&r2=33118&view=diff
==============================================================================
--- trunk/data/sandbox/game.ruleset     (original)
+++ trunk/data/sandbox/game.ruleset     Thu Jun 30 10:27:29 2016
@@ -578,10 +578,11 @@
 [actionenabler_bombard]
 action = "Bombard"
 actor_reqs    =
-    { "type",   "name", "range", "present"
-      "UnitFlag", "Bombarder", "Local", TRUE
-      "UnitState", "Transported", "Local", FALSE
-      "MinMoveFrags", "1", "Local", TRUE
+    { "type",         "name",        "range", "present"
+      "UnitFlag",     "Bombarder",   "Local", TRUE
+      "UnitState",    "Transported", "Local", FALSE
+      "MinMoveFrags", "1",           "Local", TRUE
+      "DiplRel",      "War",         "Local", TRUE
     }
 target_reqs    =
     { "type",   "name", "range", "present"

Modified: trunk/doc/README.actions
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.actions?rev=33118&r1=33117&r2=33118&view=diff
==============================================================================
--- trunk/doc/README.actions    (original)
+++ trunk/doc/README.actions    Thu Jun 30 10:27:29 2016
@@ -316,8 +316,7 @@
  * actor must have a bombard_rate > 0
  * actor must be on a tile next to the target.
  * target can't be in a city the actor player isn't at war with.
- * target must be foreign.
- * target owner must be at war with actor.
+ * target owner must be at war with actor. (!)
 
 Actions done by a unit against a tile
 =====================================

Modified: trunk/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=33118&r1=33117&r2=33118&view=diff
==============================================================================
--- trunk/fc_version    (original)
+++ trunk/fc_version    Thu Jun 30 10:27:29 2016
@@ -56,7 +56,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-2016.Jun.30"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2016.Jun.30b"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""

Modified: trunk/server/rscompat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/rscompat.c?rev=33118&r1=33117&r2=33118&view=diff
==============================================================================
--- trunk/server/rscompat.c     (original)
+++ trunk/server/rscompat.c     Thu Jun 30 10:27:29 2016
@@ -536,6 +536,11 @@
                               req_from_str("MinMoveFrags", "Local", FALSE,
                                            TRUE, TRUE, "1"));
 
+    /* Must be at war with each target unit. */
+    requirement_vector_append(&enabler->actor_reqs,
+                              req_from_values(VUT_DIPLREL, REQ_RANGE_LOCAL,
+                                              FALSE, TRUE, TRUE, DS_WAR));
+
     /* The target can't be on an ocean tile. */
     requirement_vector_append(&enabler->target_reqs,
                               req_from_str("TerrainClass", "Local", FALSE,

Modified: trunk/server/rssanity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/rssanity.c?rev=33118&r1=33117&r2=33118&view=diff
==============================================================================
--- trunk/server/rssanity.c     (original)
+++ trunk/server/rssanity.c     Thu Jun 30 10:27:29 2016
@@ -994,6 +994,29 @@
         }
       }
 
+      if (act == ACTION_BOMBARD) {
+        /* Why this is a hard requirement: there is a hard requirement that
+         * the actor player is at war with the owner of any city on the
+         * target tile. It can't move to the ruleset as long as Bombard is
+         * targeted at unit stacks only. Having the same requirement
+         * against each unit in the stack as against any city at the tile
+         * ensures compatibility with any future solution that allows the
+         * requirement against any city on the target tile to move to the
+         * ruleset. */
+
+        struct requirement domestic_tgt
+            = req_from_values(VUT_DIPLREL, REQ_RANGE_LOCAL,
+                              FALSE, FALSE, TRUE, DS_WAR);
+
+        if (!action_id_blocked_by_situation_act(act, &domestic_tgt)) {
+          ruleset_error(LOG_ERROR,
+                        "All action enablers for %s must require a "
+                        "target the actor is at war with.",
+                        action_get_rule_name(act));
+          ok = FALSE;
+        }
+      }
+
       if (act == ACTION_UPGRADE_UNIT) {
         /* Why this is a hard requirement: Keep the old rules. Need to work
          * out corner cases. */


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

Reply via email to