53#define SPECENUM_NAME city_options
55#define SPECENUM_VALUE0 CITYO_DISBAND
56#define SPECENUM_VALUE0NAME "Disband"
58#define SPECENUM_VALUE1 CITYO_SCIENCE_SPECIALISTS
59#define SPECENUM_VALUE1NAME "Sci_Specialists"
61#define SPECENUM_VALUE2 CITYO_GOLD_SPECIALISTS
62#define SPECENUM_VALUE2NAME "Tax_Specialists"
63#define SPECENUM_COUNT CITYO_LAST
64#define SPECENUM_BITVECTOR bv_city_options
69#define CITY_MAP_MIN_RADIUS 0
70#define CITY_MAP_DEFAULT_RADIUS 2
71#define CITY_MAP_MAX_RADIUS 5
74#define CITY_MAP_DEFAULT_RADIUS_SQ \
75 (CITY_MAP_DEFAULT_RADIUS * CITY_MAP_DEFAULT_RADIUS + 1)
76#define CITY_MAP_MIN_RADIUS_SQ \
77 (CITY_MAP_MIN_RADIUS * CITY_MAP_MIN_RADIUS + 1)
78#define CITY_MAP_MAX_RADIUS_SQ \
79 (CITY_MAP_MAX_RADIUS * CITY_MAP_MAX_RADIUS + 1)
81#define CITY_MAP_CENTER_RADIUS_SQ -1
83#define CITY_MAP_CENTER_TILE_INDEX 0
86#define CITY_MAP_MAX_SIZE (CITY_MAP_MAX_RADIUS * 2 + 1)
88#define INCITE_IMPOSSIBLE_COST (1000 * 1000 * 1000)
98#define MAX_CITY_SIZE 0xFF
107#define CITY_REL2ABS(_coor) (_coor + CITY_MAP_MAX_RADIUS)
108#define CITY_ABS2REL(_coor) (_coor - CITY_MAP_MAX_RADIUS)
111 int city_tile_index,
int city_radius_sq);
119#define city_map_tiles_from_city(_pcity) \
120 city_map_tiles(city_map_radius_sq_get(_pcity))
129#define city_map_iterate_outwards_radius_sq_index(_radius_sq_min, \
133 fc_assert(_radius_sq_min <= _radius_sq_max); \
134 int _x = 0, _y = 0, _index; \
135 int _x##_y##_index = city_map_tiles(_radius_sq_min); \
136 while (city_tile_index_to_xy(&_x, &_y, _x##_y##_index, \
138 _index = _x##_y##_index; \
141#define city_map_iterate_outwards_radius_sq_index_end \
146#define city_map_iterate_outwards_radius_sq(_radius_sq_min, \
150 fc_assert(_radius_sq_min <= _radius_sq_max); \
151 int _x = 0, _y = 0; \
152 int _x##_y##_index = city_map_tiles(_radius_sq_min); \
153 while (city_tile_index_to_xy(&_x, &_y, _x##_y##_index, \
157#define city_map_iterate_outwards_radius_sq_end \
165#define city_map_iterate(_radius_sq, _index, _x, _y) \
166 city_map_iterate_outwards_radius_sq_index(CITY_MAP_CENTER_RADIUS_SQ, \
167 _radius_sq, _index, _x, _y)
169#define city_map_iterate_end \
170 city_map_iterate_outwards_radius_sq_index_end
172#define city_map_iterate_without_index(_radius_sq, _x, _y) \
173 city_map_iterate_outwards_radius_sq(CITY_MAP_CENTER_RADIUS_SQ, \
176#define city_map_iterate_without_index_end \
177 city_map_iterate_outwards_radius_sq_end
180#define city_map_iterate_radius_sq(_radius_sq_min, _radius_sq_max, \
182 city_map_iterate_outwards_radius_sq(_radius_sq_min, _radius_sq_max, \
185#define city_map_iterate_radius_sq_end \
186 city_map_iterate_outwards_radius_sq_end
193#define city_tile_iterate_index(_nmap, _radius_sq, _city_tile, _tile, \
195 city_map_iterate_outwards_radius_sq_index(CITY_MAP_CENTER_RADIUS_SQ, \
196 _radius_sq, _index, _x, _y) \
197 struct tile *_tile = city_map_to_tile(_nmap, _city_tile, _radius_sq, \
201#define city_tile_iterate_index_end \
203 } city_map_iterate_outwards_radius_sq_index_end;
206#define city_tile_iterate_skip_free_worked(_nmap, _radius_sq, _city_tile, \
207 _tile, _index, _x, _y) { \
208 city_map_iterate(_radius_sq, _index, _x, _y) { \
209 if (!is_free_worked_index(_index)) { \
210 struct tile *_tile = city_map_to_tile(_nmap, _city_tile, _radius_sq, \
214#define city_tile_iterate_skip_free_worked_end \
217 } city_map_iterate_end; \
222#define city_tile_iterate(_nmap, _radius_sq, _city_tile, _tile) { \
223 const struct tile *_center##_tile = _city_tile; \
224 city_map_iterate_outwards_radius_sq(CITY_MAP_CENTER_RADIUS_SQ, \
225 _radius_sq, _x, _y) \
226 struct tile *_tile = city_map_to_tile(_nmap, _center##_tile, _radius_sq, \
230#define city_tile_iterate_end \
232 } city_map_iterate_outwards_radius_sq_end;
240#define I_DESTROYED (-2)
436 void *
ais[FREECIV_AI_MOD_LAST];
476 struct requirement_vector
reqs;
484#define SPECLIST_TAG city
485#define SPECLIST_TYPE struct city
488#define city_list_iterate(citylist, pcity) \
489 TYPED_LIST_ITERATE(struct city, citylist, pcity)
490#define city_list_iterate_end LIST_ITERATE_END
492#define cities_iterate(pcity) \
494 players_iterate(pcity##_player) { \
495 city_list_iterate(pcity##_player->cities, pcity) {
497#define cities_iterate_end \
498 } city_list_iterate_end; \
499 } players_iterate_end; \
502#define city_list_iterate_safe(citylist, _city) \
504 struct city_list *_city##_cl = citylist; \
505 int _city##_size = city_list_size(_city##_cl); \
507 if (_city##_size > 0) { \
508 int _city##_numbers[_city##_size]; \
512 city_list_iterate(_city##_cl, _city) { \
513 _city##_numbers[_city##_size++] = _city->id; \
514 } city_list_iterate_end; \
516 for (_city##_index = 0; \
517 _city##_index < _city##_size; \
519 struct city *_city = \
520 game_city_by_number(_city##_numbers[_city##_index]); \
524#define city_list_iterate_safe_end \
543#define city_owner(_pcity_) (_pcity_)->owner
544#define city_tile(_pcity_) (_pcity_)->tile
589 const struct city *pcity,
592 const struct city *pcity,
595 const struct city *pcity,
599 const struct city *pcity,
602 const struct city *pcity,
605 const struct city *pcity,
620 bool add_production,
int *num_units);
625 enum impr_flag_id flag);
627 bool include_shield_stock);
635 bool include_shield_stock);
650 const int city_map_y);
652 const struct tile *map_tile);
654 const struct city *
const pcity,
655 const struct tile *map_tile);
657 const int city_radius_sq,
658 const struct tile *city_center,
659 const struct tile *map_tile);
662 const struct tile *city_center,
663 int city_radius_sq,
int city_map_x,
679 const struct city *pcity,
680 const struct tile *ptile);
684 const struct tile *ptile);
687 const struct tile *ptile,
691 const struct tile *ptile);
707 const struct player *pplayer);
713 const struct player *pplayer)
719 const struct player *pplayer);
725 const struct player *pplayer)
731 const struct player *pplayer);
737 const struct player *pplayer)
743 const struct player *pplayer);
749 const struct player *pplayer)
758 const struct tile *ptile);
760 const struct tile *ptile,
761 bool may_be_on_center);
773 struct city *pcity,
bool *workers_map);
778 const struct city *pcity);
784 struct tile *ptile,
const char *
name);
796 int *pollu_prod,
int *pollu_pop,
int *pollu_mod);
799 int *ill_size,
int *ill_trade,
int *ill_pollution);
810#define city_built_iterate(_pcity, _p) \
811 improvement_iterate(_p) { \
812 if ((_pcity)->built[improvement_index(_p)].turn <= I_NEVER) { \
816#define city_built_iterate_end \
817 } improvement_iterate_end;
821#define output_type_iterate(output) \
823 Output_type_id output; \
825 for (output = 0; output < O_LAST; output++) {
827#define output_type_iterate_end \
845 const struct tile *ptile)
847 if (!pcity || !pcity->
tile || !ptile) {
856#define is_free_worked_index(city_tile_index) \
857 (CITY_MAP_CENTER_TILE_INDEX == city_tile_index)
858#define FREE_WORKED_TILES (1)
bool base_city_celebrating(const struct city *pcity)
static bool is_non_allied_city_tile(const struct tile *ptile, const struct player *pplayer)
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)
const char * city_improvement_name_translation(const struct city *pcity, const struct impr_type *pimprove)
bool is_free_worked(const struct city *pcity, const struct tile *ptile)
static bool is_non_attack_city_tile(const struct tile *ptile, const struct player *pplayer)
#define city_tile(_pcity_)
bool city_production_gets_caravan_shields(const struct universal *tgt)
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 bool is_enemy_city_tile(const struct tile *ptile, const struct player *pplayer)
int city_granary_size(int city_size)
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)
@ UNHAPPY_PENALTY_ALL_PRODUCTION
@ UNHAPPY_PENALTY_SURPLUS
bool city_built_last_turn(const struct city *pcity)
void city_choose_build_default(const struct civ_map *nmap, struct city *pcity)
static citizens city_size_get(const struct city *pcity)
int city_waste(const struct city *pcity, Output_type_id otype, int total, int *breakdown)
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)
void city_rally_point_receive(const struct packet_city_rally_point *packet, struct city *pcity) fc__attribute((nonnull(1)))
Output_type_id output_type_by_identifier(const char *id)
bool is_capital(const struct city *pcity)
struct citystyle * city_styles
int city_improvement_upkeep(const struct city *pcity, const struct impr_type *pimprove)
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)
static bool is_allied_city_tile(const struct tile *ptile, const struct player *pplayer)
void city_production_caravan_shields_init(void)
void city_remove_improvement(struct city *pcity, const struct impr_type *pimprove)
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)
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)
int get_city_tithes_bonus(const struct city *pcity)
void citylog_map_data(enum log_level level, int radius_sq, int *map_data)
bool city_rapture_grow(const struct city *pcity)
static bool is_city_center(const struct city *pcity, const struct tile *ptile)
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)
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)
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)
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)
const Output_type_id num_output_types
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)
int city_tile_output(const struct city *pcity, const struct tile *ptile, bool is_celebrating, Output_type_id otype)
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)
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)
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)
struct output_type output_types[]
bool can_city_build_improvement_later(const struct city *pcity, const struct impr_type *pimprove)
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)
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)
int city_name_compare(const void *p1, const void *p2)
int city_total_impr_gold_upkeep(const struct city *pcity)
const char * city_production_name_translation(const 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
enum output_type_id Output_type_id
#define fc_assert_ret_val(condition, val)
struct setting_list * level[OLEVELS_NUM]
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
enum city_needs_arrange needs_arrange
struct universal production
struct unit_order * orders
struct city::@16 rally_point
struct unit_list * collecting_info_units_supported
int unhappy_penalty[O_LAST]
unsigned char first_citizen_index
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
enum city_updates need_updates
struct city::@17::@20 client
struct requirement_vector reqs
char citizens_graphic[MAX_LEN_NAME]
char graphic_alt[MAX_LEN_NAME]
struct name_translation name
char graphic[MAX_LEN_NAME]
enum output_unhappy_penalty unhappy_penalty