From 5f2638c8dd04b2b2678fed7de0dcb62f146d1d4b Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Tue, 11 May 2021 21:25:58 +0200 Subject: [PATCH 15/15] Inline kills_citizen_after_attack(). See osdn #42245 --- common/unit.c | 10 ---------- common/unit.h | 2 -- server/unithand.c | 3 ++- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/common/unit.c b/common/unit.c index 2d01f5f2e7..5c745a08d5 100644 --- a/common/unit.c +++ b/common/unit.c @@ -407,16 +407,6 @@ bool is_hiding_unit(const struct unit *punit) return FALSE; } -/**********************************************************************//** - Return TRUE iff an attack from this unit would kill a citizen in a city - (city walls protect against this). -**************************************************************************/ -bool kills_citizen_after_attack(const struct unit *punit) -{ - return game.info.killcitizen - && uclass_has_flag(unit_class_get(punit), UCF_KILLCITIZEN); -} - /**********************************************************************//** Return TRUE iff this unit can add to a current city or build a new city at its current location. diff --git a/common/unit.h b/common/unit.h index 05c314a01b..7b977dbfeb 100644 --- a/common/unit.h +++ b/common/unit.h @@ -365,8 +365,6 @@ bool is_field_unit(const struct unit *punit); /* ships+aero */ bool is_hiding_unit(const struct unit *punit); bool unit_can_add_or_build_city(const struct unit *punit); -bool kills_citizen_after_attack(const struct unit *punit); - struct astring; /* Forward declaration. */ void unit_activity_astr(const struct unit *punit, struct astring *astr); void unit_upkeep_astr(const struct unit *punit, struct astring *astr); diff --git a/server/unithand.c b/server/unithand.c index ed806fa615..5904087ec4 100644 --- a/server/unithand.c +++ b/server/unithand.c @@ -4183,7 +4183,8 @@ static void unit_attack_civilian_casualties(const struct unit *punit, city_owner(pcity), NULL, pcity, NULL, city_tile(pcity), NULL, NULL, NULL, NULL, paction, EFT_UNIT_NO_LOSE_POP) <= 0 - && kills_citizen_after_attack(punit)) { + && (game.info.killcitizen + && uclass_has_flag(unit_class_get(punit), UCF_KILLCITIZEN))) { struct player *cplayer = city_owner(pcity); struct tile *ctile = city_tile(pcity); const char *clink = city_link(pcity); -- 2.30.2