From 557b8997a0bec76bf98fd40c26223b2071b8965f Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 13 Nov 2021 14:14:35 +0200 Subject: [PATCH 29/29] Use iterate_unit_list_safe() when going through units that may escape Unit may escape from the original tile & list in the middle of the iteration, so nonsafe iteration macro should not be used. Most likely consequence from the old use of nonsafe macro was that once one unit had escaped, further units were not considered for escaping. See osdn #43206 Signed-off-by: Marko Lindqvist --- server/unittools.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/unittools.c b/server/unittools.c index e37bb1b9c4..a4432c20c7 100644 --- a/server/unittools.c +++ b/server/unittools.c @@ -2314,7 +2314,7 @@ void kill_unit(struct unit *pkiller, struct unit *punit, bool vet) } /* count killed units */ - unit_list_iterate(deftile->units, vunit) { + unit_list_iterate_safe(deftile->units, vunit) { struct player *vplayer = unit_owner(vunit); if (pplayers_at_war(pvictor, vplayer) @@ -2373,7 +2373,7 @@ void kill_unit(struct unit *pkiller, struct unit *punit, bool vet) } } } - } unit_list_iterate_end; + } unit_list_iterate_safe_end; /* Inform the destroyer again if more than one unit was killed */ if (unitcount > 1 && !collect_ransom) { -- 2.33.0