Author: sveinung
Date: Fri Feb 19 12:26:51 2016
New Revision: 31990

URL: http://svn.gna.org/viewcvs/freeciv?rev=31990&view=rev
Log:
Improve one-action-selection-at-once readability.

See patch #6971

Modified:
    branches/S2_6/client/control.c

Modified: branches/S2_6/client/control.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/control.c?rev=31990&r1=31989&r2=31990&view=diff
==============================================================================
--- branches/S2_6/client/control.c      (original)
+++ branches/S2_6/client/control.c      Fri Feb 19 12:26:51 2016
@@ -91,7 +91,10 @@
 static struct unit *punit_attacking = NULL;
 static struct unit *punit_defending = NULL;
 
-static bool have_asked_server_for_actions = FALSE;
+/* No client supports more than one action selection process at once. It
+ * begins when the client asks the server what actions a unit can take. It
+ * ends when the last follow up question is answered. */
+static bool action_selection_in_progress = FALSE;
 
 /*
  * This variable is TRUE iff a NON-AI controlled unit was focused this
@@ -297,7 +300,7 @@
 static bool can_ask_server_for_actions(void)
 {
   /* OK as long as no other unit already asked and aren't done yet. */
-  return (!have_asked_server_for_actions
+  return (!action_selection_in_progress
           && action_selection_actor_unit() == IDENTITY_NUMBER_ZERO);
 }
 
@@ -314,9 +317,8 @@
   fc_assert_ret(punit->action_decision_tile);
 
   /* Only one action selection dialog at a time is supported. */
-  fc_assert(!have_asked_server_for_actions);
-
-  have_asked_server_for_actions = TRUE;
+  fc_assert(!action_selection_in_progress);
+  action_selection_in_progress = TRUE;
 
   dsend_packet_unit_get_actions(&client.conn,
                                 punit->id,
@@ -964,8 +966,8 @@
 {
   struct unit *old;
 
-  /* This was called because the queue can move on. */
-  have_asked_server_for_actions = FALSE;
+  /* Stop objecting to allowing the next unit to ask. */
+  action_selection_in_progress = FALSE;
 
   if ((old = game_unit_by_number(old_actor_id))) {
     /* Have the server record that a decision no longer is wanted. */


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

Reply via email to