From 0dde1fbaa124cb928725d5e52885ca1e5a226795 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 2 May 2021 06:34:58 +0300 Subject: [PATCH 48/48] aitech.c: Move couple of assignments outside 'if' See osdn #42137 Signed-off-by: Marko Lindqvist --- ai/default/aitech.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ai/default/aitech.c b/ai/default/aitech.c index e3faa7e7e1..f1cebe38c8 100644 --- a/ai/default/aitech.c +++ b/ai/default/aitech.c @@ -422,7 +422,9 @@ struct unit_type *dai_wants_defender_against(struct ai_type *ait, cost = research_goal_bulbs_required(presearch, advance_number(itech)); } - if (((building = utype_needs_improvement(deftype, pcity))) + + building = utype_needs_improvement(deftype, pcity); + if (building != NULL && !can_player_build_improvement_direct(pplayer, building)) { requirement_vector_iterate(&building->reqs, preq) { if (!is_req_active(pplayer, NULL, pcity, building, city_tile(pcity), @@ -513,7 +515,9 @@ struct unit_type *dai_wants_role_unit(struct ai_type *ait, struct player *pplaye cost = research_goal_bulbs_required(presearch, advance_number(itech)); } - if (((building = utype_needs_improvement(iunit, pcity))) + + building = utype_needs_improvement(iunit, pcity); + if (building != NULL && !can_player_build_improvement_direct(pplayer, building)) { requirement_vector_iterate(&building->reqs, preq) { if (VUT_ADVANCE == preq->source.kind && preq->present) { -- 2.30.2