Author: sveinung
Date: Thu Aug 11 02:20:06 2016
New Revision: 33552

URL: http://svn.gna.org/viewcvs/freeciv?rev=33552&view=rev
Log:
2nd targeted "Do..." means target own tile.

Change key_unit_action_select_tgt() so it targets the actor's own tile the
2nd time it is called. Targeting its own tile is the traditional behavior.

This makes using key_unit_action_select_tgt() to handle the "d" key press
less confusing and annoying for old players.

A user with an existing habit of pressing "d" to act against a target on
the same tile as the actor is likely to press it again if the first key press
doesn't work. If he selected the menu item he will notice that the mouse
pointer turns into a selector.

Pressing "d" twice doesn't slow down acting against a target on the same
tile as the actor too much. No mouse required.

See patch #7578

Modified:
    trunk/client/control.c
    trunk/data/helpdata.txt

Modified: trunk/client/control.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/control.c?rev=33552&r1=33551&r2=33552&view=diff
==============================================================================
--- trunk/client/control.c      (original)
+++ trunk/client/control.c      Thu Aug 11 02:20:06 2016
@@ -3058,10 +3058,27 @@
 /**************************************************************************
   Have the user select what action the unit(s) in focus should perform to
   the targets at the tile the user will specify by clicking on it.
+
+  Will stop asking for a target tile and have each actor unit act against
+  its own tile if called twice.
 **************************************************************************/
 void key_unit_action_select_tgt(void)
 {
   struct unit_list *punits = get_units_in_focus();
+
+  if (hover_state == HOVER_ACT_SEL_TGT) {
+    /* The 2nd key press means that the actor should target its own
+     * tile. */
+    key_unit_action_select();
+
+    /* Target tile selected. Clean up hover state. */
+    set_hover_state(NULL, HOVER_NONE,
+                    ACTIVITY_LAST, NULL,
+                    EXTRA_NONE, ACTION_COUNT, ORDER_LAST);
+    update_unit_info_label(punits);
+
+    return;
+  }
 
   set_hover_state(punits, HOVER_ACT_SEL_TGT, ACTIVITY_LAST, NULL,
                   EXTRA_NONE, ACTION_COUNT, ORDER_LAST);

Modified: trunk/data/helpdata.txt
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/helpdata.txt?rev=33552&r1=33551&r2=33552&view=diff
==============================================================================
--- trunk/data/helpdata.txt     (original)
+++ trunk/data/helpdata.txt     Thu Aug 11 02:20:06 2016
@@ -1595,7 +1595,7 @@
   b: (b)uild city  (settler units)\n\
   b: help (b)uild wonder  (caravan units)\n\
   B: go to and (B)uild city on target tile  (settler units)\n\
-  d: (d)o an action to a target on this tile.\n\
+  d: (d)o an action to the selected tile (press twice to target own tile)\n\
   D: (D)isband unit\n\
   E: build airbas(e)  (airbase units)\n\
   f: (f)ortify unit  (military units)\n\


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

Reply via email to