Bug #2457 ยป 0001-ai-default-Do-not-swap-the-first-defender-for-a-vete.patch
| ai/default/daimilitary.c | ||
|---|---|---|
|
struct adv_choice *choice)
|
||
|
{
|
||
|
Impr_type_id id;
|
||
|
bool has_defender = FALSE;
|
||
|
/* Sanity */
|
||
|
if (!is_unit_choice_type(choice->type)
|
||
| ... | ... | |
|
return;
|
||
|
}
|
||
|
/* A veterancy building helps nothing if there is nobody to garrison
|
||
|
* the city; the first defender comes first. */
|
||
|
unit_list_iterate(city_tile(pcity)->units, punit) {
|
||
|
if (unit_owner(punit) == city_owner(pcity)
|
||
|
&& !unit_has_type_flag(punit, UTYF_CIVILIAN)
|
||
|
&& unit_type_get(punit)->defense_strength > 0) {
|
||
|
has_defender = TRUE;
|
||
|
break;
|
||
|
}
|
||
|
} unit_list_iterate_end;
|
||
|
if (!has_defender) {
|
||
|
return;
|
||
|
}
|
||
|
/* N.B.: have to check that we haven't already built the building --mck */
|
||
|
if ((id = dai_find_source_building(pcity, EFT_VETERAN_BUILD,
|
||
|
choice->value.utype)) != B_LAST
|
||