Author: sveinung
Date: Fri Feb 19 12:25:57 2016
New Revision: 31987

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

See patch #6971

Modified:
    trunk/client/control.c

Modified: trunk/client/control.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/control.c?rev=31987&r1=31986&r2=31987&view=diff
==============================================================================
--- trunk/client/control.c      (original)
+++ trunk/client/control.c      Fri Feb 19 12:25:57 2016
@@ -104,7 +104,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
@@ -319,7 +322,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);
 }
 
@@ -336,9 +339,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,
@@ -994,8 +996,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