60 const struct player *plr2);
62 const struct player *plr2);
64 const struct player *plr2);
79 memset(count, 0,
sizeof(count));
83 .
kind = VUT_IMPROVEMENT,
84 .value = {.building = pimprove}
91 switch (peffect->type) {
94 case EFT_FORCE_CONTENT:
95 case EFT_FORCE_CONTENT_PCT:
96 case EFT_MAKE_CONTENT:
97 case EFT_MAKE_CONTENT_MIL:
98 case EFT_MAKE_CONTENT_MIL_PER:
99 case EFT_MAKE_CONTENT_PCT:
102 case EFT_CAPITAL_CITY:
103 case EFT_POLLU_POP_PCT:
104 case EFT_POLLU_POP_PCT_2:
105 case EFT_POLLU_PROD_PCT:
106 case EFT_OUTPUT_BONUS:
107 case EFT_OUTPUT_BONUS_2:
108 case EFT_OUTPUT_WASTE_PCT:
109 case EFT_UPKEEP_FREE:
111 if (VUT_IMPROVEMENT == preq->source.kind
112 && preq->source.value.building == pimprove) {
122 case EFT_OUTPUT_ADD_TILE:
123 case EFT_OUTPUT_PER_TILE:
124 case EFT_OUTPUT_INC_TILE:
126 if (VUT_IMPROVEMENT == preq->source.kind
127 && preq->source.value.building == pimprove) {
150 struct research *presearch, *aresearch;
153 if (players_needed == 0) {
170 if (aplayer == pplayer) {
178 if (players_having >= players_needed) {
216 adv->stats.units.coast_strict++;
219 adv->stats.units.suicide_attackers++;
227 adv->stats.units.paratroopers++;
230 adv->stats.units.airliftable++;
233 adv->stats.units.upgradeable++;
265 bool danger_of_nukes;
287 danger_of_nukes =
FALSE;
346 adv->threats.ocean[-continent] =
TRUE;
352 adv->threats.ocean[-continent] =
TRUE;
363 adv->threats.suicide_attack =
TRUE;
369 danger_of_nukes =
TRUE;
384 adv->threats.nuclear = 1;
391 if (danger_of_nukes) {
392 adv->threats.nuclear++;
399 adv->explore.continent =
fc_calloc(
adv->num_continents + 1,
sizeof(
bool));
410 adv->explore.ocean[-continent] =
TRUE;
423 adv->explore.continent[continent] =
TRUE;
429 adv->explore.continent[continent] =
TRUE;
437 adv->stats.average_production = 0;
441 if (continent >= 0) {
442 adv->stats.cities[continent]++;
444 adv->stats.ocean_cities[-continent]++;
446 adv->stats.average_production += pcity->surplus[
O_SHIELD];
448 adv->stats.average_production /=
MAX(1, city_list_size(pplayer->
cities));
521 bool found_human =
FALSE;
524 if (aplayer == pplayer ||
is_ai(aplayer)) {
528 city_list_size(aplayer->cities) + 3);
636#if defined(FREECIV_DEBUG) || defined(IS_DEVEL_VERSION)
640 if (caller_closes != NULL) {
641 *caller_closes =
FALSE;
664 log_debug(
"%s advisor data phase closed when adv_data_get() called",
667 if (caller_closes != NULL) {
668 *caller_closes =
TRUE;
676 *caller_closes =
TRUE;
707 if (aplayer != pplayer) {
756 if (aplayer != pplayer) {
774 const struct player *plr2)
786 const struct player *plr2)
791 if (*dip_slot != NULL) {
801 const struct player *plr2)
826 switch (paction->
result) {
828 case ACTRES_SPY_INCITE_CITY:
829 case ACTRES_CONQUER_CITY:
832 case ACTRES_SPY_BRIBE_UNIT:
835 case ACTRES_TRANSFORM_TERRAIN:
838 case ACTRES_CULTIVATE:
842 case ACTRES_CONQUER_EXTRAS:
846 case ACTRES_HUT_ENTER:
847 case ACTRES_HUT_FRIGHTEN:
851 case ACTRES_SPY_INVESTIGATE_CITY:
852 case ACTRES_SPY_POISON:
853 case ACTRES_SPY_SPREAD_PLAGUE:
854 case ACTRES_SPY_STEAL_GOLD:
855 case ACTRES_SPY_SABOTAGE_CITY:
856 case ACTRES_SPY_TARGETED_SABOTAGE_CITY:
857 case ACTRES_SPY_SABOTAGE_CITY_PRODUCTION:
858 case ACTRES_SPY_STEAL_TECH:
859 case ACTRES_SPY_TARGETED_STEAL_TECH:
860 case ACTRES_SPY_SABOTAGE_UNIT:
861 case ACTRES_CAPTURE_UNITS:
862 case ACTRES_STEAL_MAPS:
864 case ACTRES_SPY_NUKE:
866 case ACTRES_NUKE_UNITS:
867 case ACTRES_DESTROY_CITY:
868 case ACTRES_EXPEL_UNIT:
869 case ACTRES_STRIKE_BUILDING:
870 case ACTRES_STRIKE_PRODUCTION:
871 case ACTRES_SPY_ATTACK:
877 case ACTRES_UNIT_MOVE:
878 case ACTRES_MARKETPLACE:
879 case ACTRES_FOUND_CITY:
880 case ACTRES_DISBAND_UNIT:
881 case ACTRES_PARADROP:
882 case ACTRES_PARADROP_CONQUER:
893 case ACTRES_ESTABLISH_EMBASSY:
894 case ACTRES_TRADE_ROUTE:
895 case ACTRES_JOIN_CITY:
896 case ACTRES_HELP_WONDER:
897 case ACTRES_DISBAND_UNIT_RECOVER:
898 case ACTRES_HOME_CITY:
899 case ACTRES_HOMELESS:
900 case ACTRES_UPGRADE_UNIT:
902 case ACTRES_HEAL_UNIT:
907 case ACTRES_IRRIGATE:
908 case ACTRES_CLEAN_POLLUTION:
909 case ACTRES_CLEAN_FALLOUT:
910 case ACTRES_TRANSPORT_ALIGHT:
911 case ACTRES_TRANSPORT_UNLOAD:
912 case ACTRES_TRANSPORT_DISEMBARK:
913 case ACTRES_TRANSPORT_BOARD:
914 case ACTRES_TRANSPORT_EMBARK:
980 bool override =
FALSE;
995 int revolution_turns;
1012 if (revolution_turns > 0) {
1013 bonus -= 6 / revolution_turns;
1016 val += (val * bonus) / 100;
1021 if (VUT_ADVANCE == preq->source.kind) {
1025 dist +=
MAX(1, gut);
1061 if (VUT_ADVANCE == preq->source.kind) {
1091 enum diplstate_type ds;
1094 if (
is_ai(pplayer)) {
1096 CALL_PLR_AI_FUNC(consider_plr_dangerous, pplayer, pplayer, aplayer, &dang);
1107 if (pplayer == aplayer) {
1114 if (ds == DS_WAR || ds == DS_CEASEFIRE) {
void action_list_end(action_id *act_list, int size)
bool action_immune_government(struct government *gov, action_id act)
void action_list_add_all_by_result(action_id *act_list, int *position, enum action_result result)
static struct action * action_by_number(action_id act_id)
#define action_id_get_role(act_id)
#define action_array_iterate(_act_list_, _act_id_)
#define action_array_iterate_end
#define action_iterate_end
#define action_iterate(_act_)
#define POLLUTION_WEIGHTING
int adv_eval_calc_city(struct city *pcity, struct adv_data *adv)
static void adv_data_city_impr_calc(struct player *pplayer, struct adv_data *adv)
void adv_data_analyze_rulesets(struct player *pplayer)
void adv_data_close(struct player *pplayer)
adv_want adv_gov_player_bonus_want(struct player *pplayer)
void adv_data_init(struct player *pplayer)
static void adv_dipl_free(const struct player *plr1, const struct player *plr2)
struct adv_data * adv_data_get(struct player *pplayer, bool *caller_closes)
bool is_adv_data_phase_open(struct player *pplayer)
bool adv_wants_science(struct player *pplayer)
bool adv_data_phase_init(struct player *pplayer, bool is_new_phase)
void adv_data_phase_done(struct player *pplayer)
bool adv_is_player_dangerous(struct player *pplayer, struct player *aplayer)
static void adv_dipl_new(const struct player *plr1, const struct player *plr2)
static void count_my_units(struct player *pplayer)
adv_want adv_gov_action_immunity_want(struct government *gov)
static struct adv_dipl * adv_dipl_get(const struct player *plr1, const struct player *plr2)
static bool player_has_really_useful_tech_parasite(struct player *pplayer)
void adv_best_government(struct player *pplayer)
void adv_data_default(struct player *pplayer)
@ ADV_IMPR_CALCULATE_FULL
#define CALL_PLR_AI_FUNC(_func, _player,...)
struct player * player_leading_spacerace(void)
#define city_list_iterate(citylist, pcity)
#define city_list_iterate_end
void auto_arrange_workers(struct city *pcity)
static void nuke_units(QVariant data1, QVariant data2)
static void nuke(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 effect_list * get_req_source_effects(struct universal *psource)
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
#define effect_list_iterate_end
#define effect_list_iterate(effect_list, peffect)
signed short Continent_id
Government_type_id government_count(void)
struct government * government_of_player(const struct player *pplayer)
bool can_change_to_government(struct player *pplayer, const struct government *gov)
Government_type_id government_index(const struct government *pgovern)
#define governments_iterate(NAME_pgov)
#define governments_iterate_end
static GtkWidget * source
bool has_handicap(const struct player *pplayer, enum handicap_type htype)
Impr_type_id improvement_index(const struct impr_type *pimprove)
#define improvement_iterate_end
#define improvement_iterate(_p)
#define fc_assert_ret(condition)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define log_debug(message,...)
#define adjc_iterate(nmap, center_tile, itr_tile)
#define whole_map_iterate(_map, _tile)
#define whole_map_iterate_end
bool map_is_known(const struct tile *ptile, const struct player *pplayer)
#define fc_calloc(n, esz)
#define fc_realloc(ptr, sz)
bool can_unit_type_transport(const struct unit_type *transporter, const struct unit_class *transported)
int player_slot_count(void)
const char * player_name(const struct player *pplayer)
int player_slot_index(const struct player_slot *pslot)
int player_index(const struct player *pplayer)
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
#define players_iterate_end
#define players_iterate(_pplayer)
#define player_slots_iterate(_pslot)
#define players_iterate_alive_end
#define player_slots_iterate_end
static bool player_is_cpuhog(const struct player *pplayer)
#define players_iterate_alive(_pplayer)
void check_player_max_rates(struct player *pplayer)
#define requirement_vector_iterate_end
#define requirement_vector_iterate(req_vec, preq)
int research_goal_unknown_techs(const struct research *presearch, Tech_type_id goal)
struct research * research_get(const struct player *pplayer)
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
bool research_invention_gettable(const struct research *presearch, const Tech_type_id tech, bool allow_holes)
#define CLIP(lower, current, upper)
#define TIMING_LOG(timer, activity)
enum action_result result
struct adv_data::@90 threats
struct adv_data::@91 explore
struct adv_data::@92 stats
struct adv_data::@92::@95 units
struct government * revolution
struct adv_dipl ** adv_dipl_slots
struct adv_data::@94::@96 govt
adv_want * government_want
struct player * production_leader
struct adv_data::@93 dipl
enum adv_improvement_status impr_calc[B_LAST]
bool phase_is_initialized
enum req_range impr_range[B_LAST]
struct adv_data::@94 goal
struct player * tech_leader
struct player * spacerace_leader
struct packet_game_info info
struct government * government_during_revolution
bool tech_parasite_allow_holes
int love[MAX_NUM_PLAYER_SLOTS]
struct city_list * cities
struct player_ai ai_common
struct government * government
const struct ai_type * ai
struct player_score score
struct player::@69::@71 server
struct unit_class::@84 adv
struct unit_type::@87 adv
struct unit_class * uclass
const struct unit_type * utype
bool is_future_tech(Tech_type_id tech)
Tech_type_id advance_number(const struct advance *padvance)
#define advance_index_iterate_end
#define advance_index_iterate(_start, _index)
#define is_ocean_tile(ptile)
#define tile_continent(_tile)
bool unit_can_do_action(const struct unit *punit, const action_id act_id)
int get_transporter_capacity(const struct unit *punit)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
const struct unit_type * unit_type_get(const struct unit *punit)
struct unit_type * get_role_unit(int role, int role_index)
int num_role_units(int role)
const struct unit_type * can_upgrade_unittype(const struct player *pplayer, const struct unit_type *punittype)
bool can_player_build_unit_direct(const struct player *p, const struct unit_type *punittype)
struct unit_class * unit_class_get(const struct unit *punit)
bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag)
bool unit_can_take_over(const struct unit *punit)
bool utype_can_take_over(const struct unit_type *punittype)
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
#define unit_type_iterate(_p)
#define uclass_index(_c_)
#define unit_type_iterate_end