Author: sveinung
Date: Wed Oct  5 14:02:39 2016
New Revision: 34007

URL: http://svn.gna.org/viewcvs/freeciv?rev=34007&view=rev
Log:
Get rid of force_* action internally.

Get rid of the force_* action semantic internally. Let it stay in the
ruleset (rather than being replace by the action blocked_by semantic until
actions become generalized. (This change helps preparing for generalized
actions)

See patch #7262

Modified:
    trunk/common/networking/packets.def
    trunk/fc_version
    trunk/server/ruleset.c
    trunk/tools/ruleutil/rulesave.c

Modified: trunk/common/networking/packets.def
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/networking/packets.def?rev=34007&r1=34006&r2=34007&view=diff
==============================================================================
--- trunk/common/networking/packets.def (original)
+++ trunk/common/networking/packets.def Wed Oct  5 14:02:39 2016
@@ -553,11 +553,6 @@
   UINT32 first_timeout;
   BOOL tired_attack;
   UINT16 trademindist;
-  /* TODO: the force_* fields can be removed once regular attacks are
-   * action enabler controlled. */
-  BOOL force_capture_units;
-  BOOL force_bombard;
-  BOOL force_explode_nuclear;
   BOOL trading_city;
   BOOL trading_gold;
   BOOL trading_tech;

Modified: trunk/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=34007&r1=34006&r2=34007&view=diff
==============================================================================
--- trunk/fc_version    (original)
+++ trunk/fc_version    Wed Oct  5 14:02:39 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.Oct.05b"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2016.Oct.05c"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""

Modified: trunk/server/ruleset.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/ruleset.c?rev=34007&r1=34006&r2=34007&view=diff
==============================================================================
--- trunk/server/ruleset.c      (original)
+++ trunk/server/ruleset.c      Wed Oct  5 14:02:39 2016
@@ -5802,6 +5802,7 @@
     /* section: actions */
     if (ok) {
       const char *text;
+      int force_capture_units, force_bombard, force_explode_nuclear;
 
       if (secfile_lookup_bool_default(file, RS_DEFAULT_FORCE_TRADE_ROUTE,
                                       "actions.force_trade_route")) {
@@ -5813,11 +5814,11 @@
 
       /* Forbid bombarding, exploading nuclear or attacking when it is
        * legal to capture units. */
-      game.info.force_capture_units
+      force_capture_units
         = secfile_lookup_bool_default(file, RS_DEFAULT_FORCE_CAPTURE_UNITS,
                                       "actions.force_capture_units");
 
-      if (game.info.force_capture_units) {
+      if (force_capture_units) {
         BV_SET(action_by_number(ACTION_BOMBARD)->blocked_by,
                ACTION_CAPTURE_UNITS);
         BV_SET(action_by_number(ACTION_NUKE)->blocked_by,
@@ -5830,11 +5831,11 @@
 
       /* Forbid exploding nuclear or attacking when it is legal to
        * bombard. */
-      game.info.force_bombard
+      force_bombard
         = secfile_lookup_bool_default(file, RS_DEFAULT_FORCE_BOMBARD,
                                       "actions.force_bombard");
 
-      if (game.info.force_bombard) {
+      if (force_bombard) {
         BV_SET(action_by_number(ACTION_NUKE)->blocked_by,
                ACTION_BOMBARD);
         BV_SET(action_by_number(ACTION_ATTACK)->blocked_by,
@@ -5844,12 +5845,12 @@
       }
 
       /* Forbid attacking when it is legal to do explode nuclear. */
-      game.info.force_explode_nuclear
+      force_explode_nuclear
         = secfile_lookup_bool_default(file,
                                       RS_DEFAULT_FORCE_EXPLODE_NUCLEAR,
                                       "actions.force_explode_nuclear");
 
-      if (game.info.force_explode_nuclear) {
+      if (force_explode_nuclear) {
         BV_SET(action_by_number(ACTION_ATTACK)->blocked_by,
                ACTION_NUKE);
         BV_SET(action_by_number(ACTION_CONQUER_CITY)->blocked_by,

Modified: trunk/tools/ruleutil/rulesave.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruleutil/rulesave.c?rev=34007&r1=34006&r2=34007&view=diff
==============================================================================
--- trunk/tools/ruleutil/rulesave.c     (original)
+++ trunk/tools/ruleutil/rulesave.c     Wed Oct  5 14:02:39 2016
@@ -746,6 +746,7 @@
   int i;
   enum gen_action quiet_actions[ACTION_COUNT];
   bool locks;
+  int force_capture_units, force_bombard, force_explode_nuclear;
 
   if (sfile == NULL) {
     return FALSE;
@@ -925,14 +926,24 @@
                                                   ACTION_TRADE_ROUTE),
                     RS_DEFAULT_FORCE_TRADE_ROUTE,
                     "actions.force_trade_route", NULL);
-  /* Sets the forced action in many actions' blocked_by */
-  save_default_bool(sfile, game.info.force_capture_units,
+
+  /* The ruleset options force_capture_units, force_bombard and
+   * force_explode_nuclear sets their respective action to block many other
+   * actions' blocked_by. Checking one is therefore enough. */
+  force_capture_units =
+      BV_ISSET(action_by_number(ACTION_ATTACK)->blocked_by,
+               ACTION_CAPTURE_UNITS);
+  save_default_bool(sfile, force_capture_units,
                     RS_DEFAULT_FORCE_CAPTURE_UNITS,
                     "actions.force_capture_units", NULL);
-  save_default_bool(sfile, game.info.force_bombard,
+  force_bombard =
+      BV_ISSET(action_by_number(ACTION_ATTACK)->blocked_by, ACTION_BOMBARD);
+  save_default_bool(sfile, force_bombard,
                     RS_DEFAULT_FORCE_BOMBARD,
                     "actions.force_bombard", NULL);
-  save_default_bool(sfile, game.info.force_explode_nuclear,
+  force_explode_nuclear =
+      BV_ISSET(action_by_number(ACTION_ATTACK)->blocked_by, ACTION_NUKE);
+  save_default_bool(sfile, force_explode_nuclear,
                     RS_DEFAULT_FORCE_EXPLODE_NUCLEAR,
                     "actions.force_explode_nuclear", NULL);
 


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

Reply via email to