From 097dd465a8e38573be314e62402d14f6661af38f Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 7 May 2022 00:35:36 +0300 Subject: [PATCH 33/33] Handle finishing terrain transform activities like other activities Former handling of activities transforming the terrain caused trouble with how activities of the units in the same tile were turned illegal. Reported by alain_bkr See osdn #44519 Signed-off-by: Marko Lindqvist --- server/unittools.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/server/unittools.c b/server/unittools.c index 34dcc8d992..889c549745 100644 --- a/server/unittools.c +++ b/server/unittools.c @@ -995,19 +995,14 @@ static void update_unit_activity(struct unit *punit) if (unit_activity_done) { update_tile_knowledge(ptile); - if (ACTIVITY_IRRIGATE == activity - || ACTIVITY_MINE == activity - || ACTIVITY_CULTIVATE == activity + if (ACTIVITY_CULTIVATE == activity || ACTIVITY_PLANT == activity || ACTIVITY_TRANSFORM == activity) { - /* FIXME: As we might probably do the activity again, because of the - * terrain change cycles, we need to treat these cases separatly. - * Probably ACTIVITY_TRANSFORM should be associated to its terrain - * target, whereas ACTIVITY_IRRIGATE and ACTIVITY_MINE should only - * used for extras. */ unit_list_iterate(ptile->units, punit2) { if (punit2->activity == activity) { - unit_activities_cancel(punit2); + fc_assert(punit->activity_target == NULL); + + set_unit_activity(punit2, ACTIVITY_IDLE); } } unit_list_iterate_end; } else { @@ -1022,10 +1017,10 @@ static void update_unit_activity(struct unit *punit) set_unit_activity(punit2, ACTIVITY_IDLE); } } unit_list_iterate_end; - - unit_activities_cancel_all_illegal_tile(ptile); } + unit_activities_cancel_all_illegal_tile(ptile); + tile_changing_activities_iterate(act) { if (act == activity) { /* Some units nearby may not be able to continue their action, -- 2.35.1