Author: sveinung
Date: Wed Aug 10 16:48:37 2016
New Revision: 33545

URL: http://svn.gna.org/viewcvs/freeciv?rev=33545&view=rev
Log:
Support user specified target tile for "Do...".

Common client code support for letting the user specify the tile "Do..."
should target. No client uses it yet. The user specifies the target tile by
selecting it on the map.

See patch #7572

Modified:
    branches/S2_6/client/control.c
    branches/S2_6/client/control.h
    branches/S2_6/client/goto.c
    branches/S2_6/client/gui-xaw/mapview.c
    branches/S2_6/client/mapctrl_common.c
    branches/S2_6/client/mapview_common.c

Modified: branches/S2_6/client/control.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/control.c?rev=33545&r1=33544&r2=33545&view=diff
==============================================================================
--- branches/S2_6/client/control.c      (original)
+++ branches/S2_6/client/control.c      Wed Aug 10 16:48:37 2016
@@ -1187,6 +1187,10 @@
   case HOVER_PARADROP:
     /* FIXME: check for invalid tiles. */
     mouse_cursor_type = CURSOR_PARADROP;
+    break;
+  case HOVER_ACT_SEL_TGT:
+    /* Select a tile to target / find targets on. */
+    mouse_cursor_type = CURSOR_SELECT;
     break;
   };
 
@@ -2453,6 +2457,22 @@
 }
 
 /**************************************************************************
+  An action selection dialog for the selected units against the specified
+  tile is wanted.
+**************************************************************************/
+static void do_unit_act_sel_vs(struct tile *ptile)
+{
+  unit_list_iterate(get_units_in_focus(), punit) {
+    if (utype_may_act_at_all(unit_type_get(punit))) {
+      /* Have the server record that an action decision is wanted for
+       * this unit against this tile. */
+      request_do_action(ACTION_COUNT, punit->id, tile_index(ptile),
+                        ACTSIG_QUEUE);
+    }
+  } unit_list_iterate_end;
+}
+
+/**************************************************************************
  Handles everything when the user clicked a tile
 **************************************************************************/
 void do_map_click(struct tile *ptile, enum quickselect_type qtype)
@@ -2482,6 +2502,9 @@
     case HOVER_PATROL:
       do_unit_patrol_to(ptile);
       break;   
+    case HOVER_ACT_SEL_TGT:
+      do_unit_act_sel_vs(ptile);
+      break;
     }
 
     set_hover_state(NULL, HOVER_NONE, ACTIVITY_LAST, NULL, ORDER_LAST);
@@ -2809,6 +2832,7 @@
     }
     /* else fall through: */
   case HOVER_PARADROP:
+  case HOVER_ACT_SEL_TGT:
     set_hover_state(NULL, HOVER_NONE, ACTIVITY_LAST, NULL, ORDER_LAST);
     update_unit_info_label(get_units_in_focus());
 
@@ -2931,6 +2955,18 @@
                         ACTSIG_QUEUE);
     }
   } unit_list_iterate_end;
+}
+
+/**************************************************************************
+  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.
+**************************************************************************/
+void key_unit_action_select_tgt(void)
+{
+  struct unit_list *punits = get_units_in_focus();
+
+  set_hover_state(punits, HOVER_ACT_SEL_TGT, ACTIVITY_LAST, NULL,
+                  ORDER_LAST);
 }
 
 /**************************************************************************

Modified: branches/S2_6/client/control.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/control.h?rev=33545&r1=33544&r2=33545&view=diff
==============================================================================
--- branches/S2_6/client/control.h      (original)
+++ branches/S2_6/client/control.h      Wed Aug 10 16:48:37 2016
@@ -28,7 +28,8 @@
   HOVER_NUKE,
   HOVER_PARADROP,
   HOVER_CONNECT,
-  HOVER_PATROL
+  HOVER_PATROL,
+  HOVER_ACT_SEL_TGT
 };
 
 /* Selecting unit from a stack without popup. */
@@ -228,6 +229,7 @@
 void key_unit_connect(enum unit_activity activity,
                       struct extra_type *tgt);
 void key_unit_action_select(void);
+void key_unit_action_select_tgt(void);
 void key_unit_convert(void);
 void key_unit_done(void);
 void key_unit_fallout(void);

Modified: branches/S2_6/client/goto.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/goto.c?rev=33545&r1=33544&r2=33545&view=diff
==============================================================================
--- branches/S2_6/client/goto.c (original)
+++ branches/S2_6/client/goto.c Wed Aug 10 16:48:37 2016
@@ -966,9 +966,12 @@
     break;
   case HOVER_NONE:
   case HOVER_PARADROP:
+  case HOVER_ACT_SEL_TGT:
     fc_assert_msg(hover_state != HOVER_NONE, "Goto with HOVER_NONE?");
     fc_assert_msg(hover_state != HOVER_PARADROP,
                   "Goto with HOVER_PARADROP?");
+    fc_assert_msg(hover_state != HOVER_ACT_SEL_TGT,
+                  "Goto with HOVER_ACT_SEL_TGT?");
     break;
   };
 }

Modified: branches/S2_6/client/gui-xaw/mapview.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-xaw/mapview.c?rev=33545&r1=33544&r2=33545&view=diff
==============================================================================
--- branches/S2_6/client/gui-xaw/mapview.c      (original)
+++ branches/S2_6/client/gui-xaw/mapview.c      Wed Aug 10 16:48:37 2016
@@ -251,6 +251,9 @@
     case HOVER_PARADROP:
       XDefineCursor(display, XtWindow(map_canvas), cursors[CURSOR_PARADROP]);
       break;
+    case HOVER_ACT_SEL_TGT:
+      XDefineCursor(display, XtWindow(map_canvas), cursors[CURSOR_SELECT]);
+      break;
     }
   } else {
     xaw_set_label(unit_info_label, "");

Modified: branches/S2_6/client/mapctrl_common.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/mapctrl_common.c?rev=33545&r1=33544&r2=33545&view=diff
==============================================================================
--- branches/S2_6/client/mapctrl_common.c       (original)
+++ branches/S2_6/client/mapctrl_common.c       Wed Aug 10 16:48:37 2016
@@ -656,6 +656,7 @@
     is_valid_goto_draw_line(ptile);
   case HOVER_NONE:
   case HOVER_PARADROP:
+  case HOVER_ACT_SEL_TGT:
     break;
   };
 }
@@ -679,6 +680,7 @@
     is_valid_goto_draw_line(ptile);
   case HOVER_NONE:
   case HOVER_PARADROP:
+  case HOVER_ACT_SEL_TGT:
     break;
   };
 }

Modified: branches/S2_6/client/mapview_common.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/mapview_common.c?rev=33545&r1=33544&r2=33545&view=diff
==============================================================================
--- branches/S2_6/client/mapview_common.c       (original)
+++ branches/S2_6/client/mapview_common.c       Wed Aug 10 16:48:37 2016
@@ -589,6 +589,7 @@
     create_line_at_mouse_pos();
   case HOVER_NONE:
   case HOVER_PARADROP:
+  case HOVER_ACT_SEL_TGT:
     break;
   };
   if (rectangle_active) {


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

Reply via email to