Author: sveinung
Date: Sun Mar 12 13:27:09 2017
New Revision: 35099

URL: http://svn.gna.org/viewcvs/freeciv?rev=35099&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:
    trunk/common/actions.c
    trunk/common/actions.h
    trunk/server/ruleset.c
    trunk/tools/ruleutil/rulesave.c

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=35099&r1=35098&r2=35099&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Sun Mar 12 13:27:09 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: trunk/common/actions.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.h?rev=35099&r1=35098&r2=35099&view=diff
==============================================================================
--- trunk/common/actions.h      (original)
+++ trunk/common/actions.h      Sun Mar 12 13:27:09 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: trunk/server/ruleset.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/ruleset.c?rev=35099&r1=35098&r2=35099&view=diff
==============================================================================
--- trunk/server/ruleset.c      (original)
+++ trunk/server/ruleset.c      Sun Mar 12 13:27:09 2017
@@ -7496,8 +7496,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: trunk/tools/ruleutil/rulesave.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruleutil/rulesave.c?rev=35099&r1=35098&r2=35099&view=diff
==============================================================================
--- trunk/tools/ruleutil/rulesave.c     (original)
+++ trunk/tools/ruleutil/rulesave.c     Sun Mar 12 13:27:09 2017
@@ -572,7 +572,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