Author: sveinung
Date: Thu Aug 11 02:20:27 2016
New Revision: 33554

URL: http://svn.gna.org/viewcvs/freeciv?rev=33554&view=rev
Log:
Qt client: act sel dlg paradrop and airlift.

Support the actions "Paradrop Unit" and "Airlift Unit" in the action
selection dialog.

See patch #7580

Modified:
    trunk/client/gui-qt/dialogs.cpp

Modified: trunk/client/gui-qt/dialogs.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/dialogs.cpp?rev=33554&r1=33553&r2=33554&view=diff
==============================================================================
--- trunk/client/gui-qt/dialogs.cpp     (original)
+++ trunk/client/gui-qt/dialogs.cpp     Thu Aug 11 02:20:27 2016
@@ -89,9 +89,11 @@
 static void found_city(QVariant data1, QVariant data2);
 static void nuke(QVariant data1, QVariant data2);
 static void attack(QVariant data1, QVariant data2);
+static void paradrop(QVariant data1, QVariant data2);
 static void disband_unit(QVariant data1, QVariant data2);
 static void join_city(QVariant data1, QVariant data2);
 static void unit_home_city(QVariant data1, QVariant data2);
+static void airlift(QVariant data1, QVariant data2);
 static void keep_moving(QVariant data1, QVariant data2);
 static void pillage_something(QVariant data1, QVariant data2);
 static void action_entry(choice_dialog *cd,
@@ -142,6 +144,7 @@
   action_function[ACTION_DESTROY_CITY] = destroy_city;
   action_function[ACTION_RECYCLE_UNIT] = unit_recycle;
   action_function[ACTION_HOME_CITY] = unit_home_city;
+  action_function[ACTION_AIRLIFT] = airlift;
 
   /* Unit acting against a unit target. */
   action_function[ACTION_SPY_BRIBE_UNIT] = diplomat_bribe;
@@ -155,6 +158,7 @@
   /* Unit acting against a tile. */
   action_function[ACTION_FOUND_CITY] = found_city;
   action_function[ACTION_NUKE] = nuke;
+  action_function[ACTION_PARADROP] = paradrop;
   action_function[ACTION_ATTACK] = attack;
 
   /* Unit acting with no target except itself. */
@@ -1262,6 +1266,21 @@
 }
 
 /***************************************************************************
+  Action "Airlift Unit" for choice dialog
+***************************************************************************/
+static void airlift(QVariant data1, QVariant data2)
+{
+  int actor_id = data1.toInt();
+  int tgt_city_id = data2.toInt();
+
+  if (NULL != game_unit_by_number(actor_id)
+      && NULL != game_city_by_number(tgt_city_id)) {
+    request_do_action(ACTION_AIRLIFT,
+                      actor_id, tgt_city_id, 0, "");
+  }
+}
+
+/***************************************************************************
   Delay selection of what action to take.
 ***************************************************************************/
 static void act_sel_wait(QVariant data1, QVariant data2)
@@ -1758,6 +1777,21 @@
 }
 
 /**************************************************************************
+  Action "Paradrop Unit" for choice dialog
+**************************************************************************/
+static void paradrop(QVariant data1, QVariant data2)
+{
+  int actor_id = data1.toInt();
+  int target_id = data2.toInt();
+
+  if (NULL != game_unit_by_number(actor_id)
+      && NULL != index_to_tile(target_id)) {
+    request_do_action(ACTION_PARADROP,
+                      actor_id, target_id, 0, "");
+  }
+}
+
+/**************************************************************************
   Action join city for choice dialog
 **************************************************************************/
 static void join_city(QVariant data1, QVariant data2)


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

Reply via email to