From dae3f4b08d72681c94550f15f73fb2d7f40a8bdd Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 16 Apr 2024 00:15:14 +0300 Subject: [PATCH 17/17] Trigger action system when client requests activity change Lacking action handling for some activities reported by bard See osdn #57670 Signed-off-by: Marko Lindqvist --- server/unithand.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/server/unithand.c b/server/unithand.c index 68934ee624..29899b287a 100644 --- a/server/unithand.c +++ b/server/unithand.c @@ -6248,8 +6248,18 @@ bool unit_activity_handling_targeted(struct unit *punit, unit_activity_handling(punit, new_activity); } else if (can_unit_do_activity_targeted(&(wld.map), punit, new_activity, *new_target)) { + struct action_list *list = action_list_by_activity(new_activity); + free_unit_orders(punit); - unit_activity_targeted_internal(punit, new_activity, new_target); + + if (list != NULL && action_list_size(list) > 0) { + /* Trigger action system */ + unit_do_action(unit_owner(punit), punit->id, punit->tile->index, + (*new_target)->id, "", + action_number(action_list_get(list, 0))); + } else { + unit_activity_targeted_internal(punit, new_activity, new_target); + } } return TRUE; @@ -6282,7 +6292,7 @@ static bool unit_activity_targeted_internal(struct unit *punit, unit_activity_handling(punit, new_activity); } else { set_unit_activity_targeted(punit, new_activity, *new_target); - send_unit_info(NULL, punit); + send_unit_info(NULL, punit); unit_activity_dependencies(punit, old_activity, old_target); if (new_activity == ACTIVITY_PILLAGE) { -- 2.43.0