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 SPECENUM_NAME city_wl_cancel_behavior
70#define SPECENUM_VALUE0 WLCB_SMART
73#define SPECENUM_VALUE0NAME N_("?wlcb:Smart")
74#define SPECENUM_VALUE1 WLCB_ALWAYS_PURGE
75#define SPECENUM_VALUE1NAME N_("?wlcb:Always Purge")
76#define SPECENUM_VALUE2 WLCB_ALWAYS_POSTPONE
77#define SPECENUM_VALUE2NAME N_("?wlcb:Always Postpone")
78#define SPECENUM_COUNT WLCB_LAST
82#define CITY_MAP_DEFAULT_RADIUS_SQ \
83 (CITY_MAP_DEFAULT_RADIUS * CITY_MAP_DEFAULT_RADIUS + 1)
84#define CITY_MAP_MIN_RADIUS_SQ \
85 (CITY_MAP_MIN_RADIUS * CITY_MAP_MIN_RADIUS + 1)
86#define CITY_MAP_MAX_RADIUS_SQ \
87 (CITY_MAP_MAX_RADIUS * CITY_MAP_MAX_RADIUS + 1)
89#define CITY_MAP_CENTER_RADIUS_SQ -1
91#define CITY_MAP_CENTER_TILE_INDEX 0
94#define CITY_MAP_MAX_SIZE (CITY_MAP_MAX_RADIUS * 2 + 1)
96#define INCITE_IMPOSSIBLE_COST (1000 * 1000 * 1000)
106#define MAX_CITY_SIZE 0xFF
115#define CITY_REL2ABS(_coor) (_coor + CITY_MAP_MAX_RADIUS)
116#define CITY_ABS2REL(_coor) (_coor - CITY_MAP_MAX_RADIUS)
127#define city_map_tiles_from_city(_pcity) \
128 city_map_tiles(city_map_radius_sq_get(_pcity))
137#define city_map_iterate_outwards_radius_sq_index(_radius_sq_min, \
141 fc_assert(_radius_sq_min <= _radius_sq_max); \
142 int _x = 0, _y = 0, _index; \
143 int _x##_y##_index = city_map_tiles(_radius_sq_min); \
144 while (city_tile_index_to_xy(&_x, &_y, _x##_y##_index, \
146 _index = _x##_y##_index; \
149#define city_map_iterate_outwards_radius_sq_index_end \
154#define city_map_iterate_outwards_radius_sq(_radius_sq_min, \
158 fc_assert(_radius_sq_min <= _radius_sq_max); \
159 int _x = 0, _y = 0; \
160 int _x##_y##_index = city_map_tiles(_radius_sq_min); \
161 while (city_tile_index_to_xy(&_x, &_y, _x##_y##_index, \
165#define city_map_iterate_outwards_radius_sq_end \
173#define city_map_iterate(_radius_sq, _index, _x, _y) \
174 city_map_iterate_outwards_radius_sq_index(CITY_MAP_CENTER_RADIUS_SQ, \
175 _radius_sq, _index, _x, _y)
177#define city_map_iterate_end \
178 city_map_iterate_outwards_radius_sq_index_end
180#define city_map_iterate_without_index(_radius_sq, _x, _y) \
181 city_map_iterate_outwards_radius_sq(CITY_MAP_CENTER_RADIUS_SQ, \
184#define city_map_iterate_without_index_end \
185 city_map_iterate_outwards_radius_sq_end
188#define city_map_iterate_radius_sq(_radius_sq_min, _radius_sq_max, \
190 city_map_iterate_outwards_radius_sq(_radius_sq_min, _radius_sq_max, \
193#define city_map_iterate_radius_sq_end \
194 city_map_iterate_outwards_radius_sq_end
201#define city_tile_iterate_index(_nmap, _radius_sq, _city_tile, _tile, \
203 city_map_iterate_outwards_radius_sq_index(CITY_MAP_CENTER_RADIUS_SQ, \
204 _radius_sq, _index, _x, _y) \
205 struct tile *_tile = city_map_to_tile(_nmap, _city_tile, _radius_sq, \
209#define city_tile_iterate_index_end \
211 } city_map_iterate_outwards_radius_sq_index_end;
214#define city_tile_iterate_skip_free_worked(_nmap, _radius_sq, _city_tile, \
215 _tile, _index, _x, _y) { \
216 city_map_iterate(_radius_sq, _index, _x, _y) { \
217 if (!is_free_worked_index(_index)) { \
218 struct tile *_tile = city_map_to_tile(_nmap, _city_tile, _radius_sq, \
222#define city_tile_iterate_skip_free_worked_end \
225 } city_map_iterate_end; \
230#define city_tile_iterate(_nmap, _radius_sq, _city_tile, _tile) { \
231 const struct tile *_center##_tile = _city_tile; \
232 city_map_iterate_outwards_radius_sq(CITY_MAP_CENTER_RADIUS_SQ, \
233 _radius_sq, _x, _y) \
234 struct tile *_tile = city_map_to_tile(_nmap, _center##_tile, _radius_sq, \
238#define city_tile_iterate_end \
240 } city_map_iterate_outwards_radius_sq_end;
248#define I_DESTROYED (-2)
504#define SPECLIST_TAG city
505#define SPECLIST_TYPE struct city
508#define city_list_iterate(citylist, pcity) \
509 TYPED_LIST_ITERATE(struct city, citylist, pcity)
510#define city_list_iterate_end LIST_ITERATE_END
512#define cities_iterate(pcity) \
514 players_iterate(pcity##_player) { \
515 city_list_iterate(pcity##_player->cities, pcity) {
517#define cities_iterate_end \
518 } city_list_iterate_end; \
519 } players_iterate_end; \
522#define city_list_iterate_safe(citylist, _city) \
524 struct city_list *_city##_cl = citylist; \
525 int _city##_size = city_list_size(_city##_cl); \
527 if (_city##_size > 0) { \
528 int _city##_numbers[_city##_size]; \
532 city_list_iterate(_city##_cl, _city) { \
533 _city##_numbers[_city##_size++] = _city->id; \
534 } city_list_iterate_end; \
536 for (_city##_index = 0; \
537 _city##_index < _city##_size; \
539 struct city *_city = \
540 game_city_by_number(_city##_numbers[_city##_index]); \
544#define city_list_iterate_safe_end \
563#define city_owner(_pcity_) (_pcity_)->owner
564#define city_tile(_pcity_) (_pcity_)->tile
609 const struct city *pcity,
612 const struct city *pcity,
615 const struct city *pcity,
619 const struct city *pcity,
622 const struct city *pcity,
625 const struct city *pcity,
676 const struct city *
const pcity,
679 const int city_radius_sq,
680 const struct tile *city_center,
684 const struct tile *city_center,
701 const struct city *pcity,
702 const struct tile *ptile);
706 const struct tile *ptile);
709 const struct tile *ptile,
713 const struct tile *ptile);
729 const struct player *pplayer);
735 const struct player *pplayer)
741 const struct player *pplayer);
747 const struct player *pplayer)
753 const struct player *pplayer);
759 const struct player *pplayer)
765 const struct player *pplayer);
771 const struct player *pplayer)
781 const struct tile *ptile,
784 const struct tile *ptile,
797 struct city *pcity,
bool *workers_map);
802 const struct city *pcity);
808 struct tile *ptile,
const char *
name);
834#define city_built_iterate(_pcity, _p) \
835 improvement_iterate(_p) { \
836 if ((_pcity)->built[improvement_index(_p)].turn <= I_NEVER) { \
840#define city_built_iterate_end \
841 } improvement_iterate_end;
845#define output_type_iterate(output) \
847 Output_type_id output; \
849 for (output = 0; output < O_LAST; output++) {
851#define output_type_iterate_end \
869 const struct tile *ptile)
871 if (!pcity || !pcity->
tile || !ptile) {
880#define is_free_worked_index(city_tile_index) \
881 (CITY_MAP_CENTER_TILE_INDEX == city_tile_index)
882#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 is_friendly_city_near(const struct civ_map *nmap, const struct player *owner, const struct tile *ptile, int distance)
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)
bool is_unit_near_a_friendly_city(const struct civ_map *nmap, const struct unit *punit, int distance)
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)
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)
bool city_production_is_genus(const struct city *pcity, enum impr_genus_id genus)
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)
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
enum city_wl_cancel_behavior wlcb
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
enum city_acquire_type acquire_t
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