62#define WAR(plr1, plr2) \
63 (player_diplstate_get(plr1, plr2)->type == DS_WAR)
64#define NEVER_MET(plr1, plr2) \
65 (player_diplstate_get(plr1, plr2)->type == DS_NO_CONTACT)
66#define DEFENSE_POWER(ptype) \
67 (ptype->defense_strength * ptype->hp * ptype->firepower)
68#define ATTACK_POWER(ptype) \
69 (ptype->attack_strength * ptype->hp * ptype->firepower)
70#define IS_ATTACKER(ptype) \
71 (ptype->attack_strength > ptype->transport_capacity)
72#define POTENTIALLY_HOSTILE_PLAYER(ait, pplayer, aplayer) \
73 (WAR(pplayer, aplayer) || NEVER_MET(pplayer, aplayer) \
74 || dai_diplomacy_get(ait, pplayer, aplayer)->countdown >= 0)
75#define UNITTYPE_COSTS(ut) \
76 (ut->pop_cost * 3 + ut->happy_cost \
77 + ut->upkeep[O_SHIELD] + ut->upkeep[O_FOOD] + ut->upkeep[O_GOLD])
80#define INVASION_OCCUPY 0
81#define INVASION_ATTACK 1
85#define RAMPAGE_ANYTHING 1
86#define RAMPAGE_HUT_OR_BETTER 99998
87#define RAMPAGE_FREE_CITY_OR_BETTER 99999
88#define BODYGUARD_RAMPAGE_THRESHOLD (SHIELD_WEIGHTING * 4)
107 struct tile *dest_tile,
123 struct tile *ptile,
bool fortified,
129 const struct city *pcity);
145#define simple_ai_unit_type_iterate(_ut) \
147 struct unit_type *_ut; \
148 int _ut##_index = 0; \
149 while (NULL != (_ut = simple_ai_types[_ut##_index++])) {
151#define simple_ai_unit_type_iterate_end \
166 const struct unit *defender);
void dai_unit_save(struct ai_type *ait, const char *aitstr, struct section_file *file, const struct unit *punit, const char *unitstr)
void dai_manage_military(struct ai_type *ait, struct player *pplayer, struct unit *punit)
int unittype_def_rating_squared(const struct unit_type *att_type, const struct unit_type *def_type, struct player *def_player, struct tile *ptile, bool fortified, int veteran)
void dai_units_ruleset_init(struct ai_type *ait)
adv_want kill_desire(adv_want benefit, int attack, int loss, int vuln, int attack_count)
const struct impr_type * utype_needs_improvement(const struct unit_type *putype, const struct city *pcity)
void dai_switch_to_explore(struct ai_type *ait, struct unit *punit, struct tile *target, enum override_bool *allow)
struct unit_type * simple_ai_types[U_LAST]
int build_cost_balanced(const struct unit_type *punittype)
bool dai_unit_can_strike_my_unit(const struct unit *attacker, const struct unit *defender)
bool is_on_unit_upgrade_path(const struct unit_type *test, const struct unit_type *base)
void dai_manage_units(struct ai_type *ait, struct player *pplayer)
adv_want look_for_charge(struct ai_type *ait, struct player *pplayer, struct unit *punit, struct unit **aunit, struct city **acity)
adv_want find_something_to_kill(struct ai_type *ait, struct player *pplayer, struct unit *punit, struct tile **pdest_tile, struct pf_path **ppath, struct pf_map **pferrymap, struct unit **pferryboat, const struct unit_type **pboattype, int *pmove_time)
void dai_manage_unit(struct ai_type *ait, struct player *pplayer, struct unit *punit)
void dai_unit_turn_end(struct ai_type *ait, struct unit *punit)
bool dai_can_unit_type_follow_unit_type(const struct unit_type *follower, const struct unit_type *followee, struct ai_type *ait)
struct city * find_nearest_safe_city(struct unit *punit)
void dai_unit_init(struct ai_type *ait, struct unit *punit)
void dai_consider_tile_dangerous(struct ai_type *ait, struct tile *ptile, struct unit *punit, enum override_bool *result)
bool uclass_need_trans_between(struct unit_class *pclass, struct tile *ctile, struct tile *ptile)
void dai_unit_load(struct ai_type *ait, const char *aitstr, const struct section_file *file, struct unit *punit, const char *unitstr)
void dai_unit_close(struct ai_type *ait, struct unit *punit)
void dai_units_ruleset_close(struct ai_type *ait)
struct unit_type * dai_role_utype_for_terrain_class(struct city *pcity, int role, enum terrain_class tc)
bool find_beachhead(const struct player *pplayer, struct pf_map *ferry_map, struct tile *dest_tile, const struct unit_type *cargo_type, struct tile **ferry_dest, struct tile **beachhead_tile)
bool dai_military_rampage(struct unit *punit, int thresh_adj, int thresh_move)
static void attack(QVariant data1, QVariant data2)
static void base(QVariant data1, QVariant data2)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
struct tile * prev_struct
struct unit_type_list * potential_charges