Author: sveinung
Date: Sun Mar 12 13:30:57 2017
New Revision: 35102

URL: http://svn.gna.org/viewcvs/freeciv?rev=35102&view=rev
Log:
Clarify action_auto_perf action list terminator.

Specify that the value that terminates action auto performers' action lists
is ACTION_NONE (no action). ACTION_COUNT, while currently the same value,
can be understood in other ways too.

See hrm Feature #644169

Modified:
    branches/S3_0/common/actions.c
    branches/S3_0/common/actions.h
    branches/S3_0/server/ruleset.c
    branches/S3_0/tools/ruleutil/rulesave.c

Modified: branches/S3_0/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/actions.c?rev=35102&r1=35101&r2=35102&view=diff
==============================================================================
--- branches/S3_0/common/actions.c      (original)
+++ branches/S3_0/common/actions.c      Sun Mar 12 13:30:57 2017
@@ -514,7 +514,7 @@
 
     for (j = 0; j < ACTION_COUNT; j++) {
       /* Nothing here. Nothing after this point. */
-      auto_perfs[i].alternatives[j] = ACTION_COUNT;
+      auto_perfs[i].alternatives[j] = ACTION_NONE;
     }
   }
 

Modified: branches/S3_0/common/actions.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/actions.h?rev=35102&r1=35101&r2=35102&view=diff
==============================================================================
--- branches/S3_0/common/actions.h      (original)
+++ branches/S3_0/common/actions.h      Sun Mar 12 13:30:57 2017
@@ -265,7 +265,7 @@
   struct requirement_vector reqs;
 
   /* Auto perform the first legal action in this list.
-   * The list is terminated by ACTION_COUNT. */
+   * The list is terminated by ACTION_NONE. */
   enum gen_action alternatives[ACTION_COUNT];
 };
 
@@ -301,7 +301,7 @@
   for (_perf_pos_ = 0; _perf_pos_ < ACTION_COUNT; _perf_pos_++) {         \
     const int _act_id_ = _autoperf_->alternatives[_perf_pos_];            \
                                                                           \
-    if (_act_id_ == ACTION_COUNT) {                                       \
+    if (_act_id_ == ACTION_NONE) {                                        \
       /* No more alternative actions. */                                  \
       break;                                                              \
     }

Modified: branches/S3_0/server/ruleset.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/ruleset.c?rev=35102&r1=35101&r2=35102&view=diff
==============================================================================
--- branches/S3_0/server/ruleset.c      (original)
+++ branches/S3_0/server/ruleset.c      Sun Mar 12 13:30:57 2017
@@ -7509,8 +7509,8 @@
     for (counter = 0;
          /* Can't list more actions than all actions. */
          counter < ACTION_COUNT
-         /* ACTION_COUNT terminates the list. */
-         && aperf->alternatives[counter] != ACTION_COUNT;
+         /* ACTION_NONE terminates the list. */
+         && aperf->alternatives[counter] != ACTION_NONE;
          counter++) {
       packet.alternatives[counter] = aperf->alternatives[counter];
     }

Modified: branches/S3_0/tools/ruleutil/rulesave.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/tools/ruleutil/rulesave.c?rev=35102&r1=35101&r2=35102&view=diff
==============================================================================
--- branches/S3_0/tools/ruleutil/rulesave.c     (original)
+++ branches/S3_0/tools/ruleutil/rulesave.c     Sun Mar 12 13:30:57 2017
@@ -571,7 +571,7 @@
 
   i = 0;
   for (i = 0;
-       i < ACTION_COUNT && auto_perf->alternatives[i] != ACTION_COUNT;
+       i < ACTION_COUNT && auto_perf->alternatives[i] != ACTION_NONE;
        i++) {
     unit_acts[i] = auto_perf->alternatives[i];
   }


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

Reply via email to