69#define LOG_BUY LOG_DEBUG
70#define LOG_EMERGENCY LOG_VERBOSE
71#define LOG_WANT LOG_VERBOSE
75#define AI_CITY_RECALC_SPEED 5
77#define AI_BA_RECALC_SPEED 5
79#define SPECVEC_TAG tech
80#define SPECVEC_TYPE struct advance *
83#define SPECVEC_TAG impr
84#define SPECVEC_TYPE const struct impr_type *
89#define city_range_iterate(city_here, list, range, city) \
91 city_list_iterate(list, city) { \
92 if (range == REQ_RANGE_PLAYER \
93 || range == REQ_RANGE_TEAM \
94 || range == REQ_RANGE_ALLIANCE \
95 || (range == REQ_RANGE_TRADE_ROUTE \
96 && (city == city_here \
97 || have_cities_trade_route(city, city_here))) \
98 || ((range == REQ_RANGE_CITY || range == REQ_RANGE_LOCAL) \
99 && city == city_here) \
100 || (range == REQ_RANGE_CONTINENT \
101 && tile_continent(city->tile) == \
102 tile_continent(city_here->tile))) {
104#define city_range_iterate_end \
106 } city_list_iterate_end; \
109#define CITY_EMERGENCY(pcity) \
110 (pcity->surplus[O_SHIELD] < 0 || city_unhappy(pcity) \
111 || pcity->food_stock + pcity->surplus[O_FOOD] < 0)
131 const struct city *pcity,
145 "wanted by %s for building: %d -> %d",
147 building_want, tech_want);
160 const struct city *pcity,
162 struct tech_vector *needed_techs,
166 int n_needed_techs = tech_vector_size(needed_techs);
168 for (t = 0; t < n_needed_techs; t++) {
170 *tech_vector_get(needed_techs, t),
181 const struct city *pcity,
186 if (pobs->source.kind == VUT_ADVANCE && pobs->present) {
188 pobs->source.value.advance,
207 int i, bestattack = 0;
282 " workers, caravans, settlers, or buildings!");
294 &(city_data->
choice), 0)) {
304 "(caravan/coinage/settlers). Fix the ruleset!");
315#ifdef ADV_CHOICE_TRACK
316 if (city_data->
choice.log_if_chosen) {
333 build_new.
kind = VUT_UTYPE;
337 build_new.
kind = VUT_IMPROVEMENT;
341 build_new.
kind = VUT_NONE;
344 build_new.
kind = universals_n_invalid();
411 if (punittype == NULL) {
419 int real_limit = limit;
426 real_limit = expenses;
433 military ?
"military" :
"civilian");
453 const enum action_requester requester)
455 const int punit_id_stored =
punit->
id;
463 struct city *tgt_city;
472 0, NULL, ACTION_HELP_WONDER, requester)) {
487 struct city *tgt_city;
496 0, NULL, ACTION_DISBAND_UNIT_RECOVER, requester)) {
512 0, NULL, ACTION_DISBAND_UNIT, requester)) {
534 struct tile *ptile = pcity->tile;
551 int limit = cached_limit;
552 struct city *pcity = NULL;
586 int upgrade_limit = limit;
589 upgrade_limit = expenses;
618 }
else if (city_list_size(pplayer->
cities) > 6) {
623 }
else if (war_footing) {
653 || (bestchoice.
want > 200 && city_data->
urgency > 1))) {
664 CITY_LOG(
LOG_BUY, pcity,
"must have %s but can't afford it (%d < %d)!",
728 foodloss_pct =
CLIP(0, foodloss_pct, 100);
732 for (i = pop_cost; i > 0 ; i--) {
752 struct unit *virtualunit;
754 enum unit_activity best_act;
756 struct tile *best_tile = NULL;
767 if (!private->contemplace_workers) {
777 log_debug(
"No UTYF_SETTLERS role unit available");
787 &best_act, &best_target,
820 "we have %d workers and %d cities on the continent",
829 "we have %d workers and %d cities on the ocean",
842 place >= 0 ? TC_LAND : TC_OCEAN);
871 int count = city_list_size(pplayer->
cities);
872 struct city *sellers[count + 1];
878 sellers[count++] = pcity;
881 for (i = 0; i < count; i++) {
886 sellers[i] = sellers[replace];
887 sellers[replace] = tmp;
938 }
else if (pcity->server.debug) {
967 const struct city *pcity)
970 if (ai_wants_no_science(plr)
999 PL_(
"%s is selling %s for %d.",
1000 "%s is selling %s for %d.", gain),
1037 "Emergency in %s (%s, angry%d, unhap%d food%d, prod%d)",
1052#ifndef FREECIV_NDEBUG
1099 "Emergency in %s resolved by disbanding unit(s)",
1128 if (city_data != NULL) {
1140 const char *citystr)
1167 struct city *pcity,
const char *citystr)
1181 "%s.%s.building_wait", citystr, aitstr);
1192 "%s.%s.founder_boat", citystr, aitstr);
1208 const struct city *pcity)
1213 "Action %d don't exist.", act_id);
1220 switch (paction->
result) {
1221 case ACTRES_SPY_INCITE_CITY:
1229 case ACTRES_SPY_NUKE:
1230 case ACTRES_CONQUER_CITY:
1233 case ACTRES_DESTROY_CITY:
1237 case ACTRES_SPY_POISON:
1238 case ACTRES_SPY_SPREAD_PLAGUE:
1239 case ACTRES_SPY_SABOTAGE_CITY:
1240 case ACTRES_SPY_TARGETED_SABOTAGE_CITY:
1241 case ACTRES_SPY_SABOTAGE_CITY_PRODUCTION:
1242 case ACTRES_STRIKE_BUILDING:
1243 case ACTRES_STRIKE_PRODUCTION:
1244 case ACTRES_SPY_STEAL_GOLD:
1250 case ACTRES_SPY_STEAL_TECH:
1251 case ACTRES_SPY_TARGETED_STEAL_TECH:
1252 case ACTRES_STEAL_MAPS:
1257 case ACTRES_ESTABLISH_EMBASSY:
1258 case ACTRES_SPY_INVESTIGATE_CITY:
1259 case ACTRES_MARKETPLACE:
1264 case ACTRES_TRADE_ROUTE:
1265 case ACTRES_HELP_WONDER:
1266 case ACTRES_JOIN_CITY:
1267 case ACTRES_DISBAND_UNIT_RECOVER:
1268 case ACTRES_HOME_CITY:
1269 case ACTRES_UPGRADE_UNIT:
1270 case ACTRES_AIRLIFT:
1279 case ACTRES_PARADROP_CONQUER:
1281 case ACTRES_SPY_BRIBE_UNIT:
1282 case ACTRES_SPY_SABOTAGE_UNIT:
1283 case ACTRES_SPY_ATTACK:
1284 case ACTRES_EXPEL_UNIT:
1285 case ACTRES_DISBAND_UNIT:
1286 case ACTRES_CAPTURE_UNITS:
1287 case ACTRES_BOMBARD:
1288 case ACTRES_FOUND_CITY:
1289 case ACTRES_NUKE_UNITS:
1290 case ACTRES_PARADROP:
1292 case ACTRES_HEAL_UNIT:
1293 case ACTRES_TRANSFORM_TERRAIN:
1294 case ACTRES_CULTIVATE:
1296 case ACTRES_PILLAGE:
1297 case ACTRES_CLEAN_POLLUTION:
1298 case ACTRES_CLEAN_FALLOUT:
1299 case ACTRES_FORTIFY:
1301 case ACTRES_CONVERT:
1304 case ACTRES_IRRIGATE:
1305 case ACTRES_TRANSPORT_ALIGHT:
1306 case ACTRES_TRANSPORT_BOARD:
1307 case ACTRES_TRANSPORT_UNLOAD:
1308 case ACTRES_TRANSPORT_DISEMBARK:
1309 case ACTRES_TRANSPORT_EMBARK:
1310 case ACTRES_CONQUER_EXTRAS:
1311 case ACTRES_HUT_ENTER:
1312 case ACTRES_HUT_FRIGHTEN:
1313 case ACTRES_UNIT_MOVE:
1314 case ACTRES_HOMELESS:
1316 "Action not aimed at cities");
1338 bool all_met =
TRUE;
1339 int n_needed_techs = 0;
1340 int n_needed_improvements = 0;
1341 struct tech_vector needed_techs;
1342 struct impr_vector needed_improvements;
1348 .building = pimprove,
1351 tech_vector_init(&needed_techs);
1352 impr_vector_init(&needed_improvements);
1357 if (VUT_ADVANCE == preq->source.kind && preq->present && !active) {
1359 tech_vector_append(&needed_techs, preq->source.value.advance);
1360 }
else if (VUT_IMPROVEMENT == preq->source.kind && preq->present && !active) {
1364 impr_vector_append(&needed_improvements, preq->source.value.building);
1366 all_met = all_met && active;
1373 n_needed_techs = tech_vector_size(&needed_techs);
1374 if (0 < v && 0 < n_needed_techs) {
1377 const adv_want dv = v / n_needed_techs;
1387 n_needed_improvements = impr_vector_size(&needed_improvements);
1388 if (0 < v && 0 < n_needed_improvements) {
1391 const adv_want dv = v / (n_needed_improvements * 4);
1394 for (i = 0; i < n_needed_improvements; i++) {
1395 const struct impr_type *needed_impr = *impr_vector_get(&needed_improvements, i);
1406 tech_vector_free(&needed_techs);
1407 impr_vector_free(&needed_improvements);
1424 memset(prod, 0,
O_LAST *
sizeof(*prod));
1425 if (NULL != pimprove
1448 prod[
O_TRADE] += proute->value;
1453 waste[o] =
city_waste(acity, o, prod[o] * bonus[o] / 100, NULL);
1459 prod[o] = prod[o] * bonus[o] / 100 - waste[o];
1577 int cities[REQ_RANGE_COUNT];
1581 bool can_build =
TRUE;
1583 .
kind = VUT_IMPROVEMENT,
1584 .value = {.building = pimprove}
1595 .building = pimprove,
1613 && aplayer->team == pplayer->
team
1614 && aplayer != pplayer) {
1629 v +=
base_want(ait, pplayer, pcity, pimprove);
1646 cities[REQ_RANGE_PLAYER] = city_list_size(pplayer->
cities);
1649 =
cities[REQ_RANGE_PLAYER];
1652 cities[REQ_RANGE_CONTINENT] = 1;
1663 cities[REQ_RANGE_ADJACENT] =
cities[REQ_RANGE_CADJACENT] = 0;
1666 int potential = (aplayer->server.bulbs_last_turn
1667 + city_list_size(aplayer->cities) + 1);
1669 if (potential > 0) {
1671 if (pobs->source.kind == VUT_ADVANCE && pobs->present) {
1684 int n_needed_techs = 0;
1685 struct tech_vector needed_techs;
1686 bool present =
TRUE;
1687 bool impossible_to_get =
FALSE;
1689 tech_vector_init(&needed_techs);
1694 if (VUT_IMPROVEMENT == preq->source.kind
1695 && preq->source.value.building == pimprove) {
1696 if (preq->range <
range) {
1698 range = preq->range;
1700 present = preq->present;
1705 if (VUT_ADVANCE == preq->source.kind && preq->present) {
1710 tech_vector_append(&needed_techs, preq->source.value.advance);
1712 impossible_to_get =
TRUE;
1717 n_needed_techs = tech_vector_size(&needed_techs);
1718 if ((active || n_needed_techs) && !impossible_to_get) {
1720 turns, peffect,
range, nplayers);
1734 }
else if (v1 > 0) {
1745 const int a = already? 5: 4;
1746 const adv_want dv = v1 * a / (4 * n_needed_techs);
1753 tech_vector_free(&needed_techs);
1759 bool will_be_possible =
FALSE;
1760 enum req_range max_range;
1769 max_range = REQ_RANGE_LOCAL;
1781 enum req_range
range = REQ_RANGE_LOCAL;
1784 if (VUT_IMPROVEMENT == preq->source.kind
1785 && preq->source.value.building == pimprove) {
1787 if (preq->present) {
1788 range = preq->range;
1801 will_be_possible =
TRUE;
1804 if (max_range <
range) {
1816 if (is_possible == will_be_possible) {
1827 act_neg_util =
cities[max_range] * act_neg_util;
1831 if (will_be_possible) {
1848 can_build = can_build && all_met;
1851 if (is_coinage && can_build) {
1855 }
else if (!already && can_build) {
1877 if (pobs->source.kind == VUT_ADVANCE && pobs->present) {
1881 v -= v /
MAX(1, num_tech);
1972 if (pcity != wonder_city &&
is_wonder(pimprove)) {
1987 && 0 < pcity->server.adv->building_want[idx]));
1992 pcity->server.adv->building_want[idx] *= 1.5;
1994 if (pcity->production.kind == VUT_IMPROVEMENT
1998 pcity->server.adv->building_want[idx] *= 1.25;
2003 if (pcity->server.adv->building_want[idx] > 0) {
2004 pcity->server.adv->building_want[idx]
2005 = pcity->server.adv->building_want[idx]
2071 case VUT_TERRAINCLASS:
2073 case VUT_TERRAINALTER:
2133 if (preq->range >= REQ_RANGE_PLAYER
2151 enum effect_type effect_type,
2154 int greatest_value = 0;
2155 const struct impr_type *best_building = NULL;
2164 if (peffect->value > greatest_value) {
2165 const struct impr_type *building = NULL;
2166 bool wrong_unit =
FALSE;
2169 if (VUT_IMPROVEMENT == preq->source.kind && preq->present) {
2170 building = preq->source.value.building;
2177 }
else if (utype != NULL
2184 if (!wrong_unit && building != NULL) {
2185 best_building = building;
2186 greatest_value = peffect->value;
2191 if (best_building) {
bool is_action_possible_on_city(action_id act_id, const struct player *actor_player, const struct city *target_city)
void action_list_end(action_id *act_list, int size)
bool action_ever_possible(action_id action)
bool is_action_enabled_unit_on_city(const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct city *target_city)
void action_list_add_all_by_result(action_id *act_list, int *position, enum action_result result)
bool action_id_exists(const action_id act_id)
enum action_target_kind action_get_target_kind(const struct action *paction)
bool is_action_enabled_unit_on_self(const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit)
struct action_enabler_list * action_enablers_for_action(action_id action)
static struct action * action_by_number(action_id act_id)
#define action_enabler_list_iterate_end
#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_enabler_list_iterate(action_enabler_list, aenabler)
#define action_iterate(_act_)
#define action_id_get_target_kind(act_id)
void building_advisor(struct player *pplayer)
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_better_choice(struct adv_choice *first, struct adv_choice *second)
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)
#define ADV_CHOICE_ASSERT(c)
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)
@ ADV_IMPR_CALCULATE_FULL
struct ai_plr * dai_plr_data_get(struct ai_type *ait, struct player *pplayer, bool *caller_closes)
void dai_calc_data(const struct player *pplayer, int *trade, int *expenses, int *income)
#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)
int ai_trait_get_value(enum trait tr, struct player *pplayer)
struct unit_type * dai_role_utype_for_terrain_class(struct city *pcity, int role, enum terrain_class tc)
#define IS_ATTACKER(ptype)
adv_want settler_evaluate_improvements(const struct civ_map *nmap, struct unit *punit, enum unit_activity *best_act, struct extra_type **best_target, struct tile **best_tile, struct pf_path **path, struct settlermap *state)
bool base_city_celebrating(const struct city *pcity)
bool is_free_worked(const struct city *pcity, const struct tile *ptile)
int city_granary_size(int city_size)
void city_set_ai_data(struct city *pcity, const struct ai_type *ai, void *data)
bool city_built_last_turn(const struct city *pcity)
int city_waste(const struct city *pcity, Output_type_id otype, int total, int *breakdown)
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
bool is_capital(const struct city *pcity)
const char * city_name_get(const struct city *pcity)
void city_remove_improvement(struct city *pcity, const struct impr_type *pimprove)
int city_improvement_upkeep(const struct city *pcity, const struct impr_type *b)
void add_tax_income(const struct player *pplayer, int trade, int *output)
bool can_city_build_improvement_now(const struct city *pcity, const struct impr_type *pimprove)
int get_city_tithes_bonus(const struct city *pcity)
bool city_unhappy(const struct city *pcity)
int get_final_city_output_bonus(const struct city *pcity, Output_type_id otype)
int city_pollution(const struct city *pcity, int shield_total)
void city_add_improvement(struct city *pcity, const struct impr_type *pimprove)
int city_map_radius_sq_get(const struct city *pcity)
bool city_base_to_city_map(int *city_map_x, int *city_map_y, const struct city *const pcity, const struct tile *map_tile)
void add_specialist_output(const struct city *pcity, int *output)
int city_tile_output(const struct city *pcity, const struct tile *ptile, bool is_celebrating, Output_type_id otype)
bool can_city_build_unit_now(const struct city *pcity, const struct unit_type *punittype)
#define city_list_iterate(citylist, pcity)
#define city_tile(_pcity_)
static citizens city_size_get(const struct city *pcity)
#define output_type_iterate(output)
#define city_owner(_pcity_)
#define city_list_iterate_end
#define city_tile_iterate(_nmap, _radius_sq, _city_tile, _tile)
#define city_tile_iterate_end
#define city_built_iterate(_pcity, _p)
#define city_built_iterate_end
#define output_type_iterate_end
void really_handle_city_buy(struct player *pplayer, struct city *pcity)
void really_handle_city_sell(struct player *pplayer, struct city *pcity, struct impr_type *pimprove)
int city_granary_savings(const struct city *pcity)
void auto_arrange_workers(struct city *pcity)
bool city_refresh(struct city *pcity)
static void try_to_sell_stuff(struct player *pplayer, struct city *pcity)
#define AI_BA_RECALC_SPEED
#define AI_CITY_RECALC_SPEED
static bool adjust_wants_for_reqs(struct ai_type *ait, struct player *pplayer, struct city *pcity, const struct impr_type *pimprove, const adv_want v)
static void unit_do_disband_trad(struct player *owner, struct unit *punit, const enum action_requester requester)
static bool dai_cant_help_req(const struct req_context *context, const struct requirement *req)
void want_techs_for_improvement_effect(struct ai_type *ait, struct player *pplayer, const struct city *pcity, const struct impr_type *pimprove, struct tech_vector *needed_techs, adv_want building_want)
static void increase_maxbuycost(struct player *pplayer, int new_value)
static void dai_barbarian_choose_build(struct player *pplayer, struct city *pcity, struct adv_choice *choice)
void dai_city_save(struct ai_type *ait, const char *aitstr, struct section_file *file, const struct city *pcity, const char *citystr)
void dai_city_load(struct ai_type *ait, const char *aitstr, const struct section_file *file, struct city *pcity, const char *citystr)
static void dai_city_sell_noncritical(struct city *pcity, bool redundant_only)
#define city_range_iterate_end
static int unit_food_upkeep(struct unit *punit)
void dai_manage_cities(struct ai_type *ait, struct player *pplayer)
void dai_city_alloc(struct ai_type *ait, struct city *pcity)
void dai_consider_wonder_city(struct ai_type *ait, struct city *pcity, bool *result)
static bool should_force_recalc(struct city *pcity)
bool dai_can_player_build_improvement_later(const struct player *p, const struct impr_type *pimprove)
static int action_target_neg_util(action_id act_id, const struct city *pcity)
#define city_range_iterate(city_here, list, range, city)
static void resolve_city_emergency(struct ai_type *ait, struct player *pplayer, struct city *pcity)
void dont_want_tech_obsoleting_impr(struct ai_type *ait, struct player *pplayer, const struct city *pcity, const struct impr_type *pimprove, adv_want building_want)
void dai_build_adv_adjust(struct ai_type *ait, struct player *pplayer, struct city *wonder_city)
static void contemplate_terrain_improvements(struct ai_type *ait, struct city *pcity)
static void dai_spend_gold(struct ai_type *ait, struct player *pplayer)
static void adjust_improvement_wants_by_effects(struct ai_type *ait, struct player *pplayer, struct city *pcity, struct impr_type *pimprove, const bool already)
void dai_city_free(struct ai_type *ait, struct city *pcity)
static void want_tech_for_improvement_effect(struct ai_type *ait, struct player *pplayer, const struct city *pcity, const struct impr_type *pimprove, const struct advance *tech, adv_want building_want)
Impr_type_id dai_find_source_building(struct city *pcity, enum effect_type effect_type, const struct unit_type *utype)
void dai_build_adv_init(struct ai_type *ait, struct player *pplayer)
static void dai_upgrade_units(struct city *pcity, int limit, bool military)
#define CITY_EMERGENCY(pcity)
bool dai_can_city_build_improvement_later(const struct city *pcity, const struct impr_type *pimprove)
adv_want dai_city_want(struct player *pplayer, struct city *acity, struct adv_data *adv, struct impr_type *pimprove)
static adv_want base_want(struct ai_type *ait, struct player *pplayer, struct city *pcity, struct impr_type *pimprove)
static int unit_foodbox_cost(struct unit *punit)
static bool building_crucial(const struct player *plr, struct impr_type *pimprove, const struct city *pcity)
static void dai_city_choose_build(struct ai_type *ait, struct player *pplayer, struct city *pcity)
#define BUILDING_WAIT_MINIMUM
bool dai_on_war_footing(struct ai_type *ait, struct player *pplayer)
struct adv_choice * domestic_advisor_choose_build(struct ai_type *ait, struct player *pplayer, struct city *pcity)
bool dai_can_requirement_be_met_in_city(const struct requirement *preq, const struct player *pplayer, const struct city *pcity)
adv_want dai_effect_value(struct player *pplayer, const struct adv_data *adv, const struct city *pcity, const bool capital, int turns, const struct effect *peffect, const int c, const int nplayers)
int assess_defense(struct ai_type *ait, struct city *pcity)
int assess_defense_quadratic(struct ai_type *ait, struct city *pcity)
bool dai_process_defender_want(struct ai_type *ait, struct player *pplayer, struct city *pcity, unsigned int danger, struct adv_choice *choice, adv_want extra_want)
struct adv_choice * military_advisor_choose_build(struct ai_type *ait, struct player *pplayer, struct city *pcity, const struct civ_map *mamap, player_unit_list_getter ul_cb)
void dai_auto_settler_reset(struct ai_type *ait, struct player *pplayer)
void contemplate_new_city(struct ai_type *ait, 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 * 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 cost
bool ai_fuzzy(const struct player *pplayer, bool normal_decision)
struct effect_list * get_req_source_effects(struct universal *psource)
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
struct effect_list * get_effects(enum effect_type effect_type)
bool building_has_effect(const struct impr_type *pimprove, enum effect_type effect_type)
#define effect_list_iterate_end
#define effect_list_iterate(effect_list, peffect)
signed short Continent_id
#define PL_(String1, String2, n)
const struct ft_color ftc_server
const char * city_link(const struct city *pcity)
static GtkWidget * source
bool has_handicap(const struct player *pplayer, enum handicap_type htype)
const struct impr_type * valid_improvement(const struct impr_type *pimprove)
int impr_sell_gold(const struct impr_type *pimprove)
bool can_city_sell_building(const struct city *pcity, const struct impr_type *pimprove)
bool is_improvement_redundant(const struct city *pcity, const struct impr_type *pimprove)
bool can_player_build_improvement_later(const struct player *p, const struct impr_type *pimprove)
bool is_improvement(const struct impr_type *pimprove)
Impr_type_id improvement_number(const struct impr_type *pimprove)
const char * improvement_rule_name(const struct impr_type *pimprove)
Impr_type_id improvement_index(const struct impr_type *pimprove)
int impr_build_shield_cost(const struct city *pcity, const struct impr_type *pimprove)
bool is_wonder(const struct impr_type *pimprove)
bool is_great_wonder(const struct impr_type *pimprove)
bool improvement_obsolete(const struct player *pplayer, const struct impr_type *pimprove, const struct city *pcity)
bool improvement_has_flag(const struct impr_type *pimprove, enum impr_flag_id flag)
struct city * city_from_small_wonder(const struct player *pplayer, const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
bool is_small_wonder(const struct impr_type *pimprove)
bool great_wonder_is_available(const struct impr_type *pimprove)
bool is_improvement_productive(const struct city *pcity, const struct impr_type *pimprove)
#define improvement_iterate_end
#define improvement_iterate(_p)
void initialize_infrastructure_cache(struct player *pplayer)
#define fc_assert_msg(condition, message,...)
#define fc_assert_ret(condition)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define fc_assert_action(condition, action)
#define log_debug(message,...)
#define log_normal(message,...)
#define log_base(level, message,...)
#define fc_calloc(n, esz)
void notify_player(const struct player *pplayer, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
struct city_list * cities
int player_get_expected_income(const struct player *pplayer)
const char * player_name(const struct player *pplayer)
#define players_iterate_end
#define players_iterate(_pplayer)
static bool is_barbarian(const struct player *pplayer)
int normal_player_count(void)
bool secfile_lookup_bool_default(const struct section_file *secfile, bool def, const char *path,...)
int secfile_lookup_int_default(const struct section_file *secfile, int def, const char *path,...)
#define secfile_insert_int(secfile, value, path,...)
#define secfile_insert_bool(secfile, value, path,...)
bool is_req_active(const struct req_context *context, const struct player *other_player, const struct requirement *req, const enum req_problem_type prob_type)
enum req_unchanging_status is_req_preventing(const struct req_context *context, const struct player *other_player, const struct requirement *req, enum req_problem_type prob_type)
#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)
int research_goal_bulbs_required(const struct research *presearch, Tech_type_id goal)
struct research * research_get(const struct player *pplayer)
#define CLIP(lower, current, upper)
#define DEFAULT_SPECIALIST
#define CITY_LOG(loglevel, pcity, msg,...)
#define UNIT_LOG(loglevel, punit, msg,...)
#define TIMING_LOG(timer, activity)
enum action_result result
adv_want building_want[B_LAST]
struct adv_data::@92 stats
enum adv_improvement_status impr_calc[B_LAST]
enum req_range impr_range[B_LAST]
unsigned int grave_danger
struct unit_type * worker_type
struct ai_plr::@267 stats
adv_want tech_want[A_LAST+1]
struct universal production
citizens feel[CITIZEN_LAST][FEELING_LAST]
citizens specialists[SP_MAX]
struct city::@17::@19 server
struct unit_list * units_supported
struct civ_game::@30::@34 server
struct packet_game_info info
int incite_improvement_factor
struct requirement_vector obsolete_by
struct requirement_vector reqs
int great_wonder_owners[B_LAST]
struct city_list * cities
struct player_ai ai_common
struct player_economic economic
const struct player * player
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 tile_worked(_tile)
#define tile_continent(_tile)
int city_num_trade_routes(const struct city *pcity)
#define trade_routes_iterate_end
#define trade_routes_iterate(c, proute)
#define TRAIT_DEFAULT_VALUE
const struct unit_type * utype
const struct impr_type * building
bool unit_being_aggressive(const struct unit *punit)
bool unit_is_alive(int id)
bool is_field_unit(const struct unit *punit)
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)
const char * get_activity_text(enum unit_activity activity)
void unit_virtual_destroy(struct unit *punit)
void unit_tile_set(struct unit *punit, struct tile *ptile)
bool unit_perform_action(struct player *pplayer, const int actor_id, const int target_id, const int sub_tgt_id_incoming, const char *name, const action_id action_type, const enum action_requester requester)
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_safe(unitlist, _unit)
#define unit_list_iterate_end
#define unit_list_iterate_safe_end
struct unit_type * best_role_unit(const struct city *pcity, int role)
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_is_cityfounder(const struct unit_type *utype)
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 struct unit_type * can_upgrade_unittype(const struct player *pplayer, const struct unit_type *punittype)
const char * utype_rule_name(const struct unit_type *punittype)
bool unit_has_type_role(const struct unit *punit, enum unit_role_id role)
bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag)
int utype_build_shield_cost(const struct city *pcity, const struct player *pplayer, const struct unit_type *punittype)
int utype_happy_cost(const struct unit_type *ut, const struct player *pplayer)
int unit_upgrade_price(const struct player *pplayer, const struct unit_type *from, const struct unit_type *to)