From 22e2176f5cd5a86b661e30afcc7dedd2d0ac765f Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 16 Apr 2024 00:15:14 +0300 Subject: [PATCH 40/40] 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 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/server/unithand.c b/server/unithand.c index 18b12ba4b4..a6d4be8c39 100644 --- a/server/unithand.c +++ b/server/unithand.c @@ -6540,8 +6540,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) != NULL ? (*new_target)->id : NO_TARGET, + "", action_number(action_list_get(list, 0))); + } else { + unit_activity_targeted_internal(punit, new_activity, new_target); + } } return TRUE; -- 2.43.0