97 int city_tile_index,
int city_radius_sq)
103 if (city_tile_index < 0
184 const int city_map_y)
252 return dist <= city_radius_sq;
260 const int city_radius_sq,
261 const struct tile *city_center,
262 const struct tile *map_tile)
277 const struct city *
const pcity,
278 const struct tile *map_tile)
289 const struct tile *map_tile)
301 const struct tile *city_center,
302 int city_radius_sq,
int city_map_x,
320static int cmp(
int v1,
int v2)
324 }
else if (v1 > v2) {
340 const struct iter_index *index1 = a, *index2 = b;
343 value =
cmp(index1->
dist, index2->dist);
348 value =
cmp(index1->
dx, index2->dx);
353 value =
cmp(index1->
dy, index2->dy);
363#define CITYLOG_MAX_VAL 9999
367 static char citylog[128], tmp[8];
381 fc_snprintf(tmp,
sizeof(tmp),
"%5d", city_map_data[mindex]);
399#undef CITYLOG_MAX_VAL
409 char line[128], tmp[8];
443 int *city_map_data = NULL;
453 sizeof(*city_map_data));
460 city_map_data[cindex] = (ptile &&
tile_worked(ptile) == pcity)
475 int *city_map_data = NULL;
482 sizeof(*city_map_data));
485 city_map_data[cindex] = cindex;
498 int *city_map_data = NULL;
505 sizeof(*city_map_data));
524 int i, dx, dy, city_x, city_y, dist, city_count_tiles = 0;
543 city_map_index_tmp[city_count_tiles].
dx =
dx;
544 city_map_index_tmp[city_count_tiles].
dy =
dy;
545 city_map_index_tmp[city_count_tiles].
dist =
dist;
566 for (i = 0; i < city_count_tiles; i++) {
574 for (i = 0; i < city_count_tiles; i++) {
588 for (i = 0; i < city_count_tiles; i++) {
591 log_debug(
"[%2d]: (dx,dy) = (%+2d,%+2d), (x,y) = (%2d,%2d), "
592 "dist = %2d, check = %2d", i,
646 for (o = 0; o <
O_LAST; o++) {
661 static char buffer[256];
662 const char *state = NULL;
666 state =
Q_(
"?wonder:W");
668 state =
Q_(
"?destroyed:D");
670 state =
Q_(
"?built:B");
677 state =
Q_(
"?obsolete:O");
679 state =
Q_(
"?redundant:*");
697 static char buffer[256];
700 case VUT_IMPROVEMENT:
713 enum impr_flag_id flag)
733 bool add_production,
int *num_units)
739 int unit_shield_cost, i;
757 if (add_production) {
763 for (i = 0; i < build_slots; i++) {
764 if (shields_left < unit_shield_cost) {
770 shields_left -= unit_shield_cost;
774 if (target.
kind != VUT_UTYPE
793 NULL, EFT_VETERAN_BUILD);
796 levels =
CLIP(0, levels, max_levels);
806 bool include_shield_stock)
889 const struct city *pcity,
901 .unittype = punittype,
928 const struct city *pcity,
949 const struct city *pcity,
973 const struct city *pcity,
976 switch (target->
kind) {
979 case VUT_IMPROVEMENT:
992 const struct city *pcity,
995 switch (target->
kind) {
998 case VUT_IMPROVEMENT:
1010 const struct city *pcity,
1013 switch (target->
kind) {
1016 case VUT_IMPROVEMENT:
1037 return max - current;
1096#ifndef FREECIV_NDEBUG
1117 return (pcity->
name != NULL) ? pcity->
name :
"City missing a name";
1125 if (pcity->
name != NULL) {
1132 log_warn(
_(
"City name \"%s\" too long"), new_name);
1181 int gold_needed = 0;
1183 if (pcity == NULL) {
1200 int gold_needed = 0;
1219 if (NULL == pimprove) {
1279 prod = pterrain->
output[otype];
1296 EFT_IRRIGATION_PCT) / 100;
1313 EFT_OUTPUT_PENALTY_TILE);
1317 EFT_OUTPUT_INC_TILE);
1319 if (is_celebrating) {
1321 EFT_OUTPUT_INC_TILE_CELEBRATE);
1327 EFT_OUTPUT_PER_TILE))
1329 if (!is_celebrating && penalty_limit > 0 && prod > penalty_limit) {
1340 EFT_OUTPUT_TILE_PUNISH_PCT))
1378 const struct city *pcity,
1379 const struct tile *ptile)
1382 int city_map_x, city_map_y;
1384 if (NULL == ptile) {
1392 if (NULL != restriction
1406 if (powner == restriction
1439 const struct tile *ptile)
1461 const struct tile *ptile,
1469 if (
punit == NULL) {
1503 USP_LIVABLE_TILE,
FALSE)) {
1514 DRO_FOREIGN,
TRUE)) {
1534 const struct tile *ptile)
1554 return pcity->
capital != CAPITAL_NOT;
1578 NULL, EFT_DEFEND_BONUS) > 0;
1656 if (pcity->id ==
id) {
1687 (*(
const struct city **) p2)->
name);
1713 const char *qs =
Qn_(s);
1755#define log_ca_s_init log_debug
1762 prod_as_req.
range = REQ_RANGE_LOCAL;
1774 ACTION_HELP_WONDER),
1777 &(enabler->target_reqs))
1793 ?
"possible" :
"impossible"),
1805 ACTION_HELP_WONDER),
1808 &(enabler->target_reqs))
1822 ?
"possible" :
"impossible"),
1835 switch (tgt->
kind) {
1836 case VUT_IMPROVEMENT:
1862 int shield_stock_after_adjustment;
1865 int unpenalized_shields = 0, penalized_shields = 0;
1868 case VUT_IMPROVEMENT:
1883 switch (target->
kind) {
1884 case VUT_IMPROVEMENT:
1900 if (orig_class == new_class
1928 shield_stock_after_adjustment =
1929 unpenalized_shields + penalized_shields / 2;
1931 return shield_stock_after_adjustment;
1940 bool include_shield_stock)
1943 int city_shield_stock = include_shield_stock ?
1947 if (target->
kind == VUT_IMPROVEMENT
1953 if (include_shield_stock && (city_shield_stock >=
cost)) {
1955 }
else if (city_shield_surplus > 0) {
1956 return (
cost - city_shield_stock - 1) / city_shield_surplus + 1;
1995 const struct player *pplayer)
2010 const struct player *pplayer)
2025 const struct player *pplayer)
2040 const struct player *pplayer)
2067 const struct tile *ptile)
2085 const struct tile *ptile,
2086 bool may_be_on_center)
2089 if (may_be_on_center || !
same_pos(ptile, ptile1)) {
2111 if (city_size == 0) {
2117 if (city_size > food_inis) {
2119 base_value += food_inc * (city_size - food_inis);
2139 if (basis +
step <= 0) {
2190 EFT_OUTPUT_BONUS_2);
2192 return MAX(bonus1 * bonus2 / 100, 0);
2201 int tithes_bonus = 0;
2210 return tithes_bonus;
2219 const int SCIENCE = 0, TAX = 1, LUXURY = 2;
2226 rates[TAX] = 100 - rates[SCIENCE] - rates[LUXURY];
2236 rates[LUXURY] = 100;
2243 output[
O_GOLD] += result[TAX];
2244 output[
O_LUXURY] += result[LUXURY];
2265 const struct city *pcity,
2266 int *output,
bool *workers_map)
2269#ifdef CITY_DEBUGGING
2274 memset(output, 0,
O_LAST *
sizeof(*output));
2278 if (workers_map == NULL) {
2281 is_worked = (NULL != pwork && pwork == pcity);
2283 is_worked = workers_map[city_tile_index];
2288#ifdef CITY_DEBUGGING
2312 output[stat_index] += count * amount;
2361 (pcity->
tile_cache[city_tile_index]).output[o]
2372 int city_tile_index,
2379 return (pcity->
tile_cache[city_tile_index]).output[o];
2400 pcity->
feel[c][i] = pcity->
feel[c][i - 1];
2425 *content =
MAX(0,
MIN(
size, base_content) - spes);
2429 *angry =
MIN(base_angry,
size - spes);
2434 *unhappy = (
size - spes - *content - *angry);
2502 while (faces > 0 && *angry > 0) {
2507 while (faces > 0 && *unhappy > 0) {
2533 enemies += nationality;
2537 unhappy_inc = enemies * pct / 100;
2541 while (unhappy_inc > 0 && *content > 0) {
2546 while (unhappy_inc > 1 && *happy > 0) {
2551 while (unhappy_inc > 0 && *happy > 0) {
2576 while (amt > 0 && *angry > 0) {
2581 while (amt > 0 && *unhappy > 0) {
2591 while (amt > 0 && *content > 0) {
2596 while (amt > 1 && *happy > 0) {
2601 while (amt > 0 && *happy > 0) {
2624 while (bonus > 0 && *content > 0) {
2629 while (bonus > 1 && *unhappy > 0) {
2637 *content += *unhappy + *angry;
2646 while (bonus > 0 && *angry > 0) {
2651 while (bonus > 0 && *unhappy > 0) {
2690 int *pollu_prod,
int *pollu_pop,
int *pollu_mod)
2696 prod = shield_total *
MAX(prod, 0) / 100;
2716 return MAX(prod + pop + mod, 0);
2737 float illness_trade = 0.0;
2748 return (
int)illness_trade;
2773 int *ill_size,
int *ill_trade,
int *ill_pollution)
2775 int illness_size = 0, illness_trade = 0, illness_pollution = 0;
2776 int illness_base, illness_percent;
2783 illness_size = (int)((1.0 - exp(- (
float)use_size / 10.0))
2799 illness_base = illness_size + illness_trade + illness_pollution;
2804 *ill_size = illness_size;
2808 *ill_trade = illness_trade;
2811 if (ill_pollution) {
2812 *ill_pollution = illness_pollution;
2816 *ill_base = illness_base;
2819 return CLIP(0, illness_base * illness_percent / 100 , 999);
2951 if (
punit == NULL || free_unhappy == NULL) {
2956 if (pcity == NULL) {
2964 if (happy_cost <= 0) {
2975 if (happy_cost <= 0) {
2979 if (*free_unhappy >= happy_cost) {
2980 *free_unhappy -= happy_cost;
2983 happy_cost -= *free_unhappy;
2997 int free_unhappy, martial_law_each;
3015 case GOLD_UPKEEP_CITY:
3018 case GOLD_UPKEEP_MIXED:
3021 case GOLD_UPKEEP_NATION:
3031 if (martial_law_each > 0) {
3033 int martial_law_max =
get_city_bonus(pcity, EFT_MARTIAL_LAW_MAX);
3036 if ((count < martial_law_max || martial_law_max == 0)
3071 struct city *pcity,
bool *workers_map)
3073 if (workers_map == NULL) {
3125 int penalty_waste = 0;
3126 int penalty_size = 0;
3128 int total_eft = total;
3132 bool waste_all =
FALSE;
3144 penalty_size = total_eft;
3148 penalty_size = total_eft * (fulltradesize -
city_size_get(pcity))
3149 / (fulltradesize - notradesize);
3154 total_eft -= penalty_size;
3158 if (total_eft > 0) {
3160 EFT_OUTPUT_WASTE_BY_DISTANCE);
3162 EFT_OUTPUT_WASTE_BY_REL_DISTANCE);
3163 if (waste_by_dist > 0 || waste_by_rel_dist > 0) {
3164 const struct city *gov_center = NULL;
3178 if (dist < min_dist) {
3186 if (gov_center == NULL) {
3189 waste_level += waste_by_dist * min_dist / 100;
3190 if (waste_by_rel_dist > 0) {
3193 waste_level += waste_by_rel_dist * 50 * min_dist / 100
3201 penalty_waste = total_eft;
3204 EFT_OUTPUT_WASTE_PCT);
3207 if (waste_level > 0) {
3208 penalty_waste = total_eft * waste_level / 100;
3212 penalty_waste -= penalty_waste * waste_pct / 100;
3215 penalty_waste =
MIN(
MAX(penalty_waste, 0), total_eft);
3224 return penalty_waste + penalty_size;
3248 const struct city *pcity)
3287 log_debug(
"Improvement %s removed from city %s",
3344 struct tile *ptile,
const char *
name)
3357 pcity->
tile = ptile;
3359 pcity->
owner = pplayer;
3374 pcity->
bonus[o] = 100;
3396 pcity->
routes = trade_route_list_new();
3397 pcity->
task_reqs = worker_task_list_new();
3426 while (worker_task_list_size(pcity->
task_reqs) > 0) {
3429 worker_task_list_remove(pcity->
task_reqs, ptask);
3433 worker_task_list_destroy(pcity->
task_reqs);
3439 trade_route_list_destroy(pcity->
routes);
3463 memset(pcity, 0,
sizeof(*pcity));
3546 if (pcity == NULL) {
3548 log_verbose(
"handle_city_rally_point() bad city number %d.",
3553 if (0 > packet->
length || MAX_LEN_ROUTE < packet->length) {
3555 log_error(
"city_rally_point_receive() invalid packet length %d (max %d)",
3562 if (packet->
length == 0) {
3572 if (!checked_orders) {
3574 log_error(
"invalid rally point orders for city number %d.",
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)
int ai_type_number(const struct ai_type *ai)
#define CALL_FUNC_EACH_AI(_func,...)
#define BV_ISSET(bv, bit)
void citizens_free(struct city *pcity)
#define citizens_foreign_iterate_end
#define citizens_foreign_iterate(_pcity, _pslot, _nationality)
bool base_city_celebrating(const struct city *pcity)
bool city_is_virtual(const struct city *pcity)
int city_turns_to_build(const struct city *pcity, const struct universal *target, bool include_shield_stock)
static void citizen_luxury_happy(struct city *pcity, int *luxuries)
const char * city_improvement_name_translation(const struct city *pcity, const struct impr_type *pimprove)
static void citizen_content_buildings(struct city *pcity)
bool is_free_worked(const struct city *pcity, const struct tile *ptile)
bool city_production_gets_caravan_shields(const struct universal *tgt)
static bv_imprs caravan_helped_impr
void city_map_radius_sq_set(struct city *pcity, int radius_sq)
int city_production_build_shield_cost(const struct city *pcity)
void city_name_set(struct city *pcity, const char *new_name)
static int player_base_citizen_happiness(const struct player *pplayer)
int city_granary_size(int city_size)
static void get_worked_tile_output(const struct civ_map *nmap, const struct city *pcity, int *output, bool *workers_map)
citizens player_angry_citizens(const struct player *pplayer)
int city_pollution_types(const struct city *pcity, int shield_total, int *pollu_prod, int *pollu_pop, int *pollu_mod)
void city_set_ai_data(struct city *pcity, const struct ai_type *ai, void *data)
static void citizen_happy_wonders(struct city *pcity)
bool city_built_last_turn(const struct city *pcity)
void city_choose_build_default(const struct civ_map *nmap, struct city *pcity)
int city_waste(const struct city *pcity, Output_type_id otype, int total, int *breakdown)
static void city_support(const struct civ_map *nmap, struct city *pcity)
void generate_city_map_indices(void)
int city_build_slots(const struct city *pcity)
struct tile * city_map_to_tile(const struct civ_map *nmap, const struct tile *city_center, int city_radius_sq, int city_map_x, int city_map_y)
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
const char * city_style_name_translation(const int style)
void city_styles_free(void)
static int city_tile_cache_get_output(const struct city *pcity, int city_tile_index, enum output_type_id o)
Output_type_id output_type_by_identifier(const char *id)
bool is_capital(const struct city *pcity)
struct citystyle * city_styles
void city_styles_alloc(int num)
const char * city_name_get(const struct city *pcity)
bool base_city_can_work_tile(const struct player *restriction, const struct city *pcity, const struct tile *ptile)
int city_unit_slots_available(const struct city *pcity)
void city_production_caravan_shields_init(void)
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)
int city_airlift_max(const struct city *pcity)
bool citymindist_prevents_city_on_tile(const struct civ_map *nmap, const struct tile *ptile)
bool can_city_build_later(const struct civ_map *nmap, const struct city *pcity, const struct universal *target)
struct output_type * get_output_type(Output_type_id output)
bool is_city_option_set(const struct city *pcity, enum city_options option)
int city_population(const struct city *pcity)
static struct iter_index * city_map_index
const char * city_style_rule_name(const int style)
void city_size_add(struct city *pcity, int add)
bool city_can_use_specialist(const struct city *pcity, Specialist_type_id type)
bool city_production_has_flag(const struct city *pcity, enum impr_flag_id flag)
bool city_is_occupied(const struct city *pcity)
void free_city_map_index(void)
int city_production_unit_veteran_level(struct city *pcity, const struct unit_type *punittype)
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)
bool city_tile_index_to_xy(int *city_map_x, int *city_map_y, int city_tile_index, int city_radius_sq)
struct city * tile_non_allied_city(const struct tile *ptile, const struct player *pplayer)
int city_unit_unhappiness(const struct civ_map *nmap, struct unit *punit, int *free_unhappy)
bool city_got_defense_effect(const struct city *pcity, const struct unit_type *attacker)
citizens player_content_citizens(const struct player *pplayer)
bool city_map_includes_tile(const struct city *const pcity, const struct tile *map_tile)
static void city_tile_cache_update(const struct civ_map *nmap, struct city *pcity)
int get_city_tithes_bonus(const struct city *pcity)
void citylog_map_data(enum log_level level, int radius_sq, int *map_data)
static int city_map_numtiles[CITY_MAP_MAX_RADIUS_SQ+1]
bool city_rapture_grow(const struct city *pcity)
int city_production_turns_to_build(const struct city *pcity, bool include_shield_stock)
bool city_unhappy(const struct city *pcity)
bool is_friendly_city_near(const struct civ_map *nmap, const struct player *owner, const struct tile *ptile)
Specialist_type_id best_specialist(Output_type_id otype, const struct city *pcity)
struct city * create_city_virtual(struct player *pplayer, struct tile *ptile, const char *name)
void set_city_production(struct city *pcity)
struct city * city_list_find_number(struct city_list *This, int id)
static bv_unit_types caravan_helped_utype
int get_final_city_output_bonus(const struct city *pcity, Output_type_id otype)
bool city_celebrating(const struct city *pcity)
bool city_can_be_built_tile_only(const struct civ_map *nmap, const struct tile *ptile)
bool can_city_build_improvement_direct(const struct city *pcity, const struct impr_type *pimprove)
const char * get_output_identifier(Output_type_id output)
int city_illness_calc(const struct city *pcity, int *ill_base, int *ill_size, int *ill_trade, int *ill_pollution)
const char * get_output_name(Output_type_id output)
bool city_can_grow_to(const struct city *pcity, int pop_size)
int city_change_production_penalty(const struct city *pcity, const struct universal *target)
static int get_city_health(const struct city *pcity)
bool is_valid_city_coords(const int city_radius_sq, const int city_map_x, const int city_map_y)
void city_refresh_from_main_map(const struct civ_map *nmap, struct city *pcity, bool *workers_map)
bool can_city_build_direct(const struct civ_map *nmap, const struct city *pcity, const struct universal *target)
static void set_city_bonuses(struct city *pcity)
static void set_surpluses(struct city *pcity)
bool city_can_be_built_here(const struct civ_map *nmap, const struct tile *ptile, const struct unit *punit, bool hut_test)
int city_pollution(const struct city *pcity, int shield_total)
bool city_happy(const struct city *pcity)
void city_size_set(struct city *pcity, citizens size)
void city_add_improvement(struct city *pcity, const struct impr_type *pimprove)
int city_tile_output_now(const struct city *pcity, const struct tile *ptile, Output_type_id otype)
int city_map_radius_sq_get(const struct city *pcity)
struct city * tile_allied_city(const struct tile *ptile, const struct player *pplayer)
struct city * tile_enemy_city(const struct tile *ptile, const struct player *pplayer)
void citylog_map_workers(enum log_level level, 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 destroy_city_virtual(struct city *pcity)
int rs_max_city_radius_sq(void)
bool city_tile_to_city_map(int *city_map_x, int *city_map_y, const int city_radius_sq, const struct tile *city_center, const struct tile *map_tile)
citizens city_specialists(const struct city *pcity)
static char * citylog_map_line(int y, int city_radius_sq, int *city_map_data)
void city_rally_point_receive(const struct packet_city_rally_point *packet, struct city *pcity)
static int cmp(int v1, int v2)
int city_style_by_translated_name(const char *s)
void add_specialist_output(const struct city *pcity, int *output)
void * city_ai_data(const struct city *pcity, const struct ai_type *ai)
struct city * city_list_find_name(struct city_list *This, const char *name)
static void citizen_happiness_nationality(struct city *pcity)
int city_tile_output(const struct city *pcity, const struct tile *ptile, bool is_celebrating, Output_type_id otype)
static int city_map_xy[CITY_MAP_MAX_SIZE][CITY_MAP_MAX_SIZE]
int city_tile_xy_to_index(int city_map_x, int city_map_y, int city_radius_sq)
bool can_city_build_unit_direct(const struct civ_map *nmap, const struct city *pcity, const struct unit_type *punittype)
bool is_gov_center(const struct city *pcity)
bool can_city_build_now(const struct civ_map *nmap, const struct city *pcity, const struct universal *target)
static void citizen_happy_luxury(struct city *pcity)
bool can_city_build_unit_now(const struct civ_map *nmap, const struct city *pcity, const struct unit_type *punittype)
int city_map_tiles(int city_radius_sq)
static void unhappy_city_check(struct city *pcity)
struct city * tile_non_attack_city(const struct tile *ptile, const struct player *pplayer)
bool city_can_work_tile(const struct city *pcity, const struct tile *ptile)
int compare_iter_index(const void *a, const void *b)
bool city_production_build_units(const struct city *pcity, bool add_production, int *num_units)
bool is_unit_near_a_friendly_city(const struct civ_map *nmap, const struct unit *punit)
int city_turns_to_grow(const struct city *pcity)
void city_rally_point_clear(struct city *pcity)
bool can_city_build_improvement_later(const struct city *pcity, const struct impr_type *pimprove)
struct output_type output_types[O_LAST]
bool city_exists_within_max_city_map(const struct civ_map *nmap, const struct tile *ptile, bool may_be_on_center)
bool city_had_recent_plague(const struct city *pcity)
static int get_trade_illness(const struct city *pcity)
bool city_can_change_build(const struct city *pcity)
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)
int city_style_by_rule_name(const char *s)
static void citizen_base_mood(struct city *pcity)
int city_name_compare(const void *p1, const void *p2)
int city_total_impr_gold_upkeep(const struct city *pcity)
static void citizen_happy_units(struct city *pcity)
static void happy_copy(struct city *pcity, enum citizen_feeling i)
const char * city_production_name_translation(const struct city *pcity)
#define city_list_iterate(citylist, pcity)
#define city_tile(_pcity_)
@ UNHAPPY_PENALTY_ALL_PRODUCTION
@ UNHAPPY_PENALTY_SURPLUS
#define city_tile_iterate_index(_nmap, _radius_sq, _city_tile, _tile, _index)
#define CITY_MAP_MAX_RADIUS_SQ
static citizens city_size_get(const struct city *pcity)
#define CITY_MAP_MAX_SIZE
#define city_tile_iterate_index_end
#define CITY_MAP_CENTER_RADIUS_SQ
#define CITY_MAP_MIN_RADIUS_SQ
#define output_type_iterate(output)
#define CITY_REL2ABS(_coor)
#define city_owner(_pcity_)
static bool is_city_center(const struct city *pcity, const struct tile *ptile)
#define city_list_iterate_end
#define city_tile_iterate(_nmap, _radius_sq, _city_tile, _tile)
#define city_map_iterate_end
#define city_map_iterate(_radius_sq, _index, _x, _y)
#define city_tile_iterate_end
#define CITY_MAP_MAX_RADIUS
#define city_built_iterate(_pcity, _p)
#define is_free_worked_index(city_tile_index)
#define city_map_tiles_from_city(_pcity)
#define CITY_ABS2REL(_coor)
#define city_built_iterate_end
#define output_type_iterate_end
void cm_init_citymap(void)
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
void distribute(int number, unsigned groups, const unsigned *ratios, int *result)
int get_tile_output_bonus(const struct city *pcity, const struct tile *ptile, const struct output_type *poutput, enum effect_type effect_type)
int get_target_bonus_effects(struct effect_list *plist, const struct req_context *context, const struct player *other_player, enum effect_type effect_type)
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
int get_city_output_bonus(const struct city *pcity, const struct output_type *poutput, enum effect_type effect_type)
int get_building_bonus(const struct city *pcity, const struct impr_type *building, enum effect_type effect_type)
int get_city_tile_output_bonus(const struct city *pcity, const struct tile *ptile, const struct output_type *poutput, enum effect_type effect_type)
int effect_cumulative_max(enum effect_type type, struct universal *unis, size_t n_unis)
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)
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
static bool is_server(void)
enum output_type_id Output_type_id
struct city * game_city_by_number(int id)
struct government * government_of_player(const struct player *pplayer)
bool can_player_build_improvement_direct(const struct player *p, 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)
void wonder_built(const struct city *pcity, const struct impr_type *pimprove)
bool great_wonder_is_destroyed(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)
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)
void wonder_destroyed(const struct city *pcity, const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
bool great_wonder_is_available(const struct impr_type *pimprove)
#define improvement_iterate_end
#define improvement_iterate(_p)
#define fc_assert_msg(condition, message,...)
#define fc_assert_ret(condition)
#define log_warn(message,...)
#define log_verbose(message,...)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define log_do_output_for_level(level)
#define fc_assert_action(condition, action)
#define log_debug(message,...)
#define log_base(level, message,...)
#define log_error(message,...)
struct tile * map_pos_to_tile(const struct civ_map *nmap, int map_x, int map_y)
int map_vector_to_sq_distance(int dx, int dy)
bool same_pos(const struct tile *tile1, const struct tile *tile2)
int real_map_distance(const struct tile *tile0, const struct tile *tile1)
void map_distance_vector(int *dx, int *dy, const struct tile *tile0, const struct tile *tile1)
#define square_iterate(nmap, center_tile, radius, tile_itr)
#define square_iterate_end
#define index_to_map_pos(pmap_x, pmap_y, mindex)
#define fc_calloc(n, esz)
#define fc_realloc(ptr, sz)
bool can_unit_exist_at_tile(const struct civ_map *nmap, const struct unit *punit, const struct tile *ptile)
bool is_native_near_tile(const struct civ_map *nmap, const struct unit_class *uclass, const struct tile *ptile)
static const char * rule_name_get(const struct name_translation *ptrans)
static const char * name_translation_get(const struct name_translation *ptrans)
struct city_list * cities
bool pplayers_at_war(const struct player *pplayer, const struct player *pplayer2)
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
bool pplayers_non_attack(const struct player *pplayer, const struct player *pplayer2)
struct player * player_slot_get_player(const struct player_slot *pslot)
int universal_build_shield_cost(const struct city *pcity, const struct universal *target)
bool are_reqs_active(const struct req_context *context, const struct player *other_player, const struct requirement_vector *reqs, const enum req_problem_type prob_type)
bool req_vec_wants_type(const struct requirement_vector *reqs, enum universals_n kind)
bool does_req_contradicts_reqs(const struct requirement *req, const struct requirement_vector *vec)
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)
const char * universal_name_translation(const struct universal *psource, char *buf, size_t bufsz)
#define requirement_vector_iterate_end
#define requirement_vector_iterate(req_vec, preq)
static struct setting settings[]
struct setting_list * level[OLEVELS_NUM]
#define CLIP(lower, current, upper)
struct specialist * specialist_by_number(const Specialist_type_id id)
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 DEFAULT_SPECIALIST
struct worker_task_list * task_reqs
struct tile_cache * tile_cache
struct built_status built[B_LAST]
int last_turns_shield_surplus
enum capital_type capital
struct unit_list * info_units_present
bv_city_options city_options
citizens unit_happy_upkeep
struct unit_list * info_units_supported
void * ais[FREECIV_AI_MOD_LAST]
struct trade_route_list * routes
struct universal production
struct unit_order * orders
struct city::@16 rally_point
struct unit_list * collecting_info_units_supported
int unhappy_penalty[O_LAST]
int before_change_shields
struct unit_list * collecting_info_units_present
citizens feel[CITIZEN_LAST][FEELING_LAST]
citizens specialists[SP_MAX]
struct city::@17::@19 server
struct cm_parameter * cm_parameter
struct universal changed_from
struct unit_list * units_supported
struct city::@17::@20 client
struct packet_ruleset_control control
struct packet_game_info info
struct government * government_during_revolution
struct requirement_vector reqs
struct unit_order orders[MAX_LEN_ROUTE]
int illness_trade_infection
enum gold_upkeep_style gold_upkeep_style
int granary_food_ini[MAX_GRANARY_INIS]
int illness_pollution_factor
int min_city_center_output[O_LAST]
struct city_list * cities
struct player_economic economic
const struct player * player
struct requirement_vector reqs
struct requirement_vector build_reqs
const struct unit_type * obsoleted_by
int fc_snprintf(char *str, size_t n, const char *format,...)
int fc_strcasecmp(const char *str0, const char *str1)
#define sz_strlcpy(dest, src)
#define sz_strlcat(dest, src)
#define terrain_has_flag(terr, flag)
int tile_roads_output_bonus(const struct tile *ptile, enum output_type_id o)
int tile_roads_output_incr(const struct tile *ptile, enum output_type_id o)
enum known_type tile_get_known(const struct tile *ptile, const struct player *pplayer)
struct city * tile_city(const struct tile *ptile)
static bool tile_resource_is_valid(const struct tile *ptile)
#define tile_worked(_tile)
#define tile_resource(_tile)
#define tile_terrain(_tile)
#define tile_owner(_tile)
bool can_cities_trade(const struct city *pc1, const struct city *pc2)
enum trade_route_type cities_trade_route_type(const struct city *pcity1, const struct city *pcity2)
int trade_base_between_cities(const struct city *pc1, const struct city *pc2)
struct trade_route_settings * trade_route_settings_by_type(enum trade_route_type type)
int trade_from_route(const struct city *pc1, const struct trade_route *route, int base)
#define trade_routes_iterate_end
#define trade_partners_iterate_end
#define trade_routes_iterate(c, proute)
#define trade_partners_iterate(c, p)
const struct unit_type * utype
const struct impr_type * building
struct unit_order * create_unit_orders(const struct civ_map *nmap, int length, const struct unit_order *orders)
bool unit_being_aggressive(const struct civ_map *nmap, const struct unit *punit)
bool is_military_unit(const struct unit *punit)
bool is_field_unit(const struct unit *punit)
void unit_virtual_destroy(struct unit *punit)
struct unit * unit_occupies_tile(const struct tile *ptile, const struct player *pplayer)
#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)
bool can_player_build_unit_direct(const struct player *p, const struct unit_type *punittype)
int utype_veteran_levels(const struct unit_type *punittype)
bool utype_can_do_act_when_ustate(const struct unit_type *punit_type, const action_id act_id, const enum ustate_prop prop, const bool is_there)
const char * utype_rule_name(const struct unit_type *punittype)
struct unit_type * utype_by_number(const Unit_type_id id)
Unit_type_id utype_index(const struct unit_type *punittype)
int utype_pop_value(const struct unit_type *punittype, const struct city *pcity)
bool can_player_build_unit_later(const struct player *p, const struct unit_type *punittype)
int utype_build_shield_cost(const struct city *pcity, const struct player *pplayer, const struct unit_type *punittype)
bool can_utype_do_act_if_tgt_diplrel(const struct unit_type *punit_type, const action_id act_id, const int prop, const bool is_there)
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
int utype_happy_cost(const struct unit_type *ut, const struct player *pplayer)
static bool uclass_has_flag(const struct unit_class *punitclass, enum unit_class_flag_id flag)
static bool utype_has_flag(const struct unit_type *punittype, int flag)
#define unit_type_iterate(_p)
#define unit_type_iterate_end
void worklist_init(struct worklist *pwl)
bool worklist_peek_ith(const struct worklist *pwl, struct universal *prod, int idx)
int worklist_length(const struct worklist *pwl)