Feature #677 » 0036-Unhardcode-wld.map-from-unit_being_aggressive.patch
ai/default/daicity.c | ||
---|---|---|
unit_list_iterate_safe(pcity->units_supported, punit) {
|
||
if (city_unhappy(pcity)
|
||
&& (utype_happy_cost(unit_type_get(punit), pplayer) > 0
|
||
&& (unit_being_aggressive(punit) || is_field_unit(punit)))
|
||
&& (unit_being_aggressive(nmap, punit) || is_field_unit(punit)))
|
||
&& def_ai_unit_data(punit, ait)->passenger == 0) {
|
||
UNIT_LOG(LOG_EMERGENCY, punit, "is causing unrest, disbanded");
|
||
/* TODO: if Help Wonder stops blocking Disband Unit there may be
|
||
/* TODO: If Help Wonder stops blocking Disband Unit there may be
|
||
* cases where Disband Unit should be selected. Example: Field unit
|
||
* in allied city that is building a wonder that makes the ally win
|
||
* without sharing the victory. */
|
common/city.c | ||
---|---|---|
const struct unit_type *ut;
|
||
struct player *plr;
|
||
int happy_cost;
|
||
const struct civ_map *nmap = &(wld.map);
|
||
if (!punit || !free_unhappy) {
|
||
if (punit == NULL || free_unhappy == NULL) {
|
||
return 0;
|
||
}
|
||
... | ... | |
fc_assert_ret_val(0 <= *free_unhappy, 0);
|
||
if (!unit_being_aggressive(punit) && !is_field_unit(punit)) {
|
||
if (!unit_being_aggressive(nmap, punit) && !is_field_unit(punit)) {
|
||
return 0;
|
||
}
|
||
common/unit.c | ||
---|---|---|
- inside a city
|
||
- ground unit inside a fortress within 3 squares of a friendly city
|
||
**************************************************************************/
|
||
bool unit_being_aggressive(const struct unit *punit)
|
||
bool unit_being_aggressive(const struct civ_map *nmap,
|
||
const struct unit *punit)
|
||
{
|
||
const struct civ_map *nmap = &(wld.map);
|
||
if (!is_attack_unit(punit)) {
|
||
return FALSE;
|
||
}
|
common/unit.h | ||
---|---|---|
? is_plr_zoc_srv(unit_owner, ptile, zmap) : is_plr_zoc_client(unit_owner, ptile, zmap);
|
||
}
|
||
bool unit_being_aggressive(const struct unit *punit);
|
||
bool unit_being_aggressive(const struct civ_map *nmap,
|
||
const struct unit *punit);
|
||
bool unit_type_really_ignores_zoc(const struct unit_type *punittype);
|
||
bool is_build_activity(enum unit_activity activity);
|
- « Previous
- 1
- 2
- Next »