74#define CITY_CONQUEST_WORTH(_city_, _data_) \
75 (_data_->worth * 0.9 + (city_size_get(_city_) - 0.5) * 10)
91 struct unit *attacker)
103 struct unit *defender;
282 int defense = 0, walls = 0;
284 const bool igwall =
FALSE;
300 if (defense > 1<<12) {
303 if (defense > 1<<15) {
308 return defense * defense;
540 const struct unit *ferry;
669 unsigned int urgency,
unsigned int danger,
672 if (*value == 0 || danger <= 0) {
676 *value =
MAX(*value, 100 + urgency);
678 if (urgency > 0 && danger > defense * 2) {
680 }
else if (defense != 0 && danger > defense) {
681 *value =
MAX(danger * 100 / defense, *value);
823 struct unit_list *units;
861 if (!
utai->carries_occupiers
993 int defense =
punittype->defense_strength;
1030 int defense =
punittype->defense_strength;
1062 struct city *
pcity,
unsigned int danger,
1213 choice->
want = danger;
1245 int veteran,
struct tile *ptile,
1351 struct tile *dest_tile;
1359 if (
atile == dest_tile) {
1363 }
else if (
atile == ptile) {
1388 ptile,
FALSE, veteran);
1471 ",move_time=%d,vuln=%d,bcost=%d]",
1535 struct unit *ferryboat;
1684 log_debug(
"kill_something_with() %s has chosen attacker ferry, "
1733 if (want > choice->
want) {
1734 choice->
want = want;
1790 unsigned int our_def, urgency;
1814 if (
pcity->specialists[
sp] > 0
1850 danger = 200 + urgency;
1867 if (
our_def == 0 && danger > 0) {
1935 &&
uchoice.value.utype->defense_strength == 1) {
2048 if (choice->
want <= 0) {
struct action_enabler_list * action_enablers_for_action(action_id action)
#define action_by_result_iterate(_paction_, _result_)
#define action_enabler_list_iterate_end
#define action_by_result_iterate_end
#define action_enabler_list_iterate(action_enabler_list, aenabler)
void adv_deinit_choice(struct adv_choice *choice)
void adv_init_choice(struct adv_choice *choice)
void adv_free_choice(struct adv_choice *choice)
struct adv_choice * adv_new_choice(void)
bool is_unit_choice_type(enum choice_type type)
const char * adv_choice_rule_name(const struct adv_choice *choice)
#define adv_choice_set_use(_choice, _use)
static void adv_choice_copy(struct adv_choice *dest, struct adv_choice *src)
struct adv_data * adv_data_get(struct player *pplayer, bool *caller_closes)
bool adv_is_player_dangerous(struct player *pplayer, struct player *aplayer)
int adv_unittype_att_rating(const struct unit_type *punittype, int veteran, int moves_left, int hp)
int adv_unit_att_rating(const struct unit *punit)
void dai_choose_diplomat_defensive(struct ai_type *ait, struct player *pplayer, struct city *pcity, struct adv_choice *choice, int def)
void dai_choose_diplomat_offensive(struct ai_type *ait, struct player *pplayer, struct city *pcity, struct adv_choice *choice)
bool dai_is_ferry_type(const struct unit_type *pferry, struct ai_type *ait)
int ai_trait_get_value(enum trait tr, struct player *pplayer)
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
const char * city_name_get(const struct city *pcity)
int city_production_unit_veteran_level(struct city *pcity, const struct unit_type *punittype)
bool can_city_build_improvement_now(const struct city *pcity, const struct impr_type *pimprove)
bool city_got_defense_effect(const struct city *pcity, const struct unit_type *attacker)
bool can_city_build_unit_direct(const struct civ_map *nmap, const struct city *pcity, const struct unit_type *punittype)
bool can_city_build_unit_now(const struct civ_map *nmap, const struct city *pcity, const struct unit_type *punittype)
bool can_city_build_unit_later(const struct civ_map *nmap, const struct city *pcity, const struct unit_type *punittype)
int city_total_unit_gold_upkeep(const struct city *pcity)
#define city_list_iterate(citylist, pcity)
#define city_tile(_pcity_)
#define city_owner(_pcity_)
#define city_list_iterate_end
bool is_stack_vulnerable(const struct tile *ptile)
int get_fortified_defense_power(const struct unit *attacker, struct unit *defender)
int get_total_defense_power(const struct unit *attacker, const struct unit *defender)
int get_total_attack_power(const struct unit *attacker, const struct unit *defender, const struct action *paction)
struct unit * get_defender(const struct civ_map *nmap, const struct unit *attacker, const struct tile *ptile, const struct action *paction)
bool can_unit_attack_tile(const struct unit *punit, const struct action *paction, const struct tile *dest_tile)
void get_modified_firepower(const struct civ_map *nmap, const struct unit *attacker, const struct unit *defender, int *att_fp, int *def_fp)
bool dai_choose_attacker_air(struct ai_type *ait, struct player *pplayer, struct city *pcity, struct adv_choice *choice, bool allow_gold_upkeep)
Impr_type_id dai_find_source_building(struct city *pcity, enum effect_type effect_type, const struct unit_type *utype)
struct ai_plr * dai_plr_data_get(struct ai_type *ait, struct player *pplayer, bool *caller_closes)
adv_want dai_content_effect_value(const struct player *pplayer, const struct city *pcity, int amount, int num_cities, int happiness_step)
void dai_hunter_choice(struct ai_type *ait, struct player *pplayer, struct city *pcity, struct adv_choice *choice, bool allow_gold_upkeep)
#define TECH_LOG(ait, loglevel, pplayer, padvance, msg,...)
struct unit_type * dai_choose_defender_versus(struct city *pcity, struct unit *attacker)
static enum fc_tristate tactical_req_cb(const struct req_context *context, const struct req_context *other_context, const struct requirement *req, void *data, int n_data)
int assess_defense(struct ai_type *ait, struct city *pcity)
static adv_want dai_unit_attack_desirability(struct ai_type *ait, const struct unit_type *punittype)
struct adv_choice * military_advisor_choose_build(struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer, struct city *pcity, player_unit_list_getter ul_cb)
static unsigned int assess_danger(struct ai_type *ait, const struct civ_map *nmap, struct city *pcity, player_unit_list_getter ul_cb)
static bool action_may_happen_unit_on_city(const action_id wanted_action, const struct unit *actor, const struct city *pcity, int turns)
static void dai_reevaluate_building(struct city *pcity, adv_want *value, unsigned int urgency, unsigned int danger, int defense)
static void process_attacker_want(struct ai_type *ait, struct city *pcity, adv_want value, const struct unit_type *victim_unit_type, struct player *victim_player, int veteran, struct tile *ptile, struct adv_choice *best_choice, struct pf_map *ferry_map, struct unit *boat, const struct unit_type *boattype)
static void dai_unit_consider_bodyguard(struct ai_type *ait, struct city *pcity, struct unit_type *punittype, struct adv_choice *choice)
static struct adv_choice * kill_something_with(struct ai_type *ait, struct player *pplayer, struct city *pcity, struct unit *myunit, struct adv_choice *choice)
bool dai_process_defender_want(struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer, struct city *pcity, unsigned int danger, struct adv_choice *choice, adv_want extra_want)
static void adjust_ai_unit_choice(struct city *pcity, struct adv_choice *choice)
static adv_want dai_unit_defense_desirability(struct ai_type *ait, const struct unit_type *punittype)
#define CITY_CONQUEST_WORTH(_city_, _data_)
int assess_defense_quadratic(struct ai_type *ait, struct city *pcity)
static struct unit_type * dai_choose_bodyguard(struct ai_type *ait, const struct civ_map *nmap, struct city *pcity, enum terrain_class tc, enum unit_role_id role, bool allow_gold_upkeep)
static int base_assess_defense_unit(struct city *pcity, struct unit *punit, bool igwall, bool quadratic, int wall_value)
static unsigned int assess_danger_unit(const struct civ_map *nmap, const struct city *pcity, struct pf_reverse_map *pcity_map, const struct unit *punit, int *move_time)
static int assess_defense_backend(struct ai_type *ait, struct city *pcity, bool igwall)
static struct unit_type * dai_choose_attacker(struct ai_type *ait, struct city *pcity, enum terrain_class tc, bool allow_gold_upkeep)
void dai_assess_danger_player(struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer)
int assess_defense_unit(struct ai_type *ait, struct city *pcity, struct unit *punit, bool igwall)
static int assess_defense_igwall(struct ai_type *ait, struct city *pcity)
struct unit_list *() player_unit_list_getter(struct player *pplayer)
#define FINISH_HIM_CITY_COUNT
void dai_choose_paratrooper(struct ai_type *ait, struct player *pplayer, struct city *pcity, struct adv_choice *choice, bool allow_gold_upkeep)
static struct ai_plr * def_ai_player_data(const struct player *pplayer, struct ai_type *deftype)
static struct ai_city * def_ai_city_data(const struct city *pcity, struct ai_type *deftype)
struct unit_type * dai_wants_defender_against(struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer, struct city *pcity, const struct unit_type *att, int want)
adv_want kill_desire(adv_want benefit, int attack, int loss, int vuln, int victim_count)
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)
bool find_beachhead(const struct player *pplayer, struct pf_map *ferry_map, struct tile *dest_tile, const struct unit_type *cargo_type, const struct unit_type *ferry_type, struct tile **ferry_dest, struct tile **beachhead_tile)
const struct impr_type * utype_needs_improvement(const struct unit_type *putype, const struct city *pcity)
int build_cost_balanced(const struct unit_type *punittype)
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)
bool dai_can_unit_type_follow_unit_type(const struct unit_type *follower, const struct unit_type *followee, struct ai_type *ait)
#define POTENTIALLY_HOSTILE_PLAYER(ait, pplayer, aplayer)
#define simple_ai_unit_type_iterate_end
#define simple_ai_unit_type_iterate(_ut)
static void attack(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 * actor
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 unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
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 int cost
bool ai_fuzzy(const struct player *pplayer, bool normal_decision)
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
int get_target_bonus_effects(struct effect_list *plist, const struct req_context *context, const struct req_context *other_context, enum effect_type effect_type)
int get_unittype_bonus(const struct player *pplayer, const struct tile *ptile, const struct unit_type *punittype, const struct action *paction, enum effect_type effect_type)
bool has_handicap(const struct player *pplayer, enum handicap_type htype)
@ H_ASSESS_DANGER_LIMITED
struct impr_type * improvement_by_number(const Impr_type_id id)
const char * improvement_rule_name(const struct impr_type *pimprove)
int impr_buy_gold_cost(const struct city *pcity, const struct impr_type *pimprove, int shields_in_stock)
bool is_great_wonder(const struct impr_type *pimprove)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define log_debug(message,...)
#define log_error(message,...)
int real_map_distance(const struct tile *tile0, const struct tile *tile1)
bool is_native_tile(const struct unit_type *punittype, const struct tile *ptile)
bool can_attack_from_non_native(const struct unit_type *utype)
bool is_native_near_tile(const struct civ_map *nmap, const struct unit_class *uclass, const struct tile *ptile)
bool can_attack_non_native(const struct unit_type *utype)
struct city_list * cities
bool pf_reverse_map_unit_position(struct pf_reverse_map *pfrm, const struct unit *punit, struct pf_position *pos)
const struct pf_parameter * pf_map_parameter(const struct pf_map *pfm)
struct pf_map * pf_map_new(const struct pf_parameter *parameter)
bool pf_map_position(struct pf_map *pfm, struct tile *ptile, struct pf_position *pos)
void pf_map_iter_position(struct pf_map *pfm, struct pf_position *pos)
struct pf_reverse_map * pf_reverse_map_new_for_city(const struct civ_map *nmap, const struct city *pcity, const struct player *attacker, int max_turns, bool omniscient)
void pf_reverse_map_destroy(struct pf_reverse_map *pfrm)
void pf_map_destroy(struct pf_map *pfm)
#define pf_map_tiles_iterate(ARG_pfm, NAME_tile, COND_from_start)
#define pf_map_tiles_iterate_end
#define players_iterate_end
#define players_iterate(_pplayer)
static bool player_is_cpuhog(const struct player *pplayer)
enum fc_tristate tri_req_active(const struct req_context *context, const struct req_context *other_context, const struct requirement *req)
enum fc_tristate tri_reqs_cb_active(const struct req_context *context, const struct req_context *other_context, const struct requirement_vector *reqs, struct requirement_vector *maybe_reqs, req_tester_cb tester, void *data, int n_data)
enum req_unchanging_status is_req_preventing(const struct req_context *context, const struct req_context *other_context, const struct requirement *req, enum req_problem_type prob_type)
enum fc_tristate tri_req_active_turns(int pass, int period, const struct req_context *context, const struct req_context *other_context, const struct requirement *req)
int research_goal_unknown_techs(const struct research *presearch, Tech_type_id goal)
int research_goal_bulbs_required(const struct research *presearch, Tech_type_id goal)
struct research * research_get(const struct player *pplayer)
int get_specialist_output(const struct city *pcity, Specialist_type_id sp, Output_type_id otype)
#define specialist_type_iterate_end
#define specialist_type_iterate(sp)
#define CITY_LOG(loglevel, pcity, msg,...)
#define TIMING_LOG(timer, activity)
enum server_states server_state(void)
struct ai_plr::@282 stats
struct packet_game_info info
int low_firepower_pearl_harbor
int low_firepower_combat_bonus
struct city_list * cities
struct player_economic economic
const struct player * player
int max_defense_mp_bonus_pct
struct unit_type::@91 cache
int scramble_coeff[U_LAST]
int defense_mp_bonuses_pct[U_LAST]
struct unit::@84::@87 server
Tech_type_id advance_index(const struct advance *padvance)
Tech_type_id advance_number(const struct advance *padvance)
struct city * tile_city(const struct tile *ptile)
#define TRAIT_DEFAULT_VALUE
const struct unit_type * utype
enum citystatus_type citystatus
const struct impr_type * building
struct unit * unit_transport_get(const struct unit *pcargo)
bool unit_can_do_action(const struct unit *punit, const action_id act_id)
struct unit * unit_virtual_create(struct player *pplayer, struct city *pcity, const struct unit_type *punittype, int veteran_level)
bool is_special_unit(const struct unit *punit)
void unit_virtual_destroy(struct unit *punit)
bool unit_transported(const struct unit *pcargo)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
const struct unit_type * unit_type_get(const struct unit *punit)
int utype_upkeep_cost(const struct unit_type *ut, struct player *pplayer, Output_type_id otype)
bool utype_has_role(const struct unit_type *punittype, int role)
int utype_build_shield_cost_base(const struct unit_type *punittype)
int unit_build_shield_cost_base(const struct unit *punit)
const char * utype_rule_name(const struct unit_type *punittype)
struct unit_class * unit_class_get(const struct unit *punit)
bool utype_can_do_action_result(const struct unit_type *putype, enum action_result result)
bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag)
bool unit_can_take_over(const struct unit *punit)
void * utype_ai_data(const struct unit_type *ptype, const struct ai_type *ai)
Unit_type_id utype_index(const struct unit_type *punittype)
bool utype_can_take_over(const struct unit_type *punittype)
int utype_build_shield_cost(const struct city *pcity, const struct player *pplayer, const struct unit_type *punittype)
bool utype_acts_hostile(const struct unit_type *putype)
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
#define utype_fuel(ptype)
#define unit_tech_reqs_iterate_end
#define unit_tech_reqs_iterate(_utype_, _p)
static bool utype_has_flag(const struct unit_type *punittype, int flag)
#define unit_type_iterate(_p)
#define unit_type_iterate_end