Freeciv-3.1
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions | Variables
city.h File Reference
#include "bitvector.h"
#include "log.h"
#include "fc_types.h"
#include "name_translation.h"
#include "improvement.h"
#include "tile.h"
#include "traderoutes.h"
#include "unit.h"
#include "unitlist.h"
#include "vision.h"
#include "workertask.h"
#include "worklist.h"
#include "specenum_gen.h"
#include "speclist.h"

Go to the source code of this file.

Data Structures

struct  iter_index
 
struct  built_status
 
struct  output_type
 
struct  city
 
struct  citystyle
 

Macros

#define SPECENUM_NAME   city_options
 
#define SPECENUM_VALUE0   CITYO_DISBAND
 
#define SPECENUM_VALUE0NAME   "Disband"
 
#define SPECENUM_VALUE1   CITYO_SCIENCE_SPECIALISTS
 
#define SPECENUM_VALUE1NAME   "Sci_Specialists"
 
#define SPECENUM_VALUE2   CITYO_GOLD_SPECIALISTS
 
#define SPECENUM_VALUE2NAME   "Tax_Specialists"
 
#define SPECENUM_COUNT   CITYO_LAST
 
#define SPECENUM_BITVECTOR   bv_city_options
 
#define CITY_MAP_MIN_RADIUS   0
 
#define CITY_MAP_DEFAULT_RADIUS   2
 
#define CITY_MAP_MAX_RADIUS   5
 
#define CITY_MAP_DEFAULT_RADIUS_SQ    (CITY_MAP_DEFAULT_RADIUS * CITY_MAP_DEFAULT_RADIUS + 1)
 
#define CITY_MAP_MIN_RADIUS_SQ    (CITY_MAP_MIN_RADIUS * CITY_MAP_MIN_RADIUS + 1)
 
#define CITY_MAP_MAX_RADIUS_SQ    (CITY_MAP_MAX_RADIUS * CITY_MAP_MAX_RADIUS + 1)
 
#define CITY_MAP_CENTER_RADIUS_SQ   -1
 
#define CITY_MAP_CENTER_TILE_INDEX   0
 
#define CITY_MAP_MAX_SIZE   (CITY_MAP_MAX_RADIUS * 2 + 1)
 
#define INCITE_IMPOSSIBLE_COST   (1000 * 1000 * 1000)
 
#define MAX_CITY_SIZE   0xFF
 
#define CITY_REL2ABS(_coor)   (_coor + CITY_MAP_MAX_RADIUS)
 
#define CITY_ABS2REL(_coor)   (_coor - CITY_MAP_MAX_RADIUS)
 
#define city_map_tiles_from_city(_pcity)    city_map_tiles(city_map_radius_sq_get(_pcity))
 
#define city_map_iterate_outwards_radius_sq_index(_radius_sq_min, _radius_sq_max, _index, _x, _y)
 
#define city_map_iterate_outwards_radius_sq_index_end
 
#define city_map_iterate_outwards_radius_sq(_radius_sq_min, _radius_sq_max, _x, _y)
 
#define city_map_iterate_outwards_radius_sq_end
 
#define city_map_iterate(_radius_sq, _index, _x, _y)
 
#define city_map_iterate_end    city_map_iterate_outwards_radius_sq_index_end
 
#define city_map_iterate_without_index(_radius_sq, _x, _y)
 
#define city_map_iterate_without_index_end    city_map_iterate_outwards_radius_sq_end
 
#define city_map_iterate_radius_sq(_radius_sq_min, _radius_sq_max, _x, _y)
 
#define city_map_iterate_radius_sq_end    city_map_iterate_outwards_radius_sq_end
 
#define city_tile_iterate_index(_nmap, _radius_sq, _city_tile, _tile, _index)
 
#define city_tile_iterate_index_end
 
#define city_tile_iterate_skip_free_worked(_nmap, _radius_sq, _city_tile, _tile, _index, _x, _y)
 
#define city_tile_iterate_skip_free_worked_end
 
#define city_tile_iterate(_nmap, _radius_sq, _city_tile, _tile)
 
#define city_tile_iterate_end
 
#define I_NEVER   (-1) /* Improvement never built */
 
#define I_DESTROYED   (-2) /* Improvement built and destroyed */
 
#define SPECLIST_TAG   city
 
#define SPECLIST_TYPE   struct city
 
#define city_list_iterate(citylist, pcity)    TYPED_LIST_ITERATE(struct city, citylist, pcity)
 
#define city_list_iterate_end   LIST_ITERATE_END
 
#define cities_iterate(pcity)
 
#define cities_iterate_end
 
#define city_list_iterate_safe(citylist, _city)
 
#define city_list_iterate_safe_end
 
#define city_owner(_pcity_)   (_pcity_)->owner
 
#define city_tile(_pcity_)   (_pcity_)->tile
 
#define city_built_iterate(_pcity, _p)
 
#define city_built_iterate_end    } improvement_iterate_end;
 
#define output_type_iterate(output)
 
#define output_type_iterate_end
 
#define is_free_worked_index(city_tile_index)    (CITY_MAP_CENTER_TILE_INDEX == city_tile_index)
 
#define FREE_WORKED_TILES   (1)
 

Enumerations

enum  production_class_type { PCT_UNIT , PCT_NORMAL_IMPROVEMENT , PCT_WONDER , PCT_LAST }
 
enum  output_unhappy_penalty { UNHAPPY_PENALTY_NONE , UNHAPPY_PENALTY_SURPLUS , UNHAPPY_PENALTY_ALL_PRODUCTION }
 
enum  citizen_category {
  CITIZEN_HAPPY , CITIZEN_CONTENT , CITIZEN_UNHAPPY , CITIZEN_ANGRY ,
  CITIZEN_LAST , CITIZEN_SPECIALIST = CITIZEN_LAST
}
 
enum  citizen_feeling {
  FEELING_BASE , FEELING_LUXURY , FEELING_EFFECT , FEELING_NATIONALITY ,
  FEELING_MARTIAL , FEELING_FINAL , FEELING_LAST
}
 
enum  output_loss { OLOSS_WASTE , OLOSS_SIZE , OLOSS_LAST }
 
enum  city_updates { CU_NO_UPDATE = 0 , CU_UPDATE_REPORT = 1 << 0 , CU_UPDATE_DIALOG = 1 << 1 , CU_POPUP_DIALOG = 1 << 2 }
 
enum  city_needs_arrange { CNA_NOT = 0 , CNA_NORMAL , CNA_BROADCAST_PENDING }
 

Functions

bool city_tile_index_to_xy (int *city_map_x, int *city_map_y, int city_tile_index, int city_radius_sq)
 
int city_tile_xy_to_index (int city_map_x, int city_map_y, int city_radius_sq)
 
int rs_max_city_radius_sq (void)
 
int city_map_radius_sq_get (const struct city *pcity)
 
void city_map_radius_sq_set (struct city *pcity, int radius_sq)
 
int city_map_tiles (int city_radius_sq)
 
void citylog_map_data (enum log_level level, int radius_sq, int *map_data)
 
void citylog_map_workers (enum log_level level, struct city *pcity)
 
const char * get_output_identifier (Output_type_id output)
 
const char * get_output_name (Output_type_id output)
 
struct output_typeget_output_type (Output_type_id output)
 
Output_type_id output_type_by_identifier (const char *id)
 
void add_specialist_output (const struct city *pcity, int *output)
 
void set_city_production (struct city *pcity)
 
const char * city_name_get (const struct city *pcity)
 
void city_name_set (struct city *pcity, const char *new_name)
 
static citizens city_size_get (const struct city *pcity)
 
void city_size_add (struct city *pcity, int add)
 
void city_size_set (struct city *pcity, citizens size)
 
citizens city_specialists (const struct city *pcity)
 
citizens player_content_citizens (const struct player *pplayer)
 
citizens player_angry_citizens (const struct player *pplayer)
 
int city_population (const struct city *pcity)
 
int city_total_impr_gold_upkeep (const struct city *pcity)
 
int city_total_unit_gold_upkeep (const struct city *pcity)
 
int city_unit_unhappiness (const struct civ_map *nmap, struct unit *punit, int *free_unhappy)
 
bool city_happy (const struct city *pcity)
 
bool city_unhappy (const struct city *pcity)
 
bool base_city_celebrating (const struct city *pcity)
 
bool city_celebrating (const struct city *pcity)
 
bool city_rapture_grow (const struct city *pcity)
 
bool city_is_occupied (const struct city *pcity)
 
int city_improvement_upkeep (const struct city *pcity, const struct impr_type *pimprove)
 
bool can_city_build_improvement_direct (const struct city *pcity, const struct impr_type *pimprove)
 
bool can_city_build_improvement_later (const struct city *pcity, const struct impr_type *pimprove)
 
bool can_city_build_improvement_now (const struct city *pcity, const struct impr_type *pimprove)
 
bool can_city_build_unit_direct (const struct civ_map *nmap, const struct city *pcity, const struct unit_type *punittype)
 
bool can_city_build_unit_later (const struct civ_map *nmap, const struct city *pcity, const struct unit_type *punittype)
 
bool can_city_build_unit_now (const struct civ_map *nmap, const struct city *pcity, const struct unit_type *punittype)
 
bool can_city_build_direct (const struct civ_map *nmap, const struct city *pcity, const struct universal *target)
 
bool can_city_build_later (const struct civ_map *nmap, const struct city *pcity, const struct universal *target)
 
bool can_city_build_now (const struct civ_map *nmap, const struct city *pcity, const struct universal *target)
 
int city_unit_slots_available (const struct city *pcity)
 
bool city_can_use_specialist (const struct city *pcity, Specialist_type_id type)
 
bool city_has_building (const struct city *pcity, const struct impr_type *pimprove)
 
bool is_capital (const struct city *pcity)
 
bool is_gov_center (const struct city *pcity)
 
bool city_got_defense_effect (const struct city *pcity, const struct unit_type *attacker)
 
int city_production_build_shield_cost (const struct city *pcity)
 
bool city_production_build_units (const struct city *pcity, bool add_production, int *num_units)
 
int city_production_unit_veteran_level (struct city *pcity, const struct unit_type *punittype)
 
bool city_production_has_flag (const struct city *pcity, enum impr_flag_id flag)
 
int city_production_turns_to_build (const struct city *pcity, bool include_shield_stock)
 
bool city_production_gets_caravan_shields (const struct universal *tgt)
 
int city_change_production_penalty (const struct city *pcity, const struct universal *target)
 
int city_turns_to_build (const struct city *pcity, const struct universal *target, bool include_shield_stock)
 
int city_turns_to_grow (const struct city *pcity)
 
bool city_can_grow_to (const struct city *pcity, int pop_size)
 
bool city_can_change_build (const struct city *pcity)
 
void city_choose_build_default (const struct civ_map *nmap, struct city *pcity)
 
const char * city_improvement_name_translation (const struct city *pcity, const struct impr_type *pimprove)
 
const char * city_production_name_translation (const struct city *pcity)
 
bool is_valid_city_coords (const int city_radius_sq, const int city_map_x, const int city_map_y)
 
bool city_map_includes_tile (const struct city *const pcity, const struct tile *map_tile)
 
bool city_base_to_city_map (int *city_map_x, int *city_map_y, const struct city *const pcity, const struct tile *map_tile)
 
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)
 
struct tilecity_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)
 
int compare_iter_index (const void *a, const void *b)
 
void generate_city_map_indices (void)
 
void free_city_map_index (void)
 
void city_production_caravan_shields_init (void)
 
int city_tile_output (const struct city *pcity, const struct tile *ptile, bool is_celebrating, Output_type_id otype)
 
int city_tile_output_now (const struct city *pcity, const struct tile *ptile, Output_type_id otype)
 
bool base_city_can_work_tile (const struct player *restriction, const struct city *pcity, const struct tile *ptile)
 
bool city_can_work_tile (const struct city *pcity, const struct tile *ptile)
 
bool citymindist_prevents_city_on_tile (const struct civ_map *nmap, const struct tile *ptile)
 
bool city_can_be_built_here (const struct civ_map *nmap, const struct tile *ptile, const struct unit *punit, bool hut_test)
 
bool city_can_be_built_tile_only (const struct civ_map *nmap, const struct tile *ptile)
 
struct citycity_list_find_number (struct city_list *This, int id)
 
struct citycity_list_find_name (struct city_list *This, const char *name)
 
int city_name_compare (const void *p1, const void *p2)
 
const char * city_style_rule_name (const int style)
 
const char * city_style_name_translation (const int style)
 
int city_style_by_rule_name (const char *s)
 
int city_style_by_translated_name (const char *s)
 
struct citytile_enemy_city (const struct tile *ptile, const struct player *pplayer)
 
static bool is_enemy_city_tile (const struct tile *ptile, const struct player *pplayer)
 
struct citytile_allied_city (const struct tile *ptile, const struct player *pplayer)
 
static bool is_allied_city_tile (const struct tile *ptile, const struct player *pplayer)
 
struct citytile_non_attack_city (const struct tile *ptile, const struct player *pplayer)
 
static bool is_non_attack_city_tile (const struct tile *ptile, const struct player *pplayer)
 
struct citytile_non_allied_city (const struct tile *ptile, const struct player *pplayer)
 
static bool is_non_allied_city_tile (const struct tile *ptile, const struct player *pplayer)
 
bool is_unit_near_a_friendly_city (const struct civ_map *nmap, const struct unit *punit)
 
bool is_friendly_city_near (const struct civ_map *nmap, const struct player *owner, const struct tile *ptile)
 
bool city_exists_within_max_city_map (const struct civ_map *nmap, const struct tile *ptile, bool may_be_on_center)
 
int city_granary_size (int city_size)
 
void city_add_improvement (struct city *pcity, const struct impr_type *pimprove)
 
void city_remove_improvement (struct city *pcity, const struct impr_type *pimprove)
 
void city_refresh_from_main_map (const struct civ_map *nmap, struct city *pcity, bool *workers_map)
 
int city_waste (const struct city *pcity, Output_type_id otype, int total, int *breakdown)
 
Specialist_type_id best_specialist (Output_type_id otype, const struct city *pcity)
 
int get_final_city_output_bonus (const struct city *pcity, Output_type_id otype)
 
bool city_built_last_turn (const struct city *pcity)
 
struct citycreate_city_virtual (struct player *pplayer, struct tile *ptile, const char *name)
 
void destroy_city_virtual (struct city *pcity)
 
bool city_is_virtual (const struct city *pcity)
 
bool is_city_option_set (const struct city *pcity, enum city_options option)
 
void city_styles_alloc (int num)
 
void city_styles_free (void)
 
void add_tax_income (const struct player *pplayer, int trade, int *output)
 
int get_city_tithes_bonus (const struct city *pcity)
 
int city_pollution_types (const struct city *pcity, int shield_total, int *pollu_prod, int *pollu_pop, int *pollu_mod)
 
int city_pollution (const struct city *pcity, int shield_total)
 
int city_illness_calc (const struct city *pcity, int *ill_base, int *ill_size, int *ill_trade, int *ill_pollution)
 
bool city_had_recent_plague (const struct city *pcity)
 
int city_build_slots (const struct city *pcity)
 
int city_airlift_max (const struct city *pcity)
 
bool city_exist (int id)
 
static bool is_city_center (const struct city *pcity, const struct tile *ptile)
 
bool is_free_worked (const struct city *pcity, const struct tile *ptile)
 
void * city_ai_data (const struct city *pcity, const struct ai_type *ai)
 
void city_set_ai_data (struct city *pcity, const struct ai_type *ai, void *data)
 
void city_rally_point_clear (struct city *pcity)
 
void city_rally_point_receive (const struct packet_city_rally_point *packet, struct city *pcity) fc__attribute((nonnull(1)))
 

Variables

struct citystylecity_styles
 
const Output_type_id num_output_types
 
struct output_type output_types []
 

Macro Definition Documentation

◆ cities_iterate

#define cities_iterate (   pcity)
Value:
{ \
players_iterate(pcity##_player) { \
city_list_iterate(pcity##_player->cities, pcity) {

Definition at line 492 of file city.h.

◆ cities_iterate_end

#define cities_iterate_end
Value:
}
#define city_list_iterate_end
Definition city.h:490
#define players_iterate_end
Definition player.h:535

Definition at line 497 of file city.h.

◆ CITY_ABS2REL

#define CITY_ABS2REL (   _coor)    (_coor - CITY_MAP_MAX_RADIUS)

Definition at line 108 of file city.h.

◆ city_built_iterate

#define city_built_iterate (   _pcity,
  _p 
)
Value:
if ((_pcity)->built[improvement_index(_p)].turn <= I_NEVER) { \
continue; \
}
#define I_NEVER
Definition city.h:239
Impr_type_id improvement_index(const struct impr_type *pimprove)
#define improvement_iterate(_p)

Definition at line 810 of file city.h.

◆ city_built_iterate_end

#define city_built_iterate_end    } improvement_iterate_end;

Definition at line 816 of file city.h.

◆ city_list_iterate

#define city_list_iterate (   citylist,
  pcity 
)     TYPED_LIST_ITERATE(struct city, citylist, pcity)

Definition at line 488 of file city.h.

◆ city_list_iterate_end

#define city_list_iterate_end   LIST_ITERATE_END

Definition at line 490 of file city.h.

◆ city_list_iterate_safe

#define city_list_iterate_safe (   citylist,
  _city 
)
Value:
{ \
struct city_list *_city##_cl = citylist; \
int _city##_size = city_list_size(_city##_cl); \
\
if (_city##_size > 0) { \
int _city##_numbers[_city##_size]; \
int _city##_index; \
\
_city##_size = 0; \
city_list_iterate(_city##_cl, _city) { \
_city##_numbers[_city##_size++] = _city->id; \
\
for (_city##_index = 0; \
_city##_index < _city##_size; \
_city##_index++) { \
struct city *_city = \
game_city_by_number(_city##_numbers[_city##_index]); \
\
if (NULL != _city) {
Definition city.h:309

Definition at line 502 of file city.h.

◆ city_list_iterate_safe_end

#define city_list_iterate_safe_end
Value:
} \
} \
} \
}

Definition at line 524 of file city.h.

◆ CITY_MAP_CENTER_RADIUS_SQ

#define CITY_MAP_CENTER_RADIUS_SQ   -1

Definition at line 81 of file city.h.

◆ CITY_MAP_CENTER_TILE_INDEX

#define CITY_MAP_CENTER_TILE_INDEX   0

Definition at line 83 of file city.h.

◆ CITY_MAP_DEFAULT_RADIUS

#define CITY_MAP_DEFAULT_RADIUS   2

Definition at line 70 of file city.h.

◆ CITY_MAP_DEFAULT_RADIUS_SQ

#define CITY_MAP_DEFAULT_RADIUS_SQ    (CITY_MAP_DEFAULT_RADIUS * CITY_MAP_DEFAULT_RADIUS + 1)

Definition at line 74 of file city.h.

◆ city_map_iterate

#define city_map_iterate (   _radius_sq,
  _index,
  _x,
  _y 
)
Value:
_radius_sq, _index, _x, _y)
#define CITY_MAP_CENTER_RADIUS_SQ
Definition city.h:81
#define city_map_iterate_outwards_radius_sq_index(_radius_sq_min, _radius_sq_max, _index, _x, _y)
Definition city.h:129

Definition at line 165 of file city.h.

◆ city_map_iterate_end

#define city_map_iterate_end    city_map_iterate_outwards_radius_sq_index_end

Definition at line 169 of file city.h.

◆ city_map_iterate_outwards_radius_sq

#define city_map_iterate_outwards_radius_sq (   _radius_sq_min,
  _radius_sq_max,
  _x,
  _y 
)
Value:
{ \
fc_assert(_radius_sq_min <= _radius_sq_max); \
int _x = 0, _y = 0; \
int _x##_y##_index = city_map_tiles(_radius_sq_min); \
while (city_tile_index_to_xy(&_x, &_y, _x##_y##_index, \
_radius_sq_max)) { \
_x##_y##_index++;
bool city_tile_index_to_xy(int *city_map_x, int *city_map_y, int city_tile_index, int city_radius_sq)
Definition city.c:96
int city_map_tiles(int city_radius_sq)
Definition city.c:166

Definition at line 146 of file city.h.

◆ city_map_iterate_outwards_radius_sq_end

#define city_map_iterate_outwards_radius_sq_end
Value:
} \
}

Definition at line 157 of file city.h.

◆ city_map_iterate_outwards_radius_sq_index

#define city_map_iterate_outwards_radius_sq_index (   _radius_sq_min,
  _radius_sq_max,
  _index,
  _x,
  _y 
)
Value:
{ \
fc_assert(_radius_sq_min <= _radius_sq_max); \
int _x = 0, _y = 0, _index; \
int _x##_y##_index = city_map_tiles(_radius_sq_min); \
while (city_tile_index_to_xy(&_x, &_y, _x##_y##_index, \
_radius_sq_max)) { \
_index = _x##_y##_index; \
_x##_y##_index++;

Definition at line 129 of file city.h.

◆ city_map_iterate_outwards_radius_sq_index_end

#define city_map_iterate_outwards_radius_sq_index_end
Value:
} \
}

Definition at line 141 of file city.h.

◆ city_map_iterate_radius_sq

#define city_map_iterate_radius_sq (   _radius_sq_min,
  _radius_sq_max,
  _x,
  _y 
)
Value:
city_map_iterate_outwards_radius_sq(_radius_sq_min, _radius_sq_max, \
_x, _y)
#define city_map_iterate_outwards_radius_sq(_radius_sq_min, _radius_sq_max, _x, _y)
Definition city.h:146

Definition at line 180 of file city.h.

◆ city_map_iterate_radius_sq_end

#define city_map_iterate_radius_sq_end    city_map_iterate_outwards_radius_sq_end

Definition at line 185 of file city.h.

◆ city_map_iterate_without_index

#define city_map_iterate_without_index (   _radius_sq,
  _x,
  _y 
)
Value:

Definition at line 172 of file city.h.

◆ city_map_iterate_without_index_end

#define city_map_iterate_without_index_end    city_map_iterate_outwards_radius_sq_end

Definition at line 176 of file city.h.

◆ CITY_MAP_MAX_RADIUS

#define CITY_MAP_MAX_RADIUS   5

Definition at line 71 of file city.h.

◆ CITY_MAP_MAX_RADIUS_SQ

#define CITY_MAP_MAX_RADIUS_SQ    (CITY_MAP_MAX_RADIUS * CITY_MAP_MAX_RADIUS + 1)

Definition at line 78 of file city.h.

◆ CITY_MAP_MAX_SIZE

#define CITY_MAP_MAX_SIZE   (CITY_MAP_MAX_RADIUS * 2 + 1)

Definition at line 86 of file city.h.

◆ CITY_MAP_MIN_RADIUS

#define CITY_MAP_MIN_RADIUS   0

Definition at line 69 of file city.h.

◆ CITY_MAP_MIN_RADIUS_SQ

#define CITY_MAP_MIN_RADIUS_SQ    (CITY_MAP_MIN_RADIUS * CITY_MAP_MIN_RADIUS + 1)

Definition at line 76 of file city.h.

◆ city_map_tiles_from_city

#define city_map_tiles_from_city (   _pcity)     city_map_tiles(city_map_radius_sq_get(_pcity))

Definition at line 119 of file city.h.

◆ city_owner

#define city_owner (   _pcity_)    (_pcity_)->owner

Definition at line 543 of file city.h.

◆ CITY_REL2ABS

#define CITY_REL2ABS (   _coor)    (_coor + CITY_MAP_MAX_RADIUS)

Definition at line 107 of file city.h.

◆ city_tile

#define city_tile (   _pcity_)    (_pcity_)->tile

Definition at line 544 of file city.h.

◆ city_tile_iterate

#define city_tile_iterate (   _nmap,
  _radius_sq,
  _city_tile,
  _tile 
)
Value:
{ \
const struct tile *_center##_tile = _city_tile; \
city_map_iterate_outwards_radius_sq(CITY_MAP_CENTER_RADIUS_SQ, \
_radius_sq, _x, _y) \
struct tile *_tile = city_map_to_tile(_nmap, _center##_tile, _radius_sq, \
_x, _y); \
if (NULL != _tile) {
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)
Definition city.c:300
Definition tile.h:49

Definition at line 222 of file city.h.

◆ city_tile_iterate_end

#define city_tile_iterate_end
Value:
} \
#define city_map_iterate_outwards_radius_sq_end
Definition city.h:157

Definition at line 230 of file city.h.

◆ city_tile_iterate_index

#define city_tile_iterate_index (   _nmap,
  _radius_sq,
  _city_tile,
  _tile,
  _index 
)
Value:
{ \
city_map_iterate_outwards_radius_sq_index(CITY_MAP_CENTER_RADIUS_SQ, \
_radius_sq, _index, _x, _y) \
struct tile *_tile = city_map_to_tile(_nmap, _city_tile, _radius_sq, \
_x, _y); \
if (NULL != _tile) {

Definition at line 193 of file city.h.

◆ city_tile_iterate_index_end

#define city_tile_iterate_index_end
Value:
} \
#define city_map_iterate_outwards_radius_sq_index_end
Definition city.h:141

Definition at line 201 of file city.h.

◆ city_tile_iterate_skip_free_worked

#define city_tile_iterate_skip_free_worked (   _nmap,
  _radius_sq,
  _city_tile,
  _tile,
  _index,
  _x,
  _y 
)
Value:
{ \
city_map_iterate(_radius_sq, _index, _x, _y) { \
if (!is_free_worked_index(_index)) { \
struct tile *_tile = city_map_to_tile(_nmap, _city_tile, _radius_sq, \
_x, _y); \
if (NULL != _tile) {
#define is_free_worked_index(city_tile_index)
Definition city.h:856

Definition at line 206 of file city.h.

◆ city_tile_iterate_skip_free_worked_end

#define city_tile_iterate_skip_free_worked_end
Value:
} \
} \
}
#define city_map_iterate_end
Definition city.h:169

Definition at line 214 of file city.h.

◆ FREE_WORKED_TILES

#define FREE_WORKED_TILES   (1)

Definition at line 858 of file city.h.

◆ I_DESTROYED

#define I_DESTROYED   (-2) /* Improvement built and destroyed */

Definition at line 240 of file city.h.

◆ I_NEVER

#define I_NEVER   (-1) /* Improvement never built */

Definition at line 239 of file city.h.

◆ INCITE_IMPOSSIBLE_COST

#define INCITE_IMPOSSIBLE_COST   (1000 * 1000 * 1000)

Definition at line 88 of file city.h.

◆ is_free_worked_index

#define is_free_worked_index (   city_tile_index)     (CITY_MAP_CENTER_TILE_INDEX == city_tile_index)

Definition at line 856 of file city.h.

◆ MAX_CITY_SIZE

#define MAX_CITY_SIZE   0xFF

Definition at line 98 of file city.h.

◆ output_type_iterate

#define output_type_iterate (   output)
Value:
{ \
Output_type_id output; \
\
for (output = 0; output < O_LAST; output++) {
@ O_LAST
Definition fc_types.h:91
enum output_type_id Output_type_id
Definition fc_types.h:348

Definition at line 821 of file city.h.

◆ output_type_iterate_end

#define output_type_iterate_end
Value:
} \
}

Definition at line 827 of file city.h.

◆ SPECENUM_BITVECTOR

#define SPECENUM_BITVECTOR   bv_city_options

Definition at line 64 of file city.h.

◆ SPECENUM_COUNT

#define SPECENUM_COUNT   CITYO_LAST

Definition at line 63 of file city.h.

◆ SPECENUM_NAME

#define SPECENUM_NAME   city_options

Definition at line 53 of file city.h.

◆ SPECENUM_VALUE0

#define SPECENUM_VALUE0   CITYO_DISBAND

Definition at line 55 of file city.h.

◆ SPECENUM_VALUE0NAME

#define SPECENUM_VALUE0NAME   "Disband"

Definition at line 56 of file city.h.

◆ SPECENUM_VALUE1

#define SPECENUM_VALUE1   CITYO_SCIENCE_SPECIALISTS

Definition at line 58 of file city.h.

◆ SPECENUM_VALUE1NAME

#define SPECENUM_VALUE1NAME   "Sci_Specialists"

Definition at line 59 of file city.h.

◆ SPECENUM_VALUE2

#define SPECENUM_VALUE2   CITYO_GOLD_SPECIALISTS

Definition at line 61 of file city.h.

◆ SPECENUM_VALUE2NAME

#define SPECENUM_VALUE2NAME   "Tax_Specialists"

Definition at line 62 of file city.h.

◆ SPECLIST_TAG

#define SPECLIST_TAG   city

Definition at line 484 of file city.h.

◆ SPECLIST_TYPE

#define SPECLIST_TYPE   struct city

Definition at line 485 of file city.h.

Enumeration Type Documentation

◆ citizen_category

Enumerator
CITIZEN_HAPPY 
CITIZEN_CONTENT 
CITIZEN_UNHAPPY 
CITIZEN_ANGRY 
CITIZEN_LAST 
CITIZEN_SPECIALIST 

Definition at line 259 of file city.h.

◆ citizen_feeling

Enumerator
FEELING_BASE 
FEELING_LUXURY 
FEELING_EFFECT 
FEELING_NATIONALITY 
FEELING_MARTIAL 
FEELING_FINAL 
FEELING_LAST 

Definition at line 270 of file city.h.

◆ city_needs_arrange

Enumerator
CNA_NOT 
CNA_NORMAL 
CNA_BROADCAST_PENDING 

Definition at line 297 of file city.h.

◆ city_updates

Enumerator
CU_NO_UPDATE 
CU_UPDATE_REPORT 
CU_UPDATE_DIALOG 
CU_POPUP_DIALOG 

Definition at line 290 of file city.h.

◆ output_loss

Enumerator
OLOSS_WASTE 
OLOSS_SIZE 
OLOSS_LAST 

Definition at line 281 of file city.h.

◆ output_unhappy_penalty

Enumerator
UNHAPPY_PENALTY_NONE 
UNHAPPY_PENALTY_SURPLUS 
UNHAPPY_PENALTY_ALL_PRODUCTION 

Definition at line 245 of file city.h.

◆ production_class_type

Enumerator
PCT_UNIT 
PCT_NORMAL_IMPROVEMENT 
PCT_WONDER 
PCT_LAST 

Definition at line 38 of file city.h.

Function Documentation

◆ add_specialist_output()

void add_specialist_output ( const struct city pcity,
int *  output 
)

Calculate output (gold, science, and luxury) generated by the specialists of a city. The output[] array is not cleared but is just added to.

Definition at line 2304 of file city.c.

Referenced by city_refresh_from_main_map(), and dai_city_want().

◆ add_tax_income()

void add_tax_income ( const struct player pplayer,
int  trade,
int *  output 
)

Add the incomes of a city according to the taxrates (ignore # of specialists). trade should be in output[O_TRADE].

Definition at line 2217 of file city.c.

Referenced by dai_city_want(), get_city_dialog_output_text(), and set_city_production().

◆ base_city_can_work_tile()

bool base_city_can_work_tile ( const struct player restriction,
const struct city pcity,
const struct tile ptile 
)

Returns TRUE when a tile is available to be worked, or the city itself is currently working the tile (and can continue).

The parameter 'restriction', which is usually client_player(), allow a player to handle with its real knownledge to guess it the work of this tile is possible.

This function shouldn't be called directly, but with city_can_work_tile() (common/city.[ch]) or client_city_can_work_tile() (client/climap.[ch]).

Definition at line 1377 of file city.c.

Referenced by city_can_work_tile(), and client_city_can_work_tile().

◆ base_city_celebrating()

bool base_city_celebrating ( const struct city pcity)

Return TRUE if the city was celebrating at the start of the turn, and it still has sufficient size to be in rapture.

Definition at line 1610 of file city.c.

Referenced by city_celebrating(), city_tile_cache_update(), compute_max_stats_heuristic(), compute_tile_production(), dai_city_want(), fill_city_overlays_sprite_array(), get_worked_tile_output(), max_tile_trade(), and min_food_surplus_for_fastest_growth().

◆ best_specialist()

Specialist_type_id best_specialist ( Output_type_id  otype,
const struct city pcity 
)

Return the "best" specialist available in the game. This specialist will have the most of the given type of output. If pcity is given then only specialists usable by pcity will be considered.

Definition at line 3247 of file city.c.

Referenced by city_increase_size().

◆ can_city_build_direct()

bool can_city_build_direct ( const struct civ_map nmap,
const struct city pcity,
const struct universal target 
)

Returns whether city can immediately build given target, unit or improvement. This considers obsolete targets still buildable.

Definition at line 972 of file city.c.

Referenced by base_city_queue_insert().

◆ can_city_build_improvement_direct()

bool can_city_build_improvement_direct ( const struct city pcity,
const struct impr_type pimprove 
)

Return whether given city can build given building, ignoring whether it is obsolete.

Definition at line 815 of file city.c.

Referenced by building_upgrades_to(), can_city_build_direct(), can_city_build_improvement_now(), and city_choose_build_default().

◆ can_city_build_improvement_later()

bool can_city_build_improvement_later ( const struct city pcity,
const struct impr_type pimprove 
)

Return whether player can eventually build given building in the city; returns FALSE if improvement can never possibly be built in this city.

Definition at line 856 of file city.c.

Referenced by ba_human_wants(), can_city_build_later(), collect_eventually_buildable_targets(), popup_worklist_editor(), and worklist_change_build_target().

◆ can_city_build_improvement_now()

bool can_city_build_improvement_now ( const struct city pcity,
const struct impr_type pimprove 
)

◆ can_city_build_later()

bool can_city_build_later ( const struct civ_map nmap,
const struct city pcity,
const struct universal target 
)

Returns whether city can ever build given target, unit or improvement.

Definition at line 1009 of file city.c.

Referenced by add_global_worklist(), base_city_queue_insert(), and set_global_worklist().

◆ can_city_build_now()

bool can_city_build_now ( const struct civ_map nmap,
const struct city pcity,
const struct universal target 
)

Returns whether city can immediately build given target, unit or improvement. This considers obsolete targets no longer buildable.

Definition at line 991 of file city.c.

Referenced by can_city_build_now_client(), city_dialog::change_production(), city_dialog_update_building(), city_worklist_commit(), client_change_all(), clipboard_send_production_packet(), city_widget::display_list_menu(), handle_city_change(), city_production_model::populate(), transfer_city(), and worklist_change_build_target().

◆ can_city_build_unit_direct()

bool can_city_build_unit_direct ( const struct civ_map nmap,
const struct city pcity,
const struct unit_type punittype 
)

Return whether given city can build given unit, ignoring whether unit is obsolete.

Definition at line 888 of file city.c.

Referenced by can_city_build_direct(), can_city_build_unit_now(), city_build_unit(), city_choose_build_default(), city_gold_worth(), process_attacker_want(), unit_upgrades_to(), and upgrade_unit_prod().

◆ can_city_build_unit_later()

bool can_city_build_unit_later ( const struct civ_map nmap,
const struct city pcity,
const struct unit_type punittype 
)

Returns whether player can eventually build given unit in the city; returns FALSE if unit can never possibly be built in this city.

Definition at line 948 of file city.c.

Referenced by can_city_build_later(), collect_eventually_buildable_targets(), dai_process_defender_want(), dai_wants_defender_against(), dai_wants_role_unit(), popup_worklist_editor(), and worklist_change_build_target().

◆ can_city_build_unit_now()

bool can_city_build_unit_now ( const struct civ_map nmap,
const struct city pcity,
const struct unit_type punittype 
)

◆ city_add_improvement()

void city_add_improvement ( struct city pcity,
const struct impr_type pimprove 
)

◆ city_ai_data()

void * city_ai_data ( const struct city pcity,
const struct ai_type ai 
)

Return pointer to ai data of given city and ai type.

Definition at line 3508 of file city.c.

Referenced by def_ai_city_data(), and texai_city_data().

◆ city_airlift_max()

int city_airlift_max ( const struct city pcity)

A city's maximum airlift capacity. (Note, this still returns a finite number even if airliftingstyle allows unlimited airlifts)

Definition at line 2844 of file city.c.

Referenced by get_airlift_text(), and update_city_activity().

◆ city_base_to_city_map()

bool city_base_to_city_map ( int *  city_map_x,
int *  city_map_y,
const struct city *const  pcity,
const struct tile map_tile 
)

Finds the city map coordinate for a given map position and a city. Returns whether the map position is inside of the city map.

Definition at line 276 of file city.c.

Referenced by adjust_workers_button_pressed(), base_city_can_work_tile(), city_map_includes_tile(), fill_city_overlays_sprite_array(), fill_grid_sprite_array(), fill_sprite_array(), and resolve_city_emergency().

◆ city_build_slots()

int city_build_slots ( const struct city pcity)

The maximum number of units a city can build per turn.

Definition at line 2834 of file city.c.

Referenced by city_dialog_update_building(), city_production_build_units(), city_production_cost_str(), and cr_entry_build_slots().

◆ city_built_last_turn()

bool city_built_last_turn ( const struct city pcity)

Return TRUE if the city built something last turn (meaning production was completed between last turn and this).

Definition at line 2251 of file city.c.

Referenced by city_change_production_penalty(), dai_city_choose_build(), and should_force_recalc().

◆ city_can_be_built_here()

bool city_can_be_built_here ( const struct civ_map nmap,
const struct tile ptile,
const struct unit punit,
bool  hut_test 
)

Returns TRUE if the given unit can build a city at the given map coordinates.

punit is the founding unit. It may be NULL if a city is built out of the blue (e.g., through editing).

Definition at line 1460 of file city.c.

Referenced by api_methods_unit_city_can_be_built_here(), city_desirability(), create_city_for_player(), dai_auto_settler_run(), find_city_or_settler_near_tile(), property_page_create_objects(), and unit_drawn_with_city_outline().

◆ city_can_be_built_tile_only()

bool city_can_be_built_tile_only ( const struct civ_map nmap,
const struct tile ptile 
)

Returns TRUE if the given unit can build a city at the given map coordinates.

It may still be illegal for any unit to build a city at the specified tile.

Definition at line 1533 of file city.c.

Referenced by city_can_be_built_here().

◆ city_can_change_build()

bool city_can_change_build ( const struct city pcity)

Returns TRUE iff the given city can change what it is building

Definition at line 1057 of file city.c.

Referenced by city_build_unit(), city_set_queue(), and handle_city_change().

◆ city_can_grow_to()

bool city_can_grow_to ( const struct city pcity,
int  pop_size 
)

Return TRUE iff the city can grow to the given size.

Definition at line 1985 of file city.c.

Referenced by city_increase_size(), city_turn_notify(), dai_effect_value(), dai_manage_taxes(), do_city_migration(), expl_act_not_enabl(), and is_action_possible().

◆ city_can_use_specialist()

bool city_can_use_specialist ( const struct city pcity,
Specialist_type_id  type 
)

Returns TRUE iff the given city can use this kind of specialist.

Definition at line 1043 of file city.c.

Referenced by best_specialist(), city_rotate_specialist(), handle_city_change_specialist(), and init_specialist_lattice_nodes().

◆ city_can_work_tile()

bool city_can_work_tile ( const struct city pcity,
const struct tile ptile 
)

◆ city_celebrating()

bool city_celebrating ( const struct city pcity)

◆ city_change_production_penalty()

int city_change_production_penalty ( const struct city pcity,
const struct universal target 
)

Compute and optionally apply the change-production penalty for the given production change (to target) in the given city (pcity). Always returns the number of shields which would be in the stock if the penalty had been applied.

If we switch the "class" of the target sometime after a city has produced (i.e., not on the turn immediately after), then there's a shield loss. But only on the first switch that turn. Also, if ever change back to original improvement class of this turn, restore lost production.

Definition at line 1859 of file city.c.

Referenced by change_build_target(), change_production(), and city_turns_to_build().

◆ city_choose_build_default()

void city_choose_build_default ( const struct civ_map nmap,
struct city pcity 
)

Always tile_set_owner(ptile, pplayer) sometime before this!

Definition at line 1065 of file city.c.

Referenced by cityresult_fill(), and create_city().

◆ city_exist()

bool city_exist ( int  id)

◆ city_exists_within_max_city_map()

bool city_exists_within_max_city_map ( const struct civ_map nmap,
const struct tile ptile,
bool  may_be_on_center 
)

Return TRUE iff a city exists within a city radius of the given location. may_be_on_center determines if a city at x,y counts.

Definition at line 2084 of file city.c.

Referenced by api_methods_tile_city_exists_within_max_city_map(), and hut_get_limited().

◆ city_got_defense_effect()

bool city_got_defense_effect ( const struct city pcity,
const struct unit_type attacker 
)

This can be City Walls, Coastal defense... depending on attacker type. If attacker type is not given, just any defense effect will do.

Definition at line 1569 of file city.c.

Referenced by base_assess_defense_unit(), and dai_process_defender_want().

◆ city_granary_size()

int city_granary_size ( int  city_size)

◆ city_had_recent_plague()

bool city_had_recent_plague ( const struct city pcity)

Returns whether city had a plague outbreak this turn.

Definition at line 2825 of file city.c.

Referenced by city_populate().

◆ city_happy()

bool city_happy ( const struct city pcity)

Return TRUE iff the city is happy. A happy city will start celebrating soon. A city can only be happy if half or more of the population is happy, none of the population is unhappy or angry, and it has sufficient size.

Definition at line 1587 of file city.c.

Referenced by api_methods_is_city_happy(), city_celebrating(), city_dialog_update_title(), dai_manage_taxes(), get_city_surplus(), handle_city_info(), real_city_dialog_popup(), real_city_report_dialog_update_city(), real_info_city_report_dialog_update(), rebuild_citydlg_title_str(), redraw_city_dialog(), update_city_activity(), update_dumb_city(), and city_dialog::update_title().

◆ city_has_building()

bool city_has_building ( const struct city pcity,
const struct impr_type pimprove 
)

◆ city_illness_calc()

int city_illness_calc ( const struct city pcity,
int *  ill_base,
int *  ill_size,
int *  ill_trade,
int *  ill_pollution 
)

Calculate city's illness in tenth of percent:

base illness (the maximum value for illness in percent is given by 'game.info.illness_base_factor')

  • trade illness (see get_trade_illness())
  • pollution illness (the pollution in the city times 'game.info.illness_pollution_factor')

The illness is reduced by the percentage given by the health effect. Illness cannot exceed 999 (= 99.9%), or be less then 0

Definition at line 2772 of file city.c.

Referenced by city_dialog_update_information(), city_dialog_update_information(), city_illness_strike(), city_migration_score(), cr_entry_plague_risk(), get_city_dialog_illness_text(), redraw_info_city_dialog(), sg_load_players(), sg_load_players(), update_city_activity(), and city_dialog::update_info_label().

◆ city_improvement_name_translation()

const char * city_improvement_name_translation ( const struct city pcity,
const struct impr_type pimprove 
)

◆ city_improvement_upkeep()

int city_improvement_upkeep ( const struct city pcity,
const struct impr_type b 
)

Return the upkeep (gold) needed each turn to upkeep the given improvement in the given city.

Definition at line 1231 of file city.c.

Referenced by city_dialog_update_improvement_list(), city_total_impr_gold_upkeep(), dai_city_want(), get_city_dialog_production_row(), get_economy_report_data(), get_tooltip_improvement(), sell_random_building(), and city_dialog::update_improvements().

◆ city_is_occupied()

bool city_is_occupied ( const struct city pcity)

Returns TRUE iff the city is occupied.

Definition at line 1638 of file city.c.

Referenced by popup_info_text().

◆ city_is_virtual()

bool city_is_virtual ( const struct city pcity)

Return TRUE if the city is a virtual city. That is, it is a valid city pointer but does not correspond to a city that exists in the game.

NB: A return value of FALSE implies that either the pointer is NULL or that the city exists in the game.

Definition at line 3488 of file city.c.

Referenced by tile_virtual_destroy().

◆ city_list_find_name()

struct city * city_list_find_name ( struct city_list *  This,
const char *  name 
)

Find city with given name from list.

Definition at line 1668 of file city.c.

Referenced by game_city_by_name(), is_allowed_city_name(), and transfer_city().

◆ city_list_find_number()

struct city * city_list_find_number ( struct city_list *  This,
int  id 
)

Find city with given id from list.

Definition at line 1652 of file city.c.

Referenced by city_freeze_workers_queue(), city_refresh_queue_add(), and dai_goldequiv_clause().

◆ city_map_includes_tile()

bool city_map_includes_tile ( const struct city *const  pcity,
const struct tile map_tile 
)

Returns TRUE iff pcity's city map includes the specified tile.

Definition at line 288 of file city.c.

Referenced by handle_city_make_specialist(), and handle_city_make_worker().

◆ city_map_radius_sq_get()

int city_map_radius_sq_get ( const struct city pcity)

Returns the current squared radius of the city.

Definition at line 132 of file city.c.

Referenced by adv_city_update(), adv_city_worker_act_get(), adv_city_worker_act_set(), adv_city_worker_extra_get(), adv_city_worker_extra_set(), adv_city_worker_rmextra_get(), adv_city_worker_rmextra_set(), api_methods_city_map_sq_radius(), apply_cmresult_to_city(), apply_result_on_server(), apply_solution(), build_landarea_map(), button_down_citymap(), check_city_migrations_player(), city_base_to_city_map(), city_increase_size(), city_map_update_all(), city_map_update_radius_sq(), city_reduce_workers(), city_tc_effect_refresh(), city_tile_cache_get_output(), city_tile_cache_update(), city_toggle_worker(), citylog_map_workers(), citymap_turn_init(), cityresult_fill(), cm_print_city(), cm_result_new(), compute_max_stats_heuristic(), city_map::context_menu(), dai_city_want(), dai_effect_value(), do_city_migration(), game_remove_city(), get_worked_tile_output(), give_citymap_from_player_to_player(), handle_city_info(), handle_city_short_info(), handle_tile_info(), impr_provides_buildable_extras(), init_tile_lattice(), initialize_infrastructure_cache(), is_extra_req_active(), is_extraflag_req_active(), is_roadflag_req_active(), is_terrain_req_active(), is_terrainclass_req_active(), is_terrainflag_req_active(), is_tile_seen_city(), left_button_down_citymap(), map_claim_border(), max_tile_trade(), min_food_surplus_for_fastest_growth(), city_map::mousePressEvent(), place_pollution(), player_in_city_map(), resolve_city_emergency(), resource_map_city_dlg_callback(), right_button_down_citymap(), city_map::set_pixmap(), settler_evaluate_improvements(), tai_city_worker_task_select(), and texai_city_worker_task_select().

◆ city_map_radius_sq_set()

void city_map_radius_sq_set ( struct city pcity,
int  radius_sq 
)

Sets the squared radius for the city.

Definition at line 143 of file city.c.

Referenced by city_map_update_radius_sq(), handle_city_short_info(), handle_tile_info(), sg_load_player_city(), and sg_load_player_city().

◆ city_map_tiles()

int city_map_tiles ( int  city_radius_sq)

Return the number of tiles for the given city radius. Special case is the value -1 for no city tiles.

Definition at line 166 of file city.c.

Referenced by adv_city_update(), city_map_update_radius_sq(), city_tile_cache_update(), city_tile_index_to_xy(), citylog_map_workers(), cm_print_result(), cm_result_copy(), cm_result_new(), generate_city_map_indices(), max_tile_trade(), place_pollution(), and print_cityresult().

◆ city_map_to_tile()

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 
)

Finds the map position for a given city map coordinate of a certain city. Returns true if the map position found is real.

Definition at line 300 of file city.c.

Referenced by button_down_citymap(), city_map_update_radius_sq(), city_toggle_worker(), citylog_map_workers(), city_map::context_menu(), max_tile_trade(), min_food_surplus_for_fastest_growth(), place_pollution(), and right_button_down_citymap().

◆ city_name_compare()

int city_name_compare ( const void *  p1,
const void *  p2 
)

Comparison function for qsort for city pointers, sorting by city name. Args are really (struct city**), to sort an array of pointers. (Compare with old_city_name_compare() in game.c, which use city_id's)

Definition at line 1684 of file city.c.

Referenced by create_clause_menu(), popup_add_menu(), and popup_diplomatic_objects().

◆ city_name_get()

const char * city_name_get ( const struct city pcity)

Return the name of the city.

Definition at line 1115 of file city.c.

Referenced by adv_city_worker_act_set(), adv_city_worker_extra_set(), adv_city_worker_rmextra_set(), agents_city_changed(), agents_city_new(), agents_city_remove(), apply_disaster(), apply_result_on_server(), auto_arrange_workers(), caravan_optimize_callback(), change_build_target(), check_city_migrations_player(), choose_build_target(), cities_update_callback(), citizens_convert(), citizens_convert_conquest(), citizens_print(), city_build_unit(), city_choose_build_default(), city_dialog_update_title(), city_from_wonder(), city_link(), city_map_update_radius_sq(), city_migration_score(), city_packet_common(), city_reduce_size(), city_dialog::city_rename(), city_repair_size(), city_tile_link(), citylog_map_workers(), civil_war(), client_diplomacy_clause_string(), client_remove_city(), client_remove_unit(), cm_find_best_solution(), cm_print_city(), cm_state_init(), cma_put_city_under_agent(), cr_entry_cityname(), create_city_dialog(), create_clause_menu(), dai_action_value_unit_vs_city(), dai_airlift(), dai_auto_settler_run(), dai_caravan_goto(), dai_choose_attacker_air(), dai_choose_diplomat_defensive(), dai_choose_diplomat_offensive(), dai_choose_help_wonder(), dai_choose_paratrooper(), dai_city_choose_build(), dai_diplomat_city(), dai_find_strategic_airbase(), dai_goldequiv_clause(), dai_manage_airunit(), dai_manage_diplomat(), dai_manage_hitpoint_recovery(), dai_manage_paratrooper(), dai_manage_taxes(), dai_military_attack_barbarian(), dai_military_defend(), dai_process_defender_want(), dai_should_we_air_attack_tile(), debug_command(), define_orig_production_values(), diplomat_sabotage(), do_capture_units(), edit_buffer_copy(), explain_why_no_action_enabled(), goto_dialog::fill_tab(), find_best_tile_to_paradrop_to(), find_something_to_kill(), game_remove_city(), game_remove_unit(), get_city_citizen_types(), get_city_dialog_output_text(), get_city_mapview_name_and_growth(), get_nearest_city_text(), get_unit_info_label_text2(), handle_city(), handle_city_info(), handle_city_make_specialist(), handle_city_make_worker(), handle_tile_info(), handle_unit_packet_common(), idex_register_city(), idex_unregister_city(), illegal_action_msg(), kill_something_with(), list_store_append_player_cities(), look_for_charge(), plr_widget::nation_selected(), new_name_city_dlg_callback(), package_city(), place_pollution(), popup_action_selection(), popup_add_menu(), popup_advanced_terrain_dialog(), popup_city_cma_dialog(), popup_diplomatic_objects(), popup_find_dialog(), popup_incite_dialog(), popup_incite_dialog(), popup_info_text(), popup_worklist_editor(), process_attacker_want(), rally_set_tile(), real_bodyguard_log(), real_city_dialog_popup(), real_city_log(), real_info_city_report_dialog_update(), real_menus_update(), really_handle_city_buy(), rebuild_citydlg_title_str(), redraw_info_city_dialog(), redraw_unit_info_label(), refresh_city_names(), rename_callback(), report_top_five_cities(), report_wonders_of_the_world(), resolve_city_emergency(), send_player_cities(), sg_load_player_city(), sg_load_player_city(), sg_load_player_city_citizens(), sg_load_player_city_citizens(), sg_save_player_cities(), show_city_descriptions(), teleport_unit_to_city(), text_tag_initv(), text_tag_replace_text(), text_tag_start_sequence(), throw_units_from_illegal_cities(), tile_set_terrain(), transfer_city(), transfer_city_units(), transfer_unit(), try_summon_barbarians(), unit_description(), hud_units::update_actions(), update_dumb_city(), update_find_dialog(), update_goto_dialog(), update_intel_dialog(), update_intel_wonder_dialog(), update_source_label(), city_dialog::update_title(), usdlg_get_unit_descr(), vision_site_new_from_city(), vision_site_update_from_city(), and want_tech_for_improvement_effect().

◆ city_name_set()

void city_name_set ( struct city pcity,
const char *  new_name 
)

◆ city_pollution()

int city_pollution ( const struct city pcity,
int  shield_total 
)

Calculate pollution for the city. The shield_total must be passed in (most callers will want to pass pcity->shield_prod).

Definition at line 2723 of file city.c.

Referenced by city_refresh_from_main_map(), and dai_city_want().

◆ city_pollution_types()

int city_pollution_types ( const struct city pcity,
int  shield_total,
int *  pollu_prod,
int *  pollu_pop,
int *  pollu_mod 
)

Calculate the pollution from production and population in the city.

Definition at line 2689 of file city.c.

Referenced by city_pollution(), and get_city_dialog_pollution_text().

◆ city_population()

int city_population ( const struct city pcity)

Returns how many thousand citizen live in this city.

Definition at line 1169 of file city.c.

Referenced by calc_civ_score(), city_dialog_update_title(), civ_population(), popup_city_cma_dialog(), rebuild_citydlg_title_str(), and city_dialog::update_title().

◆ city_production_build_shield_cost()

int city_production_build_shield_cost ( const struct city pcity)

◆ city_production_build_units()

bool city_production_build_units ( const struct city pcity,
bool  add_production,
int *  num_units 
)

Return TRUE if the city could use the additional build slots provided by the effect City_Build_Slots. Within 'num_units' the total number of units the city can build considering the current shield stock is returned.

Definition at line 732 of file city.c.

Referenced by city_build_unit(), city_production_cost_str(), get_units_report_data(), units_report_update(), and units_reports::update_units().

◆ city_production_caravan_shields_init()

void city_production_caravan_shields_init ( void  )

Initialize the cache of what city production can use shields from caravans.

Definition at line 1751 of file city.c.

Referenced by handle_rulesets_ready(), and load_rulesetdir().

◆ city_production_gets_caravan_shields()

bool city_production_gets_caravan_shields ( const struct universal tgt)

Returns TRUE iff the specified production should get shields from units that has done ACTION_HELP_WONDER.

Definition at line 1833 of file city.c.

Referenced by city_change_production_penalty(), dai_choose_help_wonder(), dai_manage_caravan(), unit_do_help_build(), and wonder_benefit().

◆ city_production_has_flag()

bool city_production_has_flag ( const struct city pcity,
enum impr_flag_id  flag 
)

◆ city_production_name_translation()

const char * city_production_name_translation ( const struct city pcity)

◆ city_production_turns_to_build()

int city_production_turns_to_build ( const struct city pcity,
bool  include_shield_stock 
)

Calculates the turns which are needed to build the requested production in the city. GUI Independent.

Definition at line 805 of file city.c.

Referenced by city_global_turn_notify(), cr_entry_build_cost(), get_city_dialog_production(), get_city_mapview_production(), get_units_report_data(), popup_worklist_editor(), real_city_report_dialog_update_city(), real_info_city_report_dialog_update(), and redraw_city_dialog().

◆ city_production_unit_veteran_level()

int city_production_unit_veteran_level ( struct city pcity,
const struct unit_type punittype 
)

◆ city_rally_point_clear()

void city_rally_point_clear ( struct city pcity)

Clear rally point set for the city.

Definition at line 3525 of file city.c.

Referenced by city_build_unit(), destroy_city_virtual(), and transfer_city().

◆ city_rally_point_receive()

void city_rally_point_receive ( const struct packet_city_rally_point packet,
struct city pcity 
)

Fill city rally point from a packet.

Definition at line 3540 of file city.c.

Referenced by handle_city_rally_point(), and handle_city_rally_point().

◆ city_rapture_grow()

bool city_rapture_grow ( const struct city pcity)

Returns whether city is growing by rapture.

Definition at line 1626 of file city.c.

Referenced by city_increase_size(), and city_populate().

◆ city_refresh_from_main_map()

void city_refresh_from_main_map ( const struct civ_map nmap,
struct city pcity,
bool workers_map 
)

Refreshes the internal cached data in the city structure.

!full_refresh will not update tile_cache[] or bonus[]. These two values do not need to be recalculated for AI CMA testing.

'workers_map' is an boolean array which defines the placement of the workers within the city map. It uses the tile index and its size is defined by city_map_tiles_from_city(_pcity). See also cm_state_init().

If 'workers_map' is set, only basic updates are needed.

Definition at line 3070 of file city.c.

Referenced by apply_solution(), city_refresh(), cm_query_result(), and dai_manage_taxes().

◆ city_remove_improvement()

void city_remove_improvement ( struct city pcity,
const struct impr_type pimprove 
)

◆ city_set_ai_data()

void city_set_ai_data ( struct city pcity,
const struct ai_type ai,
void *  data 
)

Attach ai data to city

Definition at line 3516 of file city.c.

Referenced by dai_city_alloc(), dai_city_free(), texai_city_alloc(), and texai_city_free().

◆ city_size_add()

void city_size_add ( struct city pcity,
int  add 
)

Add a (positive or negative) value to the city size. As citizens is an unsigned value use int for the parameter 'add'.

Definition at line 1142 of file city.c.

Referenced by city_add_unit(), city_increase_size(), city_reduce_size(), cityresult_fill(), and handle_city_info().

◆ city_size_get()

static citizens city_size_get ( const struct city pcity)
inlinestatic

Get the city size.

Definition at line 549 of file city.h.

Referenced by achievement_check(), add_workers(), api_methods_city_inspire_partisans(), api_methods_city_size_get(), apply_result_on_server(), apply_solution(), base_city_celebrating(), begin_search(), calculate_want_for_paratrooper(), citizen_base_mood(), citizens_callback(), citizens_callback(), citizens_convert(), citizens_convert_conquest(), citizens_count(), citizens_print(), citizens_update(), city_build_unit(), city_change_size(), city_desirability(), city_dialog_update_information(), city_dialog_update_information(), city_gold_worth(), city_happy(), city_illness_calc(), city_incite_cost(), city_increase_size(), city_map_update_radius_sq(), city_migration_score(), city_pollution_types(), city_populate(), city_population(), city_reduce_size(), city_refresh_after_city_size_increase(), city_repair_size(), city_size_add(), city_support(), city_turn_notify(), city_turns_to_grow(), city_waste(), clean_lattice(), cm_print_city(), cm_state_init(), cmafec_get_result_descr(), compute_max_stats_heuristic(), contemplate_terrain_improvements(), cr_entry_growturns(), cr_entry_size(), dai_effect_value(), dai_manage_cities(), dai_manage_taxes(), dai_spend_gold(), dai_war_desire(), debug_command(), diplomat_incite(), do_attack(), do_city_migration(), do_nuke_tile(), edit_buffer_copy(), expl_act_not_enabl(), fill_sprite_array(), find_best_tile_to_paradrop_to(), get_city_citizen_types(), get_city_growth_string(), get_trade_illness(), handle_city_info(), handle_city_nationalities(), handle_edit_city(), is_action_possible(), is_minforeignpct_req_active(), is_minsize_req_active(), min_food_surplus_for_fastest_growth(), objbind_get_allowed_value_span(), objbind_get_value_from_object(), objbind_pack_current_values(), package_city(), paste_tile(), popup_find_dialog(), real_city_log(), real_city_report_dialog_update_city(), real_info_city_report_dialog_update(), redraw_city_dialog(), report_top_five_cities(), set_default_city_manager(), sg_load_player_city(), sg_load_player_city(), sg_load_player_city_citizens(), sg_load_player_city_citizens(), sg_save_player_cities(), show_full_citybar(), tile_border_source_radius_sq(), tile_border_source_strength(), trade_base_between_cities(), unit_bombard(), unit_conquer_city(), unit_foodbox_cost(), update_city_cma_dialog(), update_dumb_city(), update_goto_dialog(), city_dialog::update_info_label(), vision_site_new_from_city(), and vision_site_update_from_city().

◆ city_size_set()

void city_size_set ( struct city pcity,
citizens  size 
)

◆ city_specialists()

citizens city_specialists ( const struct city pcity)

◆ city_style_by_rule_name()

int city_style_by_rule_name ( const char *  s)

Returns the city style that has the given (untranslated) rule name. Returns -1 if none match.

Definition at line 1711 of file city.c.

Referenced by sg_load_player_city(), sg_load_player_city(), sg_load_player_vision_city(), and sg_load_player_vision_city().

◆ city_style_by_translated_name()

int city_style_by_translated_name ( const char *  s)

Returns the city style that has the given (translated) name. Returns -1 if none match.

Definition at line 1694 of file city.c.

◆ city_style_name_translation()

const char * city_style_name_translation ( const int  style)

Return the (translated) name of the given city style. You don't have to free the return pointer.

Definition at line 1729 of file city.c.

Referenced by city_style_by_translated_name(), and create_races_dialog().

◆ city_style_rule_name()

const char * city_style_rule_name ( const int  style)

Return the (untranslated) rule name of the city style. You don't have to free the return pointer.

Definition at line 1738 of file city.c.

Referenced by city_style_by_rule_name(), is_universal_needed(), load_ruleset_styles(), sanity_check_ruleset_data(), sg_save_player_cities(), sg_save_player_vision(), and tileset_setup_city_tiles().

◆ city_styles_alloc()

void city_styles_alloc ( int  num)

Allocate memory for this amount of city styles.

Definition at line 3309 of file city.c.

Referenced by handle_ruleset_control(), and load_style_names().

◆ city_styles_free()

void city_styles_free ( void  )

De-allocate the memory used by the city styles.

Definition at line 3324 of file city.c.

Referenced by game_ruleset_free().

◆ city_tile_index_to_xy()

bool city_tile_index_to_xy ( int *  city_map_x,
int *  city_map_y,
int  city_tile_index,
int  city_radius_sq 
)

Returns the coordinates for the given city tile index taking into account the squared city radius.

Definition at line 96 of file city.c.

Referenced by cm_print_city(), and place_pollution().

◆ city_tile_output()

int city_tile_output ( const struct city pcity,
const struct tile ptile,
bool  is_celebrating,
Output_type_id  otype 
)

Calculate the output for the tile. pcity may be NULL. is_celebrating may be speculative. otype is the output type (generally O_FOOD, O_TRADE, or O_SHIELD).

This can be used to calculate the benefits celebration would give.

Definition at line 1259 of file city.c.

Referenced by city_tile_cache_update(), city_tile_output_now(), cityresult_fill(), compute_max_stats_heuristic(), compute_tile_production(), dai_city_want(), do_city_migration(), fill_city_overlays_sprite_array(), get_tile_output_text(), get_tile_value(), get_worked_tile_output(), max_tile_trade(), and min_food_surplus_for_fastest_growth().

◆ city_tile_output_now()

int city_tile_output_now ( const struct city pcity,
const struct tile ptile,
Output_type_id  otype 
)

Calculate the production output the given tile is capable of producing for the city. The output type is given by 'otype' (generally O_FOOD, O_SHIELD, or O_TRADE).

NOTE: As of now, return value does not represent output on end of turn if city stops celebrating, because the server side tile output cache uses base_city_celebrating() instead of city_celebrating() on city_tile_cache_update().

Definition at line 1360 of file city.c.

Referenced by city_tile_value().

◆ city_tile_to_city_map()

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 
)

Finds the city map coordinate for a given map position and a city center. Returns whether the map position is inside of the city map.

Definition at line 259 of file city.c.

Referenced by city_base_to_city_map(), and fill_grid_sprite_array().

◆ city_tile_xy_to_index()

int city_tile_xy_to_index ( int  city_map_x,
int  city_map_y,
int  city_radius_sq 
)

Returns the index for the given city tile coordinates taking into account the squared city radius.

Definition at line 118 of file city.c.

Referenced by citylog_map_line().

◆ city_total_impr_gold_upkeep()

int city_total_impr_gold_upkeep ( const struct city pcity)

Returns the total amount of gold needed to pay for all buildings in the city.

Definition at line 1179 of file city.c.

Referenced by city_support(), player_get_expected_income(), and update_city_activity().

◆ city_total_unit_gold_upkeep()

int city_total_unit_gold_upkeep ( const struct city pcity)

Get the total amount of gold needed to pay upkeep costs for all supported units of the city. Takes into account EFT_UNIT_UPKEEP_FREE_PER_CITY.

Definition at line 1198 of file city.c.

Referenced by city_support(), military_advisor_choose_build(), player_get_expected_income(), and update_city_activity().

◆ city_turns_to_build()

int city_turns_to_build ( const struct city pcity,
const struct universal target,
bool  include_shield_stock 
)

Calculates the turns which are needed to build the requested improvement in the city. GUI Independent.

Definition at line 1938 of file city.c.

Referenced by city_production_turns_to_build(), get_city_dialog_production_full(), get_city_dialog_production_row(), popup_worklist_editor(), and refresh_production_label().

◆ city_turns_to_grow()

int city_turns_to_grow ( const struct city pcity)

Calculates the turns which are needed for the city to grow. A value of FC_INFINITY means the city will never grow. A value of 0 means city growth is blocked. A negative value of -x means the city will shrink in x turns. A positive value of x means the city will grow in x turns.

Definition at line 1969 of file city.c.

Referenced by city_dialog_update_information(), city_dialog_update_information(), cr_entry_growturns(), get_city_mapview_name_and_growth(), package_city(), real_city_report_dialog_update_city(), real_info_city_report_dialog_update(), redraw_city_dialog(), and city_dialog::update_info_label().

◆ city_unhappy()

bool city_unhappy ( const struct city pcity)

◆ city_unit_slots_available()

int city_unit_slots_available ( const struct city pcity)

Return number of free unit slots in a city.

Definition at line 1027 of file city.c.

Referenced by can_city_build_unit_direct(), and is_action_possible().

◆ city_unit_unhappiness()

int city_unit_unhappiness ( const struct civ_map nmap,
struct unit punit,
int *  free_unhappy 
)

Query unhappiness caused by a given unit.

Definition at line 2943 of file city.c.

Referenced by city_dialog_update_supported_units(), city_support(), create_unit_surface(), dai_assess_military_unhappiness(), and city_dialog::update_units().

◆ city_waste()

int city_waste ( const struct city pcity,
Output_type_id  otype,
int  total,
int *  breakdown 
)

Give corruption/waste generated by city. otype gives the output type (O_SHIELD/O_TRADE). 'total' gives the total output of this type in the city. If non-NULL, 'breakdown' should be an OLOSS_LAST-sized array which will be filled in with a breakdown of the kinds of waste (not cumulative).

Definition at line 3122 of file city.c.

Referenced by cityresult_fill(), dai_city_want(), get_city_dialog_output_text(), and set_city_production().

◆ citylog_map_data()

void citylog_map_data ( enum log_level  level,
int  radius_sq,
int *  map_data 
)

Display 'map_data' on a city map with the given radius 'radius_sq' for the requested log level. The size of 'map_data' is defined by city_map_tiles(radius_sq).

Definition at line 406 of file city.c.

Referenced by citylog_map_workers(), cm_print_result(), and print_cityresult().

◆ citylog_map_workers()

void citylog_map_workers ( enum log_level  level,
struct city pcity 
)

Display the location of the workers within the city map of pcity.

Definition at line 441 of file city.c.

Referenced by city_map_update_radius_sq().

◆ citymindist_prevents_city_on_tile()

bool citymindist_prevents_city_on_tile ( const struct civ_map nmap,
const struct tile ptile 
)

Returns TRUE iff it is illegal to found a city on the specified tile because of citymindist.

Definition at line 1438 of file city.c.

Referenced by city_can_be_built_tile_only(), expl_act_not_enabl(), and is_action_possible().

◆ compare_iter_index()

int compare_iter_index ( const void *  a,
const void *  b 
)

Compare two iter_index values from the city_map_index.

This function will be passed to qsort(). It should never return zero, or the sort order will be left up to qsort and will be undefined. This would mean that server execution would not be reproducible.

Definition at line 338 of file city.c.

Referenced by generate_city_map_indices(), and generate_map_indices().

◆ create_city_virtual()

struct city * create_city_virtual ( struct player pplayer,
struct tile ptile,
const char *  name 
)

Create virtual skeleton for a city. Values are mostly sane defaults.

Always tile_set_owner(ptile, pplayer) sometime after this!

Definition at line 3343 of file city.c.

Referenced by trade_generator::add_tile(), cityresult_fill(), create_city(), edit_buffer_copy(), handle_city_info(), handle_city_short_info(), handle_tile_info(), result_defense_bonus(), sg_load_player_cities(), sg_load_player_cities(), and texai_city_info_recv().

◆ destroy_city_virtual()

void destroy_city_virtual ( struct city pcity)

Removes the virtual skeleton of a city. You should already have removed all buildings and units you have added to the city before this.

Definition at line 3419 of file city.c.

Referenced by cityresult_fill(), trade_generator::clear_trade_planing(), game_remove_city(), packhand_free(), sg_load_player_cities(), sg_load_player_cities(), texai_city_destruction_recv(), and tile_virtual_destroy().

◆ free_city_map_index()

void free_city_map_index ( void  )

Free memory allocated by generate_citymap_index

Definition at line 604 of file city.c.

Referenced by game_free(), game_reset(), handle_map_info(), and srv_ready().

◆ generate_city_map_indices()

void generate_city_map_indices ( void  )

Fill the arrays city_map_index, city_map_xy and city_map_numtiles. This may depend on topology and ruleset settings.

Definition at line 522 of file city.c.

Referenced by main_map_allocate().

◆ get_city_tithes_bonus()

int get_city_tithes_bonus ( const struct city pcity)

Return the amount of gold generated by buildings under "tithe" attribute governments.

Definition at line 2199 of file city.c.

Referenced by dai_city_want(), get_city_dialog_output_text(), and set_city_production().

◆ get_final_city_output_bonus()

int get_final_city_output_bonus ( const struct city pcity,
Output_type_id  otype 
)

Return the factor (in %) by which the city's output should be multiplied.

Definition at line 2184 of file city.c.

Referenced by calc_civ_score(), dai_city_want(), and set_city_bonuses().

◆ get_output_identifier()

const char * get_output_identifier ( Output_type_id  output)

Return an id string for the output type. This string can be used internally by rulesets and tilesets and should not be changed or translated.

Definition at line 614 of file city.c.

Referenced by load_ruleset_game(), load_ruleset_terrain(), load_ruleset_units(), save_game_ruleset(), save_terrain_ruleset(), save_units_ruleset(), tileset_lookup_sprite_tags(), and universal_rule_name().

◆ get_output_name()

const char * get_output_name ( Output_type_id  output)

Return a translated name for the output type. This name should only be used for user display.

Definition at line 624 of file city.c.

Referenced by choice_is_promising(), cm_print_result(), create_cma_dialog(), helptext_government(), helptext_unit_upkeep_str(), popup_city_cma_dialog(), req_text_insert(), universal_kind_values(), and universal_name_translation().

◆ get_output_type()

struct output_type * get_output_type ( Output_type_id  output)

Return the output type for this index.

Definition at line 633 of file city.c.

Referenced by city_units_upkeep(), city_waste(), get_specialist_output(), get_tile_output_text(), helptext_government(), upkeep_kill_unit(), and utype_upkeep_cost().

◆ is_allied_city_tile()

static bool is_allied_city_tile ( const struct tile ptile,
const struct player pplayer 
)
inlinestatic

Is there an allied city on the tile?

Definition at line 724 of file city.h.

Referenced by is_possible_base_fuel(), is_refuel_tile(), path_to_nearest_allied_city(), and send_goto_route().

◆ is_capital()

bool is_capital ( const struct city pcity)

◆ is_city_center()

static bool is_city_center ( const struct city pcity,
const struct tile ptile 
)
inlinestatic

Return TRUE if the city is centered at the given tile.

NB: This doesn't simply check whether pcity->tile == ptile because that would miss virtual clones made of city center tiles, which are used by autosettler to judge whether improvements are worthwhile. The upshot is that city centers would appear to lose their irrigation/farmland bonuses as well as their minimum outputs of one food and one shield, and thus autosettler would rarely transform or mine them.

Definition at line 844 of file city.h.

Referenced by city_tile_output(), is_city_in_tile(), is_free_worked(), and tile_city().

◆ is_city_option_set()

bool is_city_option_set ( const struct city pcity,
enum city_options  option 
)

Returns TRUE iff the city has set the given option.

Definition at line 3301 of file city.c.

Referenced by city_build_unit(), city_increase_size(), city_dialog::display_worklist_menu(), and set_cityopt_values().

◆ is_enemy_city_tile()

static bool is_enemy_city_tile ( const struct tile ptile,
const struct player pplayer 
)
inlinestatic

Is there an enemy city on the tile?

Definition at line 712 of file city.h.

Referenced by adv_unit_move(), control_mouse_cursor(), dai_unit_move(), and unit_can_be_retired().

◆ is_free_worked()

bool is_free_worked ( const struct city pcity,
const struct tile ptile 
)

◆ is_friendly_city_near()

bool is_friendly_city_near ( const struct civ_map nmap,
const struct player owner,
const struct tile ptile 
)

Return TRUE if there is a friendly city near to this tile (within 3 steps).

Definition at line 2065 of file city.c.

Referenced by is_unit_near_a_friendly_city(), and unit_move_consequences().

◆ is_gov_center()

bool is_gov_center ( const struct city pcity)

Return TRUE iff this city is governmental center.

Definition at line 1560 of file city.c.

Referenced by api_methods_is_gov_center(), and city_waste().

◆ is_non_allied_city_tile()

static bool is_non_allied_city_tile ( const struct tile ptile,
const struct player pplayer 
)
inlinestatic

◆ is_non_attack_city_tile()

static bool is_non_attack_city_tile ( const struct tile ptile,
const struct player pplayer 
)
inlinestatic

Is there a non-attack city on the tile?

Definition at line 736 of file city.h.

Referenced by is_action_possible().

◆ is_unit_near_a_friendly_city()

bool is_unit_near_a_friendly_city ( const struct civ_map nmap,
const struct unit punit 
)

Return TRUE if there is a friendly city near to this unit (within 3 steps).

Definition at line 2055 of file city.c.

Referenced by unit_being_aggressive().

◆ is_valid_city_coords()

bool is_valid_city_coords ( const int  city_radius_sq,
const int  city_map_x,
const int  city_map_y 
)

Return TRUE if the given city coordinate pair is "valid"; that is, if it is a part of the citymap and thus is workable by the city.

Definition at line 183 of file city.c.

Referenced by canvas_to_city_pos(), city_map_to_tile(), city_tile_to_city_map(), city_tile_xy_to_index(), city_to_canvas_pos(), city_toggle_worker(), and citylog_map_line().

◆ output_type_by_identifier()

Output_type_id output_type_by_identifier ( const char *  id)

Find the output type for this output identifier.

Definition at line 642 of file city.c.

Referenced by universal_value_from_str().

◆ player_angry_citizens()

citizens player_angry_citizens ( const struct player pplayer)

Give base number of angry citizens in any city owned by pplayer.

Definition at line 2168 of file city.c.

Referenced by citizen_base_mood(), create_city(), remove_city(), and transfer_city().

◆ player_content_citizens()

citizens player_content_citizens ( const struct player pplayer)

Give base number of content citizens in any city owned by pplayer.

Definition at line 2158 of file city.c.

Referenced by choice_is_promising(), citizen_base_mood(), create_city(), evaluate_solution(), remove_city(), and transfer_city().

◆ rs_max_city_radius_sq()

int rs_max_city_radius_sq ( void  )

Maximum city radius in this ruleset.

Definition at line 154 of file city.c.

Referenced by find_city_or_settler_near_tile(), generate_citydlg_dimensions(), and city_map::set_pixmap().

◆ set_city_production()

void set_city_production ( struct city pcity)
inline

Set food, trade and shields production in a city.

This initializes the prod[] and waste[] arrays. It assumes that the bonus[] and citizen_base[] arrays are alread built.

Definition at line 2855 of file city.c.

Referenced by city_refresh_from_main_map(), and compute_max_stats_heuristic().

◆ tile_allied_city()

struct city * tile_allied_city ( const struct tile ptile,
const struct player pplayer 
)

Return friendly city on the tile, if one exist

Definition at line 2009 of file city.c.

Referenced by is_allied_city_tile().

◆ tile_enemy_city()

struct city * tile_enemy_city ( const struct tile ptile,
const struct player pplayer 
)

Return enemy city on the tile, if one exist

Definition at line 1994 of file city.c.

Referenced by is_enemy_city_tile().

◆ tile_non_allied_city()

struct city * tile_non_allied_city ( const struct tile ptile,
const struct player pplayer 
)

Return non-allied city on the tile, if one exist

Definition at line 2039 of file city.c.

Referenced by is_non_allied_city_tile(), is_plr_zoc_client(), and is_plr_zoc_srv().

◆ tile_non_attack_city()

struct city * tile_non_attack_city ( const struct tile ptile,
const struct player pplayer 
)

Return non-attack city on the tile, if one exist

Definition at line 2024 of file city.c.

Referenced by is_non_attack_city_tile(), and need_war_player_hlp().

Variable Documentation

◆ city_styles

struct citystyle* city_styles
extern

◆ num_output_types

const Output_type_id num_output_types
extern

◆ output_types

struct output_type output_types[]
extern