From 0506963c45e2b07449952b0108698f616a60f965 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 9 Apr 2022 10:01:13 +0300 Subject: [PATCH 42/42] unit_do_disband_trad(): Check if unit died only if it was a possibility See osdn #43432 Signed-off-by: Marko Lindqvist --- ai/default/daicity.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ai/default/daicity.c b/ai/default/daicity.c index e7f947d009..26a82e2237 100644 --- a/ai/default/daicity.c +++ b/ai/default/daicity.c @@ -472,12 +472,12 @@ static void unit_do_disband_trad(struct player *owner, struct unit *punit, /* No shields wasted. The unit did Help Wonder. */ return; } - } - } - if (!unit_is_alive(punit_id_stored)) { - /* The unit is gone. Maybe it was killed in Lua? */ - return; + if (!unit_is_alive(punit_id_stored)) { + /* The unit is gone. Maybe it was killed in Lua? */ + return; + } + } } /* Disbanding a unit inside a city gives it 50% of the shields used to @@ -496,12 +496,12 @@ static void unit_do_disband_trad(struct player *owner, struct unit *punit, /* The unit did Disband Unit Recover. 50% of the shields wasted. */ return; } - } - } - if (!unit_is_alive(punit_id_stored)) { - /* The unit is gone. Maybe it was killed in Lua? */ - return; + if (!unit_is_alive(punit_id_stored)) { + /* The unit is gone. Maybe it was killed in Lua? */ + return; + } + } } /* Try to disband even if all shields will be wasted. */ -- 2.35.1