From 7ada3fb1cb2d2eab6e19733fff30ba7f031d50e7 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Tue, 11 May 2021 11:46:06 +0200 Subject: [PATCH 4/5] unit_versus_unit(): take action parameter. Make unit_versus_unit() aware of what action is being performed. See osdn #42224 --- server/unithand.c | 2 +- server/unittools.c | 3 ++- server/unittools.h | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/server/unithand.c b/server/unithand.c index 6b069677ac..fb7ee21763 100644 --- a/server/unithand.c +++ b/server/unithand.c @@ -4524,7 +4524,7 @@ static bool do_attack(struct unit *punit, struct tile *def_tile, /* Record tired attack string before attack */ sz_strlcpy(attacker_tired, unit_tired_attack_string(punit)); - unit_versus_unit(punit, pdefender, &att_hp, &def_hp); + unit_versus_unit(punit, pdefender, &att_hp, &def_hp, paction); if ((att_hp <= 0 || utype_is_consumed_by_action(paction, punit->utype)) && unit_transported(punit)) { diff --git a/server/unittools.c b/server/unittools.c index a1eaf4b776..fb03943ecf 100644 --- a/server/unittools.c +++ b/server/unittools.c @@ -274,7 +274,8 @@ static bool maybe_become_veteran_real(struct unit *punit, bool settler) is wiped, and the winner gets a chance of gaining veteran status **************************************************************************/ void unit_versus_unit(struct unit *attacker, struct unit *defender, - int *att_hp, int *def_hp) + int *att_hp, int *def_hp, + const struct action *paction) { int attackpower = get_total_attack_power(attacker, defender); int defensepower = get_total_defense_power(attacker, defender); diff --git a/server/unittools.h b/server/unittools.h index 2d6d37e688..8aedfc02c2 100644 --- a/server/unittools.h +++ b/server/unittools.h @@ -77,7 +77,8 @@ struct unit_type *find_a_unit_type(enum unit_role_id role, bool maybe_make_veteran(struct unit *punit); void notify_unit_experience(struct unit *punit); void unit_versus_unit(struct unit *attacker, struct unit *defender, - int *att_hp, int *def_hp); + int *att_hp, int *def_hp, + const struct action *paction); void unit_bombs_unit(struct unit *attacker, struct unit *defender, int *att_hp, int *def_hp, const struct action *paction); -- 2.30.2