Author: sveinung
Date: Tue Aug 16 19:55:52 2016
New Revision: 33629

URL: http://svn.gna.org/viewcvs/freeciv?rev=33629&view=rev
Log:
Support distant bombardment.

Allow the rulset to set the maximum distance "Bombard" can be performed from
via bombard_max_range. This sets the max range for all bombardment. No per
unit type granularity is supported. Generalized actions will allow defining
many "Bombard" actions with different ranges. If the same flexibility is
needed before generalized actions are done a new bombardment action can be
defined.

See patch #7604

Modified:
    trunk/common/actions.c
    trunk/common/game.h
    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/data/sandbox/game.ruleset
    trunk/data/stub/game.ruleset
    trunk/data/webperimental/game.ruleset
    trunk/doc/README.actions
    trunk/server/ruleset.c
    trunk/server/unithand.c
    trunk/tools/ruleutil/rulesave.c

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Tue Aug 16 19:55:52 2016
@@ -181,7 +181,9 @@
                  /* A single domestic unit at the target tile will make the
                   * action illegal. It must therefore be performed from
                   * another tile. */
-                 1, 1);
+                 1,
+                 /* Overwritten by the ruleset's bombard_max_range */
+                 1);
   actions[ACTION_SPY_NUKE] =
       action_new(ACTION_SPY_NUKE, ATK_CITY,
                  TRUE, FALSE, FALSE,

Modified: trunk/common/game.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/game.h?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/common/game.h (original)
+++ trunk/common/game.h Tue Aug 16 19:55:52 2016
@@ -791,6 +791,7 @@
 #define RS_DEFAULT_FORCE_EXPLODE_NUCLEAR         FALSE
 
 #define RS_DEFAULT_POISON_EMPTIES_FOOD_STOCK     FALSE
+#define RS_DEFAULT_BOMBARD_MAX_RANGE             1
 
 #ifdef __cplusplus
 }

Modified: trunk/data/alien/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/game.ruleset?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/data/alien/game.ruleset       (original)
+++ trunk/data/alien/game.ruleset       Tue Aug 16 19:55:52 2016
@@ -214,6 +214,9 @@
 ; If poison_empties_food_stock is set to TRUE a successful "Poison City"
 ; will empty the food stock.
 poison_empties_food_stock = FALSE
+
+; How far away targets of "Bombard" is allowed to be.
+bombard_max_range = 1
 
 ; What each action should be called when showing them to the player.
 ; The first %s should be before the mnemonic of the action.

Modified: trunk/data/civ1/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/game.ruleset?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/data/civ1/game.ruleset        (original)
+++ trunk/data/civ1/game.ruleset        Tue Aug 16 19:55:52 2016
@@ -189,6 +189,9 @@
 ; If poison_empties_food_stock is set to TRUE a successful "Poison City"
 ; will empty the food stock.
 poison_empties_food_stock = FALSE
+
+; How far away targets of "Bombard" is allowed to be.
+bombard_max_range = 1
 
 ; What each action should be called when showing them to the player.
 ; The first %s should be before the mnemonic of the action.

Modified: trunk/data/civ2/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/game.ruleset?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/data/civ2/game.ruleset        (original)
+++ trunk/data/civ2/game.ruleset        Tue Aug 16 19:55:52 2016
@@ -206,6 +206,9 @@
 ; If poison_empties_food_stock is set to TRUE a successful "Poison City"
 ; will empty the food stock.
 poison_empties_food_stock = FALSE
+
+; How far away targets of "Bombard" is allowed to be.
+bombard_max_range = 1
 
 ; What each action should be called when showing them to the player.
 ; The first %s should be before the mnemonic of the action.

Modified: trunk/data/civ2civ3/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/game.ruleset?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/data/civ2civ3/game.ruleset    (original)
+++ trunk/data/civ2civ3/game.ruleset    Tue Aug 16 19:55:52 2016
@@ -215,6 +215,9 @@
 ; If poison_empties_food_stock is set to TRUE a successful "Poison City"
 ; will empty the food stock.
 poison_empties_food_stock = FALSE
+
+; How far away targets of "Bombard" is allowed to be.
+bombard_max_range = 1
 
 ; What each action should be called when showing them to the player.
 ; The first %s should be before the mnemonic of the action.

Modified: trunk/data/classic/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/game.ruleset?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/data/classic/game.ruleset     (original)
+++ trunk/data/classic/game.ruleset     Tue Aug 16 19:55:52 2016
@@ -210,6 +210,9 @@
 ; If poison_empties_food_stock is set to TRUE a successful "Poison City"
 ; will empty the food stock.
 poison_empties_food_stock = FALSE
+
+; How far away targets of "Bombard" is allowed to be.
+bombard_max_range = 1
 
 ; What each action should be called when showing them to the player.
 ; The first %s should be before the mnemonic of the action.

Modified: trunk/data/experimental/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/game.ruleset?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/data/experimental/game.ruleset        (original)
+++ trunk/data/experimental/game.ruleset        Tue Aug 16 19:55:52 2016
@@ -213,6 +213,9 @@
 ; If poison_empties_food_stock is set to TRUE a successful "Poison City"
 ; will empty the food stock.
 poison_empties_food_stock = FALSE
+
+; How far away targets of "Bombard" is allowed to be.
+bombard_max_range = 1
 
 ; What each action should be called when showing them to the player.
 ; The first %s should be before the mnemonic of the action.

Modified: trunk/data/multiplayer/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/game.ruleset?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/data/multiplayer/game.ruleset (original)
+++ trunk/data/multiplayer/game.ruleset Tue Aug 16 19:55:52 2016
@@ -213,6 +213,9 @@
 ; If poison_empties_food_stock is set to TRUE a successful "Poison City"
 ; will empty the food stock.
 poison_empties_food_stock = FALSE
+
+; How far away targets of "Bombard" is allowed to be.
+bombard_max_range = 1
 
 ; What each action should be called when showing them to the player.
 ; The first %s should be before the mnemonic of the action.

Modified: trunk/data/sandbox/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/sandbox/game.ruleset?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/data/sandbox/game.ruleset     (original)
+++ trunk/data/sandbox/game.ruleset     Tue Aug 16 19:55:52 2016
@@ -212,6 +212,9 @@
 ; If poison_empties_food_stock is set to TRUE a successful "Poison City"
 ; will empty the food stock.
 poison_empties_food_stock = FALSE
+
+; How far away targets of "Bombard" is allowed to be.
+bombard_max_range = 1
 
 ; What each action should be called when showing them to the player.
 ; The first %s should be before the mnemonic of the action.

Modified: trunk/data/stub/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/stub/game.ruleset?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/data/stub/game.ruleset        (original)
+++ trunk/data/stub/game.ruleset        Tue Aug 16 19:55:52 2016
@@ -202,6 +202,9 @@
 ; will empty the food stock.
 ;poison_empties_food_stock = FALSE
 
+; How far away targets of "Bombard" is allowed to be.
+bombard_max_range = 1
+
 ; What each action should be called when showing them to the player.
 ; The first %s should be before the mnemonic of the action.
 ; The second %s marks where extra details should be inserted.

Modified: trunk/data/webperimental/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/webperimental/game.ruleset?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/data/webperimental/game.ruleset       (original)
+++ trunk/data/webperimental/game.ruleset       Tue Aug 16 19:55:52 2016
@@ -256,6 +256,9 @@
 ; will empty the food stock.
 poison_empties_food_stock = FALSE
 
+; How far away targets of "Bombard" is allowed to be.
+bombard_max_range = 1
+
 ; What each action should be called when showing them to the player.
 ; The first %s should be before the mnemonic of the action.
 ; The second %s marks where extra details should be inserted.

Modified: trunk/doc/README.actions
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.actions?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/doc/README.actions    (original)
+++ trunk/doc/README.actions    Tue Aug 16 19:55:52 2016
@@ -314,7 +314,8 @@
  * UI name can be set using ui_name_bombard
  * if force_capture_units is true "Capture Units" must be impossible
  * actor must have a bombard_rate > 0
- * actor must be on a tile next to the target.
+ * actor must be on a tile next to the target or, if bombard_max_range
+   allows it, futher away.
  * target can't be in a city the actor player isn't at war with.
  * target owner must be at war with actor. (!)
 

Modified: trunk/server/ruleset.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/ruleset.c?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/server/ruleset.c      (original)
+++ trunk/server/ruleset.c      Tue Aug 16 19:55:52 2016
@@ -5857,6 +5857,12 @@
         = secfile_lookup_bool_default(file,
                                       RS_DEFAULT_POISON_EMPTIES_FOOD_STOCK,
                                       "actions.poison_empties_food_stock");
+
+      /* Allow setting max distance for bombardment before generalized
+       * actions. */
+      action_by_number(ACTION_BOMBARD)->max_distance
+          = secfile_lookup_int_default(file, RS_DEFAULT_BOMBARD_MAX_RANGE,
+                                       "actions.bombard_max_range");
 
       text = secfile_lookup_str_default(file,
           /* TRANS: _Poison City (3% chance of success). */

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Tue Aug 16 19:55:52 2016
@@ -2888,7 +2888,6 @@
 
       adj = base_get_direction_for_step(punit->tile, pdefender->tile, &facing);
 
-      fc_assert(adj);
       if (adj) {
         punit->facing = facing;
 

Modified: trunk/tools/ruleutil/rulesave.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruleutil/rulesave.c?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/tools/ruleutil/rulesave.c     (original)
+++ trunk/tools/ruleutil/rulesave.c     Tue Aug 16 19:55:52 2016
@@ -940,6 +940,10 @@
                     RS_DEFAULT_POISON_EMPTIES_FOOD_STOCK,
                     "actions.poison_empties_food_stock", NULL);
 
+  save_default_int(sfile, action_by_number(ACTION_BOMBARD)->max_distance,
+                    RS_DEFAULT_BOMBARD_MAX_RANGE,
+                    "actions.bombard_max_range", NULL);
+
   secfile_insert_str(sfile,
                      action_by_number(ACTION_SPY_POISON)->ui_name,
                      "actions.ui_name_poison_city");


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

Reply via email to