From d7a74027235a282b5bb9f8078d851c9369432677 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Tue, 13 Jul 2021 00:28:32 +0200 Subject: [PATCH] act sel dlg: respect target tile switch. Respect that the action_decision_tile has changed. This justifies refreshing an open action selection dialog and giving a previously ignored unit priority in the unit focus queue again. Reported by Lexxie See osdn #42621 --- client/packhand.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/client/packhand.c b/client/packhand.c index 706f282d80..8271713aee 100644 --- a/client/packhand.c +++ b/client/packhand.c @@ -1848,14 +1848,30 @@ static bool handle_unit_packet_common(struct unit *packet_unit) agents_unit_changed(punit); editgui_notify_object_changed(OBJTYPE_UNIT, punit->id, FALSE); - punit->action_decision_tile = packet_unit->action_decision_tile; - if (punit->action_decision_want != packet_unit->action_decision_want + if ((punit->action_decision_want != packet_unit->action_decision_want + || (punit->action_decision_tile + != packet_unit->action_decision_tile)) && should_ask_server_for_actions(packet_unit)) { /* The unit wants the player to decide. */ - action_decision_request(punit); - check_focus = TRUE; + if (action_selection_actor_unit() != punit->id) { + /* Pop up an action selection dialog if the unit has focus or give + * the unit higher priority in the focus queue if not. */ + punit->action_decision_tile = packet_unit->action_decision_tile; + action_decision_request(punit); + check_focus = TRUE; + } else { + /* Refresh already open action selection dialog. */ + dsend_packet_unit_get_actions(&client.conn, + action_selection_actor_unit(), + action_selection_target_unit(), + tile_index( + packet_unit->action_decision_tile), + action_selection_target_extra(), + REQEST_BACKGROUND_REFRESH); + } } punit->action_decision_want = packet_unit->action_decision_want; + punit->action_decision_tile = packet_unit->action_decision_tile; } else { /*** Create new unit ***/ punit = packet_unit; -- 2.30.2