From 930dfb601bdc215c672226f80bc78bec627cefe0 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Fri, 5 Mar 2021 15:18:20 +0100 Subject: [PATCH] client: prepare for multiple paradrop actions. Prepare the code in do_unit_paradrop_to() that orders the paradrop action performed for multiple paradrop actions. See osdn #41717 --- client/control.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/client/control.c b/client/control.c index 3ce5be30a4..696528a2b2 100644 --- a/client/control.c +++ b/client/control.c @@ -2980,7 +2980,22 @@ void do_unit_goto(struct tile *ptile) **************************************************************************/ void do_unit_paradrop_to(struct unit *punit, struct tile *ptile) { - request_do_action(ACTION_PARADROP, punit->id, tile_index(ptile), 0 , ""); + action_iterate(act_id) { + struct action *paction = action_by_number(act_id); + + if (!action_has_result(paction, ACTRES_PARADROP)) { + /* Not relevant. */ + continue; + } + + if (action_prob_possible( + action_prob_unit_vs_tgt(paction, punit, + tile_city(ptile), NULL, + ptile, NULL))) { + request_do_action(paction->id, punit->id, tile_index(ptile), 0 , ""); + return; + } + } action_iterate_end; } /**********************************************************************//** -- 2.20.1