From 6ff9a0c5107f43f406c61846cc18aa02d005afcf Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 27 Nov 2022 23:52:55 +0200 Subject: [PATCH 35/35] sdl2: Fix Tile menu "Paradrop Here" See osdn #45981 Signed-off-by: Marko Lindqvist --- client/gui-sdl2/dialogs.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/client/gui-sdl2/dialogs.c b/client/gui-sdl2/dialogs.c index 1947d08c7c..7bb2c8defe 100644 --- a/client/gui-sdl2/dialogs.c +++ b/client/gui-sdl2/dialogs.c @@ -1629,18 +1629,28 @@ static int patrol_here_callback(struct widget *pwidget) static int paradrop_here_callback(struct widget *pwidget) { if (PRESSED_EVENT(main_data.event)) { -/* FIXME */ -#if 0 int x = pwidget->data.cont->id0; int y = pwidget->data.cont->id1; -#endif /* 0 */ + struct tile *ptile; - popdown_advanced_terrain_dialog(); + ptile = map_pos_to_tile(&(wld.map), x, y); -#if 0 - /* may not work */ - do_unit_paradrop_to(get_unit_in_focus(), map_pos_to_tile(x, y)); -#endif /* 0 */ + if (ptile != NULL) { + struct unit_list *punits = get_units_in_focus(); + + set_hover_state(punits, HOVER_PARADROP, ACTIVITY_LAST, NULL, + NO_TARGET, NO_TARGET, ACTION_NONE, ORDER_LAST); + update_unit_info_label(punits); + + unit_list_iterate(punits, punit) { + do_unit_paradrop_to(punit, ptile); + } unit_list_iterate_end; + + clear_hover_state(); + exit_goto_state(); + } + + popdown_advanced_terrain_dialog(); } return -1; -- 2.35.1