Author: sveinung
Date: Tue Mar 14 10:39:20 2017
New Revision: 35109

URL: http://svn.gna.org/viewcvs/freeciv?rev=35109&view=rev
Log:
Clarify "no action" in unit order.

Use ACTION_NONE inn all cases that specifies that a unit order has no
action. This is clearer than ACTION_COUNT.

See hrm Feature #644455

Modified:
    trunk/client/control.c
    trunk/client/goto.c
    trunk/client/gui-qt/mapctrl.cpp
    trunk/client/gui-qt/menu.cpp
    trunk/client/mapctrl_common.c
    trunk/client/packhand.c
    trunk/server/savecompat.c
    trunk/server/savegame2.c
    trunk/server/savegame3.c
    trunk/server/unithand.c

Modified: trunk/client/control.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/control.c?rev=35109&r1=35108&r2=35109&view=diff
==============================================================================
--- trunk/client/control.c      (original)
+++ trunk/client/control.c      Tue Mar 14 10:39:20 2017
@@ -168,7 +168,7 @@
 
   set_hover_state(NULL, HOVER_NONE,
                   ACTIVITY_LAST, NULL,
-                  EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                  EXTRA_NONE, ACTION_NONE, ORDER_LAST);
   free_client_goto();
 }
 
@@ -234,7 +234,7 @@
   if (get_num_units_in_focus() < 1) {
     set_hover_state(NULL, HOVER_NONE,
                     ACTIVITY_LAST, NULL,
-                    EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                    EXTRA_NONE, ACTION_NONE, ORDER_LAST);
   }
 
   unit_list_remove(previous_focus, punit);
@@ -296,7 +296,7 @@
                 || state == HOVER_NONE);
   fc_assert_ret(state == HOVER_CONNECT || activity == ACTIVITY_LAST);
   fc_assert_ret(state == HOVER_GOTO || order == ORDER_LAST);
-  fc_assert_ret(state == HOVER_GOTO || action == ACTION_COUNT);
+  fc_assert_ret(state == HOVER_GOTO || action == ACTION_NONE);
   exit_goto_state();
   hover_state = state;
   connect_activity = activity;
@@ -530,7 +530,7 @@
   if (focus_changed) {
     set_hover_state(NULL, HOVER_NONE,
                     ACTIVITY_LAST, NULL,
-                    EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                    EXTRA_NONE, ACTION_NONE, ORDER_LAST);
     focus_units_changed();
   }
 }
@@ -560,7 +560,7 @@
      * change. Cancel it. */
     set_hover_state(NULL, HOVER_NONE,
                     ACTIVITY_LAST, NULL,
-                    EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                    EXTRA_NONE, ACTION_NONE, ORDER_LAST);
   }
 
   current_focus_append(punit);
@@ -592,7 +592,7 @@
      * change. Cancel it. */
     set_hover_state(NULL, HOVER_NONE,
                     ACTIVITY_LAST, NULL,
-                    EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                    EXTRA_NONE, ACTION_NONE, ORDER_LAST);
   }
 
   current_focus_remove(punit);
@@ -670,7 +670,7 @@
 
   set_hover_state(NULL, HOVER_NONE,
                   ACTIVITY_LAST, NULL,
-                  EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                  EXTRA_NONE, ACTION_NONE, ORDER_LAST);
 
   unit_list_iterate(get_units_in_focus(), punit) {
     /* 
@@ -1093,7 +1093,7 @@
 {
   struct unit_list *punits = get_units_in_focus();
 
-  fc_assert_ret(action_id == ACTION_COUNT
+  fc_assert_ret(action_id == ACTION_NONE
                 || last_order == ORDER_PERFORM_ACTION);
 
   if (unit_list_size(punits) == 0) {
@@ -1428,7 +1428,7 @@
           && (activity == ACTIVITY_GEN_ROAD
               || activity == ACTIVITY_IRRIGATE))) {
     set_hover_state(punits, HOVER_CONNECT,
-                    activity, tgt, EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                    activity, tgt, EXTRA_NONE, ACTION_NONE, ORDER_LAST);
     enter_goto_state(punits);
     create_line_at_mouse_pos();
     update_unit_info_label(punits);
@@ -1500,7 +1500,7 @@
       order.dir = DIR8_ORIGIN;
       order.activity = ACTIVITY_SENTRY;
       order.target = EXTRA_NONE;
-      order.action = ACTION_COUNT;
+      order.action = ACTION_NONE;
       send_goto_path(punit, path, &order);
     } else {
       send_goto_path(punit, path, NULL);
@@ -1710,7 +1710,7 @@
   p.dir[0] = dir;
   p.activity[0] = ACTIVITY_LAST;
   p.target[0] = EXTRA_NONE;
-  p.action[0] = ACTION_COUNT;
+  p.action[0] = ACTION_NONE;
 
   send_packet_unit_orders(&client.conn, &p);
 }
@@ -1762,7 +1762,7 @@
   p.dir[0] = dir;
   p.activity[0] = ACTIVITY_LAST;
   p.target[0] = EXTRA_NONE;
-  p.action[0] = ACTION_COUNT;
+  p.action[0] = ACTION_NONE;
 
   send_packet_unit_orders(&client.conn, &p);
 }
@@ -2066,7 +2066,7 @@
                  _("Click on a tile to paradrop to it."));
 
     set_hover_state(punits, HOVER_PARADROP, ACTIVITY_LAST, NULL,
-                    EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                    EXTRA_NONE, ACTION_NONE, ORDER_LAST);
     update_unit_info_label(punits);
   } else {
     create_event(offender, E_BAD_COMMAND, ftc_client,
@@ -2087,7 +2087,7 @@
 
   if (hover_state != HOVER_PATROL) {
     set_hover_state(punits, HOVER_PATROL, ACTIVITY_LAST, NULL,
-                    EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                    EXTRA_NONE, ACTION_NONE, ORDER_LAST);
     update_unit_info_label(punits);
     enter_goto_state(punits);
     create_line_at_mouse_pos();
@@ -2581,7 +2581,7 @@
     /* Cancel current goto/patrol/connect/nuke command. */
     set_hover_state(NULL, HOVER_NONE,
                     ACTIVITY_LAST, NULL,
-                    EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                    EXTRA_NONE, ACTION_NONE, ORDER_LAST);
     update_unit_info_label(get_units_in_focus());
   }
 
@@ -2687,7 +2687,7 @@
 
     set_hover_state(NULL, HOVER_NONE,
                     ACTIVITY_LAST, NULL,
-                    EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                    EXTRA_NONE, ACTION_NONE, ORDER_LAST);
     update_unit_info_label(get_units_in_focus());
   }
 
@@ -2905,7 +2905,7 @@
 
   set_hover_state(NULL, HOVER_NONE,
                   ACTIVITY_LAST, NULL,
-                  EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                  EXTRA_NONE, ACTION_NONE, ORDER_LAST);
 }
  
 /**************************************************************************
@@ -2924,7 +2924,7 @@
 
   set_hover_state(NULL, HOVER_NONE,
                   ACTIVITY_LAST, NULL,
-                  EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                  EXTRA_NONE, ACTION_NONE, ORDER_LAST);
 }
  
 /**************************************************************************
@@ -2946,7 +2946,7 @@
   case HOVER_ACT_SEL_TGT:
     set_hover_state(NULL, HOVER_NONE,
                     ACTIVITY_LAST, NULL,
-                    EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                    EXTRA_NONE, ACTION_NONE, ORDER_LAST);
     update_unit_info_label(get_units_in_focus());
 
     keyboardless_goto_button_down = FALSE;
@@ -3089,7 +3089,7 @@
     /* Target tile selected. Clean up hover state. */
     set_hover_state(NULL, HOVER_NONE,
                     ACTIVITY_LAST, NULL,
-                    EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                    EXTRA_NONE, ACTION_NONE, ORDER_LAST);
     update_unit_info_label(punits);
 
     return;
@@ -3102,7 +3102,7 @@
                  "Press 'd' again to act against own tile."));
 
   set_hover_state(punits, HOVER_ACT_SEL_TGT, ACTIVITY_LAST, NULL,
-                  EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                  EXTRA_NONE, ACTION_NONE, ORDER_LAST);
 }
 
 /**************************************************************************
@@ -3118,7 +3118,7 @@
 **************************************************************************/
 void key_unit_goto(void)
 {
-  request_unit_goto(ORDER_LAST, ACTION_COUNT, EXTRA_NONE);
+  request_unit_goto(ORDER_LAST, ACTION_NONE, EXTRA_NONE);
 }
 
 /**************************************************************************

Modified: trunk/client/goto.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/goto.c?rev=35109&r1=35108&r2=35109&view=diff
==============================================================================
--- trunk/client/goto.c (original)
+++ trunk/client/goto.c Tue Mar 14 10:39:20 2017
@@ -1391,14 +1391,14 @@
       p.dir[i] = DIR8_ORIGIN;
       p.activity[i] = ACTIVITY_LAST;
       p.target[i] = EXTRA_NONE;
-      p.action[i] = ACTION_COUNT;
+      p.action[i] = ACTION_NONE;
       log_goto_packet("  packet[%d] = wait: %d,%d", i, TILE_XY(old_tile));
     } else {
       p.orders[i] = orders;
       p.dir[i] = get_direction_for_step(old_tile, new_tile);
       p.activity[i] = ACTIVITY_LAST;
       p.target[i] = EXTRA_NONE;
-      p.action[i] = ACTION_COUNT;
+      p.action[i] = ACTION_NONE;
       log_goto_packet("  packet[%d] = move %s: %d,%d => %d,%d",
                       i, dir_get_name(p.dir[i]),
                       TILE_XY(old_tile), TILE_XY(new_tile));
@@ -1557,7 +1557,7 @@
   p->dir[p->length] = DIR8_ORIGIN;
   p->activity[p->length] = ACTIVITY_GEN_ROAD;
   p->target[p->length] = extra_index(pextra);
-  p->action[p->length] = ACTION_COUNT;
+  p->action[p->length] = ACTION_NONE;
   p->length++;
 
   return TRUE;
@@ -1606,7 +1606,7 @@
           p.dir[p.length] = DIR8_ORIGIN;
          p.activity[p.length] = ACTIVITY_IRRIGATE;
           p.target[p.length] = extra_index(tgt);
-          p.action[p.length] = ACTION_COUNT;
+          p.action[p.length] = ACTION_NONE;
          p.length++;
        }
        break;
@@ -1627,7 +1627,7 @@
        p.dir[p.length] = get_direction_for_step(old_tile, new_tile);
         p.activity[p.length] = ACTIVITY_LAST;
         p.target[p.length] = EXTRA_NONE;
-        p.action[p.length] = ACTION_COUNT;
+        p.action[p.length] = ACTION_NONE;
        p.length++;
 
        old_tile = new_tile;

Modified: trunk/client/gui-qt/mapctrl.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapctrl.cpp?rev=35109&r1=35108&r2=35109&view=diff
==============================================================================
--- trunk/client/gui-qt/mapctrl.cpp     (original)
+++ trunk/client/gui-qt/mapctrl.cpp     Tue Mar 14 10:39:20 2017
@@ -275,7 +275,7 @@
     ptile = canvas_pos_to_tile(pos.x(), pos.y());
     gui()->menu_bar->set_tile_for_order(ptile);
     set_hover_state(NULL, HOVER_NONE, ACTIVITY_LAST, NULL,
-                    EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                    EXTRA_NONE, ACTION_NONE, ORDER_LAST);
     exit_goto_state();
     gui()->menu_bar->delayed_order = false;
     return;

Modified: trunk/client/gui-qt/menu.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=35109&r1=35108&r2=35109&view=diff
==============================================================================
--- trunk/client/gui-qt/menu.cpp        (original)
+++ trunk/client/gui-qt/menu.cpp        Tue Mar 14 10:39:20 2017
@@ -2674,7 +2674,7 @@
   }
   if (hover_state != HOVER_GOTO) {
     set_hover_state(punits, HOVER_GOTO, ACTIVITY_LAST, NULL,
-                    EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                    EXTRA_NONE, ACTION_NONE, ORDER_LAST);
     enter_goto_state(punits);
     create_line_at_mouse_pos();
     control_mouse_cursor(NULL);

Modified: trunk/client/mapctrl_common.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/mapctrl_common.c?rev=35109&r1=35108&r2=35109&view=diff
==============================================================================
--- trunk/client/mapctrl_common.c       (original)
+++ trunk/client/mapctrl_common.c       Tue Mar 14 10:39:20 2017
@@ -490,7 +490,7 @@
     do_unit_goto(ptile);
     set_hover_state(NULL, HOVER_NONE,
                     ACTIVITY_LAST, NULL,
-                    EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                    EXTRA_NONE, ACTION_NONE, ORDER_LAST);
     update_unit_info_label(get_units_in_focus());
   }
   keyboardless_goto_active = FALSE;
@@ -510,7 +510,7 @@
       && !same_pos(keyboardless_goto_start_tile, ptile)
       && can_client_issue_orders()) {
     keyboardless_goto_active = TRUE;
-    request_unit_goto(ORDER_LAST, ACTION_COUNT, EXTRA_NONE);
+    request_unit_goto(ORDER_LAST, ACTION_NONE, EXTRA_NONE);
   }
 }
 

Modified: trunk/client/packhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/packhand.c?rev=35109&r1=35108&r2=35109&view=diff
==============================================================================
--- trunk/client/packhand.c     (original)
+++ trunk/client/packhand.c     Tue Mar 14 10:39:20 2017
@@ -2043,7 +2043,7 @@
     /* Clears the current goto command. */
     set_hover_state(NULL, HOVER_NONE,
                     ACTIVITY_LAST, NULL,
-                    EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+                    EXTRA_NONE, ACTION_NONE, ORDER_LAST);
 
     if (pinfo->is_edit_mode && game.scenario.handmade) {
       if (!handmade_scenario_warning()) {

Modified: trunk/server/savecompat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savecompat.c?rev=35109&r1=35108&r2=35109&view=diff
==============================================================================
--- trunk/server/savecompat.c   (original)
+++ trunk/server/savecompat.c   Tue Mar 14 10:39:20 2017
@@ -1827,7 +1827,7 @@
 
 /**************************************************************************
   Returns the action id corresponding to the specified order id. If no
-  corresponding action is found ACTION_COUNT is returned.
+  corresponding action is found ACTION_NONE is returned.
 
   Relevant tile content information must be loaded before this function is
   called. Tile content information is relevant if it determines what action
@@ -1880,5 +1880,5 @@
   }
 
   /* The order hasn't been replaced by an action. */
-  return ACTION_COUNT;
-}
+  return ACTION_NONE;
+}

Modified: trunk/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame2.c?rev=35109&r1=35108&r2=35109&view=diff
==============================================================================
--- trunk/server/savegame2.c    (original)
+++ trunk/server/savegame2.c    Tue Mar 14 10:39:20 2017
@@ -4230,7 +4230,7 @@
         /* The order may have been replaced by the perform action order */
         order->action = sg_order_to_action(order->order, punit,
                                            punit->goto_tile);
-        if (order->action != ACTION_COUNT) {
+        if (order->action != ACTION_NONE) {
           /* The order was converted by order_to_action */
           order->order = ORDER_PERFORM_ACTION;
         }

Modified: trunk/server/savegame3.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame3.c?rev=35109&r1=35108&r2=35109&view=diff
==============================================================================
--- trunk/server/savegame3.c    (original)
+++ trunk/server/savegame3.c    Tue Mar 14 10:39:20 2017
@@ -5446,12 +5446,12 @@
                          ||
 #endif /* FREECIV_DEV_SAVE_COMPAT_3_0 */
                          action_unitstr[j] == '?'
-                         ? ACTION_COUNT
+                         ? ACTION_NONE
                          : char2num(action_unitstr[j]));
 
 #ifdef FREECIV_DEV_SAVE_COMPAT_3_0
         if (order->order != ORDER_PERFORM_ACTION
-            && order->action == ACTION_COUNT) {
+            && order->action == ACTION_NONE) {
           /* This order may have been replaced by the perform action
            * order */
 
@@ -5459,7 +5459,7 @@
           order->action = sg_order_to_action(order->order, punit,
                                              punit->goto_tile);
 
-          if (order->action != ACTION_COUNT) {
+          if (order->action != ACTION_NONE) {
             /* The order should be upgraded. */
             order->order = ORDER_PERFORM_ACTION;
           }

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=35109&r1=35108&r2=35109&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Tue Mar 14 10:39:20 2017
@@ -4651,9 +4651,9 @@
         break;
       /* Invalid action. Should have been caught above. */
       case ACTION_COUNT:
-        fc_assert_ret_msg(packet->action[i] != ACTION_COUNT,
-                          "ACTION_COUNT in order number %d from %s to "
-                          "unit number %d.",
+        fc_assert_ret_msg(packet->action[i] != ACTION_NONE,
+                          "ACTION_NONE in ORDER_PERFORM_ACTION order. "
+                          "Order number %d from %s to unit number %d.",
                           i, player_name(pplayer), packet->unit_id);
       }
 


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

Reply via email to