From 4877e6701c87831f4a1586f3f9259d54a4161d30 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 7 Aug 2022 00:30:40 +0300 Subject: [PATCH 51/51] AI: Make look_for_charge() return type adv_want See osdn #45278 Signed-off-by: Marko Lindqvist --- ai/default/aiunit.c | 6 +++--- ai/default/aiunit.h | 6 +++--- ai/default/daimilitary.c | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ai/default/aiunit.c b/ai/default/aiunit.c index 2a481450b1..5389f59bf6 100644 --- a/ai/default/aiunit.c +++ b/ai/default/aiunit.c @@ -703,9 +703,9 @@ static bool unit_role_defender(const struct unit_type *punittype) do we attempt to bodyguard units with higher defence than us, or military units with lower attack than us that are not transports. **************************************************************************/ -int look_for_charge(struct ai_type *ait, struct player *pplayer, - struct unit *punit, - struct unit **aunit, struct city **acity) +adv_want look_for_charge(struct ai_type *ait, struct player *pplayer, + struct unit *punit, + struct unit **aunit, struct city **acity) { struct pf_parameter parameter; struct pf_map *pfm; diff --git a/ai/default/aiunit.h b/ai/default/aiunit.h index ef79014957..bd04000fe5 100644 --- a/ai/default/aiunit.h +++ b/ai/default/aiunit.h @@ -95,9 +95,9 @@ void dai_manage_military(struct ai_type *ait, struct player *pplayer, struct city *find_nearest_safe_city(struct unit *punit); bool uclass_need_trans_between(struct unit_class *pclass, struct tile *ctile, struct tile *ptile); -int look_for_charge(struct ai_type *ait, struct player *pplayer, - struct unit *punit, - struct unit **aunit, struct city **acity); +adv_want look_for_charge(struct ai_type *ait, struct player *pplayer, + struct unit *punit, + struct unit **aunit, struct city **acity); bool dai_can_unit_type_follow_unit_type(const struct unit_type *follower, const struct unit_type *followee, struct ai_type *ait); diff --git a/ai/default/daimilitary.c b/ai/default/daimilitary.c index 5779308426..9f5402e3d3 100644 --- a/ai/default/daimilitary.c +++ b/ai/default/daimilitary.c @@ -1458,7 +1458,7 @@ static void dai_unit_consider_bodyguard(struct ai_type *ait, city_production_unit_veteran_level(pcity, punittype)); if (choice->want < 100) { - const int want = look_for_charge(ait, pplayer, virtualunit, &aunit, &acity); + const adv_want want = look_for_charge(ait, pplayer, virtualunit, &aunit, &acity); if (want > choice->want) { choice->want = want; @@ -1467,6 +1467,7 @@ static void dai_unit_consider_bodyguard(struct ai_type *ait, adv_choice_set_use(choice, "bodyguard"); } } + unit_virtual_destroy(virtualunit); } -- 2.35.1