From 9da72c0d9ef167ba382cf1b535023a8b9a85a907 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 3 May 2022 16:26:34 +0300 Subject: [PATCH 51/51] Don't consider worker finishing work to have illegal activity When worker finished some tile change that would prevent one doing the same change again, legality of its current activity was checked before it had been marked idle. This lead also worker's further orders to get aborted. Reported by alain_bkr See osdn #44504 Signed-off-by: Marko Lindqvist --- server/unittools.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server/unittools.c b/server/unittools.c index ef0a5f0e73..95a27afd21 100644 --- a/server/unittools.c +++ b/server/unittools.c @@ -1018,6 +1018,18 @@ static void update_unit_activity(struct unit *punit) } } unit_list_iterate_end; } else { + struct extra_type *act_tgt = punit->activity_target; + + unit_list_iterate(ptile->units, punit2) { + if (punit2->activity == activity + && punit2->activity_target == act_tgt) { + /* This unit was helping with the work just finished. + * Mark it idle (already finished) so its "current" + * activity is not considered illegal below. */ + set_unit_activity(punit2, ACTIVITY_IDLE); + } + } unit_list_iterate_end; + unit_activities_cancel_all_illegal_tile(ptile); } -- 2.35.1