Skip to content

Commit

Permalink
Correct counting of units killed with the stack
Browse files Browse the repository at this point in the history
Unreachable units that were not really killed were included
in the count reported to the player.

Reported by Lexxie

See osdn #44416

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
  • Loading branch information
cazfi committed May 22, 2022
1 parent 133d25c commit a03b620
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/unittools.c
Expand Up @@ -2259,8 +2259,9 @@ void kill_unit(struct unit *pkiller, struct unit *punit, bool vet)

if (unitcount == 0) {
unit_list_iterate(deftile->units, vunit) {
if (pplayers_at_war(pvictor, unit_owner(vunit))) {
unitcount++;
if (pplayers_at_war(pvictor, unit_owner(vunit))
&& is_unit_reachable_at(vunit, pkiller, deftile)) {
unitcount++;
}
} unit_list_iterate_end;
}
Expand Down

0 comments on commit a03b620

Please sign in to comment.