Author: sveinung
Date: Wed Mar 22 16:31:32 2017
New Revision: 35151
URL: http://svn.gna.org/viewcvs/freeciv?rev=35151&view=rev
Log:
SDL2 client: add "Upgrade Unit" to act sel dlg.
Add a button for the "Upgrade Unit" action to the action selection dialog.
This makes the SDL2 client's action selection dialog cover all actions.
See hrm Feature #646483
Modified:
trunk/client/gui-sdl2/action_dialog.c
Modified: trunk/client/gui-sdl2/action_dialog.c
URL:
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/action_dialog.c?rev=35151&r1=35150&r2=35151&view=diff
==============================================================================
--- trunk/client/gui-sdl2/action_dialog.c (original)
+++ trunk/client/gui-sdl2/action_dialog.c Wed Mar 22 16:31:32 2017
@@ -1021,6 +1021,26 @@
pDiplomat_Dlg->actor_unit_id,
pDiplomat_Dlg->target_ids[ATK_CITY],
0, "");
+ }
+
+ popdown_diplomat_dialog();
+ }
+
+ return -1;
+}
+
+/****************************************************************
+ User clicked "Upgrade Unit"
+*****************************************************************/
+static int upgrade_callback(struct widget *pWidget)
+{
+ if (Main.event.button.button == SDL_BUTTON_LEFT) {
+ struct unit *punit;
+ struct city *pcity;
+
+ if ((pcity = game_city_by_number(pDiplomat_Dlg->target_ids[ATK_CITY]))
+ && (punit = game_unit_by_number(pDiplomat_Dlg->actor_unit_id))) {
+ popup_unit_upgrade_dlg(punit, pcity);
}
popdown_diplomat_dialog();
@@ -1124,6 +1144,7 @@
[ACTION_DESTROY_CITY] = destroy_city_callback,
[ACTION_RECYCLE_UNIT] = unit_recycle_callback,
[ACTION_HOME_CITY] = home_city_callback,
+ [ACTION_UPGRADE_UNIT] = upgrade_callback,
[ACTION_AIRLIFT] = airlift_callback,
[ACTION_CONQUER_CITY] = conquer_city_callback,
_______________________________________________
Freeciv-commits mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-commits