From 4ccec05da0533ed0af7790cd349fc9e47c5b0380 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 19 Jul 2022 07:30:21 +0300 Subject: [PATCH 59/59] Give loot regardless of exact way of killing the leader Loot was being given only in the case that the leader was the one actually defending in the battle. Reported by ihnatus See osdn #44672 Signed-off-by: Marko Lindqvist --- server/unittools.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/server/unittools.c b/server/unittools.c index 0327b72ae0..4a23edb561 100644 --- a/server/unittools.c +++ b/server/unittools.c @@ -1953,6 +1953,12 @@ static void wipe_unit_full(struct unit *punit, bool transported, struct unit *ptrans = unit_transport_get(punit); struct city *pexclcity; + if (killer != NULL + && (game.info.gameloss_style & GAMELOSS_STYLE_LOOT) + && unit_has_type_flag(punit, UTYF_GAMELOSS)) { + player_loot_player(killer, pplayer); + } + /* The unit is doomed. */ punit->server.dying = TRUE; @@ -2266,11 +2272,6 @@ void kill_unit(struct unit *pkiller, struct unit *punit, bool vet) /* The unit is doomed. */ punit->server.dying = TRUE; - if ((game.info.gameloss_style & GAMELOSS_STYLE_LOOT) - && unit_has_type_flag(punit, UTYF_GAMELOSS)) { - player_loot_player(pvictor, pvictim); - } - /* barbarian leader ransom hack */ if (is_barbarian(pvictim) && uclass_has_flag(unit_class_get(pkiller), UCF_COLLECT_RANSOM)) { -- 2.35.1