77#define LOG_DIPLOMAT LOG_DEBUG
78#define LOG_DIPLOMAT_BUILD LOG_DEBUG
82#define DIPLO_DEFENSE_WANT 3000
88 struct city **ctarget,
int *move_dist,
132 "A defensive diplomat will be built in city %s.",
134 choice->
want = 16000;
143 "A defensive diplomat is wanted badly in city %s.",
153 "ai_choose_diplomat_defensive() + %d for %s",
195 int loss, p_success, p_failure, time_to_dest;
196 int gain_incite = 0, gain_theft = 0, gain = 1;
286 "A diplomat desired in %s to establish an embassy with %s "
293 if (want > choice->
want) {
296 " to spy in %s (incite want %d cost %d gold %d, "
297 "tech theft want %d, ttd %d)",
408 "decides to stand idle outside enemy city %s!",
560 }
else if (
dipls > 0) {
bool is_action_possible_on_city(action_id act_id, const struct player *actor_player, const struct city *target_city)
enum action_actor_kind action_get_actor_kind(const struct action *paction)
bool action_prob_possible(const struct act_prob probability)
const char * action_rule_name(const struct action *action)
int action_number(const struct action *action)
bool is_action_enabled_unit_on_unit(const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct unit *target_unit)
struct act_prob action_prob_vs_city(const struct civ_map *nmap, const struct unit *actor_unit, const action_id act_id, const struct city *target_city)
enum action_target_kind action_get_target_kind(const struct action *paction)
struct act_prob action_prob_vs_unit(const struct civ_map *nmap, const struct unit *actor_unit, const action_id act_id, const struct unit *target_unit)
static struct action * action_by_number(action_id act_id)
#define action_iterate_end
#define action_iterate(_act_)
#define adv_choice_set_use(_choice, _use)
bool adv_unit_execute_path(struct unit *punit, struct pf_path *path)
bool aia_utype_is_considered_spy(const struct unit_type *putype)
bool aia_utype_is_considered_worker(const struct unit_type *putype)
static struct city * dai_diplomat_defend(struct ai_type *ait, struct player *pplayer, struct unit *punit, const struct unit_type *utype, struct pf_map *pfm)
void dai_choose_diplomat_defensive(struct ai_type *ait, struct player *pplayer, struct city *pcity, struct adv_choice *choice, int def)
void dai_manage_diplomat(struct ai_type *ait, struct player *pplayer, struct unit *punit)
#define LOG_DIPLOMAT_BUILD
static void dai_diplomat_city(struct ai_type *ait, struct unit *punit, struct city *ctarget)
void dai_choose_diplomat_offensive(struct ai_type *ait, struct player *pplayer, struct city *pcity, struct adv_choice *choice)
#define DIPLO_DEFENSE_WANT
static bool dai_diplomat_bribe_nearby(struct ai_type *ait, struct player *pplayer, struct unit *punit, struct pf_map *pfm)
static int count_stealable_techs(struct player *pplayer, struct player *tplayer)
static void find_city_to_diplomat(struct player *pplayer, struct unit *punit, struct city **ctarget, int *move_dist, struct pf_map *pfm)
static bool is_city_surrounded_by_our_spies(struct player *pplayer, struct city *pcity)
void aiguard_request_guard(struct ai_type *ait, struct unit *punit)
void dai_calc_data(const struct player *pplayer, int *trade, int *expenses, int *income)
#define BV_ISSET(bv, bit)
const char * city_name_get(const struct city *pcity)
int city_production_unit_veteran_level(struct city *pcity, const struct unit_type *punittype)
#define city_tile(_pcity_)
#define INCITE_IMPOSSIBLE_COST
#define city_owner(_pcity_)
int city_incite_cost(struct player *pplayer, struct city *pcity)
int dai_action_choose_sub_tgt_unit_vs_city(struct action *paction, struct unit *actor_unit, struct city *target_city)
adv_want dai_action_value_unit_vs_city(struct action *paction, struct unit *actor_unit, struct city *target_city, int sub_tgt_id, int count_tech)
#define TECH_LOG(ait, loglevel, pplayer, padvance, msg,...)
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)
static struct unit_ai * def_ai_unit_data(const struct unit *punit, struct ai_type *deftype)
#define POTENTIALLY_HOSTILE_PLAYER(ait, pplayer, aplayer)
#define DEFENSE_POWER(ptype)
#define ATTACK_POWER(ptype)
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
int diplomats_unignored_tech_stealings(struct unit *pdiplomat, struct city *pcity)
int count_diplomats_on_tile(struct tile *ptile)
struct unit * game_unit_by_number(int id)
bool has_handicap(const struct player *pplayer, enum handicap_type htype)
#define fc_assert_ret(condition)
#define fc_assert(condition)
#define log_base(level, message,...)
bool same_pos(const struct tile *tile1, const struct tile *tile2)
int real_map_distance(const struct tile *tile0, const struct tile *tile1)
struct tile * mapstep(const struct civ_map *nmap, const struct tile *ptile, enum direction8 dir)
#define adjc_iterate(nmap, center_tile, itr_tile)
bool map_is_known_and_seen(const struct tile *ptile, const struct player *pplayer, enum vision_layer vlayer)
int unit_move_rate(const struct unit *punit)
const char * nation_rule_name(const struct nation_type *pnation)
struct nation_type * nation_of_unit(const struct unit *punit)
void pf_path_destroy(struct pf_path *path)
struct pf_map * pf_map_new(const struct pf_parameter *parameter)
struct pf_path * pf_map_path(struct pf_map *pfm, struct tile *ptile)
bool pf_map_position(struct pf_map *pfm, struct tile *ptile, struct pf_position *pos)
void pf_map_destroy(struct pf_map *pfm)
#define pf_map_move_costs_iterate_end
#define pf_map_positions_iterate_end
#define pf_map_move_costs_iterate(ARG_pfm, NAME_tile, NAME_cost, COND_from_start)
#define pf_map_positions_iterate(ARG_pfm, NAME_pos, COND_from_start)
const char * player_name(const struct player *pplayer)
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
bool player_has_embassy(const struct player *pplayer, const struct player *pplayer2)
static bool is_barbarian(const struct player *pplayer)
int research_total_bulbs_required(const struct research *presearch, Tech_type_id tech, bool loss_value)
struct research * research_get(const struct player *pplayer)
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
#define UNIT_LOG(loglevel, punit, msg,...)
struct ai_plr::@282 stats
adv_want tech_want[A_LAST+1]
bv_id diplomat_reservations
struct civ_game::@32::@36 server
enum tile_behavior(* get_TB)(const struct tile *ptile, enum known_type known, const struct pf_parameter *param)
bool(* get_zoc)(const struct player *pplayer, const struct tile *ptile, const struct civ_map *zmap)
struct player_economic economic
Tech_type_id advance_index(const struct advance *padvance)
#define advance_index_iterate_end
#define advance_index_iterate(_start, _index)
struct city * tile_city(const struct tile *ptile)
const struct unit_type * utype
int unit_bribe_cost(const struct unit *punit, const struct player *briber, const struct unit *briber_unit)
bool unit_can_do_action_result(const struct unit *punit, enum action_result result)
struct unit * unit_virtual_create(struct player *pplayer, struct city *pcity, const struct unit_type *punittype, int veteran_level)
struct unit * tile_other_players_unit(const struct tile *ptile, const struct player *pplayer)
void unit_virtual_destroy(struct unit *punit)
#define CHECK_UNIT(punit)
bool unit_activity_handling(struct unit *punit, enum unit_activity new_activity, enum gen_action trigger_action)
void unit_do_action(struct player *pplayer, const int actor_id, const int target_id, const int sub_tgt_id, const char *name, const action_id action_type)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
struct unit_type * best_role_unit(const struct city *pcity, int role)
const struct unit_type * unit_type_get(const struct unit *punit)
struct unit_type * get_role_unit(int role, int role_index)
const char * unit_rule_name(const struct unit *punit)
int num_role_units(int role)
const char * utype_rule_name(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_can_do_action(const struct unit_type *putype, const action_id act_id)
#define unit_tech_reqs_iterate_end
#define unit_tech_reqs_iterate(_utype_, _p)