Author: sveinung
Date: Wed Feb 17 15:27:41 2016
New Revision: 31960

URL: http://svn.gna.org/viewcvs/freeciv?rev=31960&view=rev
Log:
client: new action in order assertions.

Catch all non actions given as the last action, not just ACTION_COUNT.
Catch an action unsupported in orders given as the last order.
Catch an action that requires details given in the Qt client's Go to and...
menu.

See patch #6966

Modified:
    trunk/client/control.c
    trunk/client/gui-qt/menu.cpp

Modified: trunk/client/control.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/control.c?rev=31960&r1=31959&r2=31960&view=diff
==============================================================================
--- trunk/client/control.c      (original)
+++ trunk/client/control.c      Wed Feb 17 15:27:41 2016
@@ -1048,7 +1048,14 @@
   }
 
   if (last_order == ORDER_PERFORM_ACTION) {
-    fc_assert_ret(action_id != ACTION_COUNT);
+    /* An action has been specified. */
+    fc_assert_ret(action_id_is_valid(action_id));
+
+    /* The order system doesn't support actions that can be done to a
+     * target that isn't at or next to the actor unit's tile.
+     *
+     * Full explanation in handle_unit_orders(). */
+    fc_assert_ret(action_by_number(action_id)->max_distance <= 1);
 
     unit_list_iterate(punits, punit) {
       if (!unit_can_do_action(punit, action_id)) {

Modified: trunk/client/gui-qt/menu.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=31960&r1=31959&r2=31960&view=diff
==============================================================================
--- trunk/client/gui-qt/menu.cpp        (original)
+++ trunk/client/gui-qt/menu.cpp        Wed Feb 17 15:27:41 2016
@@ -457,6 +457,13 @@
 **************************************************************************/
 void go_act_menu::start_go_act(int action_id)
 {
+  /* This menu doesn't support specifying a detailed target (think
+   * "Go to and..."->"Industrial Sabotage"->"City Walls") for the
+   * action order. */
+  fc_assert_ret_msg(!action_requires_details(action_id),
+                    "Underspecified target for %s.",
+                    action_get_ui_name(action_id));
+
   request_unit_goto(ORDER_PERFORM_ACTION, action_id, EXTRA_NONE);
 }
 


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

Reply via email to