![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
Include dependency graph for city.h:Go to the source code of this file.
Classes | |
| struct | iter_index |
| struct | built_status |
| struct | output_type |
| struct | cached_waste |
| Used to cache the value of waste effects to speed up governors. More... | |
| struct | city |
| struct | citystyle |
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 } |
Functions | |
| 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. More... | |
| 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. More... | |
| int | rs_max_city_radius_sq () |
| Maximum city radius in this ruleset. More... | |
| int | city_map_radius_sq_get (const struct city *pcity) |
| Returns the current squared radius of the city. More... | |
| void | city_map_radius_sq_set (struct city *pcity, int radius_sq) |
| Returns the current squared radius of the city. More... | |
| int | city_map_tiles (int city_radius_sq) |
| Return the number of tiles for the given city radius. More... | |
| void | citylog_map_data (QtMsgType 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. More... | |
| void | citylog_map_workers (QtMsgType level, struct city *pcity) |
| Display the location of the workers within the city map of pcity. More... | |
| const char * | get_output_identifier (Output_type_id output) |
| Return an id string for the output type. More... | |
| const char * | get_output_name (Output_type_id output) |
| Return a translated name for the output type. More... | |
| struct output_type * | get_output_type (Output_type_id output) |
| Return the output type for this index. More... | |
| Output_type_id | output_type_by_identifier (const char *id) |
| Find the output type for this output identifier. More... | |
| void | add_specialist_output (const struct city *pcity, int *output, const std::vector< std::array< int, O_LAST >> *pcsoutputs=nullptr) |
| Calculate output (gold, science, and luxury) generated by the specialists of a city. More... | |
| void | set_city_production (struct city *pcity, const std::vector< city * > &gov_centers, const std::array< cached_waste, O_LAST > *pcwaste=nullptr) |
| Set food, trade and shields production in a city. More... | |
| const char * | city_name_get (const struct city *pcity) |
| Return the name of the city. More... | |
| struct player * | city_owner (const struct city *pcity) |
| Return the owner of the city. More... | |
| struct tile * | city_tile (const struct city *pcity) |
| Return the tile location of the city. More... | |
| citizens | city_size_get (const struct city *pcity) |
| Get the city size. More... | |
| void | city_size_add (struct city *pcity, int add) |
| Add a (positive or negative) value to the city size. More... | |
| void | city_size_set (struct city *pcity, citizens size) |
| Set the city size. More... | |
| citizens | city_specialists (const struct city *pcity) |
| Give the number of specialists in a city. More... | |
| int | player_base_citizen_happiness (const struct player *pplayer) |
| Give base happiness in any city owned by pplayer. More... | |
| citizens | player_content_citizens (const struct player *pplayer) |
| Give base number of content citizens in any city owned by pplayer. More... | |
| citizens | player_angry_citizens (const struct player *pplayer) |
| Give base number of angry citizens in any city owned by pplayer. More... | |
| int | city_population (const struct city *pcity) |
| Returns how many thousand citizen live in this city. More... | |
| 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. More... | |
| 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. More... | |
| int | city_unit_unhappiness (const unit *punit, int *free_unhappy) |
| Query unhappiness caused by a given unit. More... | |
| bool | city_happy (const struct city *pcity) |
| Return TRUE iff the city is happy. More... | |
| bool | city_unhappy (const struct city *pcity) |
| Return TRUE iff the city is unhappy. More... | |
| 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. More... | |
| bool | city_celebrating (const struct city *pcity) |
| cities celebrate only after consecutive happy turns More... | |
| bool | city_rapture_grow (const struct city *pcity) |
| Returns whether city is growing by rapture. More... | |
| bool | city_is_occupied (const struct city *pcity) |
| Returns TRUE iff the city is occupied. More... | |
| int | city_improvement_upkeep (const struct city *pcity, const struct impr_type *pimprove) |
| Return the upkeep (gold) needed each turn to upkeep the given improvement in the given city. More... | |
| 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. More... | |
| 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. More... | |
| bool | can_city_build_improvement_now (const struct city *pcity, const struct impr_type *pimprove) |
| Return whether given city can build given building; returns FALSE if the building is obsolete. More... | |
| bool | can_city_build_unit_direct (const struct city *pcity, const struct unit_type *punittype) |
| Return whether given city can build given unit, ignoring whether unit is obsolete. More... | |
| bool | can_city_build_unit_later (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. More... | |
| bool | can_city_build_unit_now (const struct city *pcity, const struct unit_type *punittype) |
| Return whether given city can build given unit; returns FALSE if unit is obsolete. More... | |
| bool | can_city_build_direct (const struct city *pcity, const struct universal *target) |
| Returns whether city can immediately build given target, unit or improvement. More... | |
| bool | can_city_build_later (const struct city *pcity, const struct universal *target) |
| Returns whether city can ever build given target, unit or improvement. More... | |
| bool | can_city_build_now (const struct city *pcity, const struct universal *target) |
| Returns whether city can immediately build given target, unit or improvement. More... | |
| int | city_unit_slots_available (const struct city *pcity) |
| Return number of free unit slots in a city. More... | |
| 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. More... | |
| bool | city_has_building (const struct city *pcity, const struct impr_type *pimprove) |
| Return TRUE iff the city has this building in it. More... | |
| bool | is_capital (const struct city *pcity) |
| Return TRUE iff this city is its nation's capital. More... | |
| bool | is_gov_center (const struct city *pcity) |
| Return TRUE iff this city is governmental center. More... | |
| bool | city_got_defense_effect (const struct city *pcity, const struct unit_type *attacker) |
| This can be City Walls, Coastal defense... More... | |
| int | city_production_build_shield_cost (const struct city *pcity) |
| Return the number of shields it takes to build current city production. More... | |
| 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. More... | |
| int | city_production_unit_veteran_level (struct city *pcity, const struct unit_type *punittype) |
| How many veteran levels will created unit of this type get? More... | |
| bool | city_production_has_flag (const struct city *pcity, enum impr_flag_id flag) |
| Return TRUE when the current production has this flag. More... | |
| 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. More... | |
| 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. More... | |
| 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). More... | |
| 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. More... | |
| int | city_turns_to_grow (const struct city *pcity) |
| Calculates the turns which are needed for the city to grow. More... | |
| bool | city_can_grow_to (const struct city *pcity, int pop_size) |
| Return TRUE iff the city can grow to the given size. More... | |
| bool | city_can_change_build (const struct city *pcity) |
| Returns TRUE iff the given city can change what it is building. More... | |
| void | city_choose_build_default (struct city *pcity) |
| Always tile_set_owner(ptile, pplayer) sometime before this! More... | |
| const char * | city_improvement_name_translation (const struct city *pcity, const struct impr_type *pimprove) |
| Return the extended name of the building. More... | |
| const char * | city_production_name_translation (const struct city *pcity) |
| Return the extended name of the current production. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| struct tile * | city_map_to_tile (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. More... | |
| int | compare_iter_index (const void *a, const void *b) |
| Compare two iter_index values from the city_map_index. More... | |
| void | generate_city_map_indices () |
| Fill the arrays city_map_index, city_map_xy and city_map_numtiles. More... | |
| void | free_city_map_index () |
| Free memory allocated by generate_citymap_index. More... | |
| void | city_production_caravan_shields_init () |
| Initialize the cache of what city production can use shields from caravans. More... | |
| 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. More... | |
| 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. More... | |
| 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). More... | |
| bool | city_can_work_tile (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). More... | |
| bool | citymindist_prevents_city_on_tile (const struct tile *ptile) |
| Returns TRUE iff it is illegal to found a city on the specified tile because of citymindist. More... | |
| bool | city_can_be_built_here (const struct tile *ptile, const struct unit *punit) |
| Returns TRUE if the given unit can build a city at the given map coordinates. More... | |
| bool | city_can_be_built_tile_only (const struct tile *ptile) |
| Returns TRUE if the given unit can build a city at the given map coordinates. More... | |
| struct city * | city_list_find_number (struct city_list *This, int id) |
| Find city with given id from list. More... | |
| struct city * | city_list_find_name (struct city_list *This, const char *name) |
| Find city with given name from list. More... | |
| const char * | city_style_rule_name (const int style) |
| Return the (untranslated) rule name of the city style. More... | |
| int | city_style_by_rule_name (const char *s) |
| Returns the city style that has the given (untranslated) rule name. More... | |
| struct city * | is_enemy_city_tile (const struct tile *ptile, const struct player *pplayer) |
| Is there an enemy city on this tile? More... | |
| struct city * | is_allied_city_tile (const struct tile *ptile, const struct player *pplayer) |
| Is there an friendly city on this tile? More... | |
| struct city * | is_non_attack_city_tile (const struct tile *ptile, const struct player *pplayer) |
| Is there an enemy city on this tile? More... | |
| struct city * | is_non_allied_city_tile (const struct tile *ptile, const struct player *pplayer) |
| Is there an non_allied city on this tile? More... | |
| bool | is_unit_near_a_friendly_city (const struct unit *punit) |
| Return TRUE if there is a friendly city near to this unit (within 3 steps). More... | |
| bool | is_friendly_city_near (const struct player *owner, const struct tile *ptile) |
| Return TRUE if there is a friendly city near to this tile (within 3 steps). More... | |
| bool | city_exists_within_max_city_map (const struct tile *ptile, bool may_be_on_center) |
| Return TRUE iff a city exists within a city radius of the given location. More... | |
| int | city_granary_size (int city_size) |
| Generalized formula used to calculate granary size. More... | |
| void | city_add_improvement (struct city *pcity, const struct impr_type *pimprove) |
| Adds an improvement (and its effects) to a city. More... | |
| void | city_remove_improvement (struct city *pcity, const struct impr_type *pimprove) |
| Removes an improvement (and its effects) from a city. More... | |
| void | city_refresh_from_main_map (struct city *pcity, bool *workers_map, const std::vector< city * > &gov_centers, const std::array< cached_waste, O_LAST > *pcwaste=nullptr, const std::vector< std::array< int, O_LAST >> *pcsoutputs=nullptr) |
| Refreshes the internal cached data in the city structure. More... | |
| int | city_waste (const struct city *pcity, Output_type_id otype, int total, int *breakdown, const std::vector< city * > &gov_centers, const cached_waste *pcwaste=nullptr) |
| Give corruption/waste generated by city. More... | |
| Specialist_type_id | best_specialist (Output_type_id otype, const struct city *pcity) |
| Return the "best" specialist available in the game. More... | |
| 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. More... | |
| 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). More... | |
| struct city * | create_city_virtual (struct player *pplayer, struct tile *ptile, const char *name) |
| Create virtual skeleton for a city. More... | |
| void | destroy_city_virtual (struct city *pcity) |
| Removes the virtual skeleton of a city. More... | |
| bool | city_is_virtual (const struct city *pcity) |
| Return TRUE if the city is a virtual city. More... | |
| bool | is_city_option_set (const struct city *pcity, enum city_options option) |
| Returns TRUE iff the city has set the given option. More... | |
| void | city_styles_alloc (int num) |
| Allocate memory for this amount of city styles. More... | |
| void | city_styles_free () |
| De-allocate the memory used by the city styles. More... | |
| 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). More... | |
| int | get_city_tithes_bonus (const struct city *pcity) |
| Return the amount of gold generated by buildings under "tithe" attribute governments. More... | |
| int | city_pollution_types (const struct city *pcity, int shield_total, int trade_total, int *pollu_prod, int *pollu_trade, int *pollu_pop, int *pollu_mod) |
| Calculate the pollution from production and population in the city. More... | |
| int | city_pollution (const struct city *pcity, int shield_total, int trade_total) |
| Calculate pollution for the city. More... | |
| 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: More... | |
| bool | city_had_recent_plague (const struct city *pcity) |
| Returns whether city had a plague outbreak this turn. More... | |
| int | city_build_slots (const struct city *pcity) |
| The maximum number of units a city can build per turn. More... | |
| int | city_airlift_max (const struct city *pcity) |
| A city's maximum airlift capacity. More... | |
| bool | city_exist (int id) |
| Check if city with given id still exist. More... | |
| bool | is_city_center (const struct city *pcity, const struct tile *ptile) |
| Return TRUE if the city is centered at the given tile. More... | |
| void * | city_ai_data (const struct city *pcity, const struct ai_type *ai) |
| Return pointer to ai data of given city and ai type. More... | |
| void | city_set_ai_data (struct city *pcity, const struct ai_type *ai, void *data) |
| Attach ai data to city. More... | |
Variables | |
| struct citystyle * | city_styles |
| const Output_type_id | num_output_types |
| struct output_type | output_types [] |
| #define cities_iterate | ( | pcity | ) |
| #define cities_iterate_end |
| #define CITY_ABS2REL | ( | _coor | ) | (_coor - CITY_MAP_MAX_RADIUS) |
| #define city_built_iterate | ( | _pcity, | |
| _p | |||
| ) |
| #define city_built_iterate_end |
| #define city_list_iterate | ( | citylist, | |
| pcity | |||
| ) | TYPED_LIST_ITERATE(struct city, citylist, pcity) |
| #define city_list_iterate_end LIST_ITERATE_END |
| #define city_list_iterate_safe | ( | citylist, | |
| _city | |||
| ) |
| #define CITY_MAP_DEFAULT_RADIUS_SQ (CITY_MAP_DEFAULT_RADIUS * CITY_MAP_DEFAULT_RADIUS + 1) |
| #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_outwards_radius_sq | ( | _radius_sq_min, | |
| _radius_sq_max, | |||
| _x, | |||
| _y | |||
| ) |
| #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_radius_sq | ( | _radius_sq_min, | |
| _radius_sq_max, | |||
| _x, | |||
| _y | |||
| ) | city_map_iterate_outwards_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_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_MAX_RADIUS_SQ (CITY_MAP_MAX_RADIUS * CITY_MAP_MAX_RADIUS + 1) |
| #define CITY_MAP_MAX_SIZE (CITY_MAP_MAX_RADIUS * 2 + 1) |
| #define CITY_MAP_MIN_RADIUS_SQ (CITY_MAP_MIN_RADIUS * CITY_MAP_MIN_RADIUS + 1) |
| #define city_map_tiles_from_city | ( | _pcity | ) | city_map_tiles(city_map_radius_sq_get(_pcity)) |
| #define CITY_REL2ABS | ( | _coor | ) | (_coor + CITY_MAP_MAX_RADIUS) |
| #define city_tile_iterate | ( | _radius_sq, | |
| _city_tile, | |||
| _tile | |||
| ) |
| #define city_tile_iterate_end |
| #define city_tile_iterate_index | ( | _radius_sq, | |
| _city_tile, | |||
| _tile, | |||
| _index | |||
| ) |
| #define city_tile_iterate_index_end |
| #define city_tile_iterate_skip_center | ( | _radius_sq, | |
| _city_tile, | |||
| _tile, | |||
| _index, | |||
| _x, | |||
| _y | |||
| ) |
| #define city_tile_iterate_skip_center_end |
| #define is_city_center_index | ( | city_tile_index | ) | (CITY_MAP_CENTER_TILE_INDEX == city_tile_index) |
| #define output_type_iterate | ( | output | ) |
| enum citizen_category |
| enum citizen_feeling |
| enum city_updates |
| enum output_loss |
| void add_specialist_output | ( | const struct city * | pcity, |
| int * | output, | ||
| const std::vector< std::array< int, O_LAST >> * | pcsoutputs | ||
| ) |
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 2239 of file city.cpp.
Referenced by city_refresh_from_main_map(), and dai_city_want().
| 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 2150 of file city.cpp.
Referenced by dai_city_want(), get_city_dialog_output_text(), and set_city_production().
| 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 paramter '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 1339 of file city.cpp.
Referenced by city_can_work_tile(), client_city_can_work_tile(), and max_tile_trade().
| 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 1555 of file city.cpp.
Referenced by city_celebrating(), city_tile_cache_update(), dai_city_want(), get_worked_tile_output(), init_tile_lattice(), max_tile_trade(), and min_food_surplus_for_fastest_growth().
| 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.cpp.
Referenced by city_increase_size().
Returns whether city can immediately build given target, unit or improvement.
This considers obsolete targets still buildable.
Definition at line 935 of file city.cpp.
Referenced by base_city_queue_insert().
| 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 795 of file city.cpp.
Referenced by building_upgrades_to(), can_city_build_direct(), can_city_build_improvement_now(), and city_choose_build_default().
| 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 832 of file city.cpp.
Referenced by ba_human_wants(), can_city_build_later(), collect_eventually_buildable_targets(), should_force_recalc(), and worklist_change_build_target().
| bool can_city_build_improvement_now | ( | const struct city * | pcity, |
| const struct impr_type * | pimprove | ||
| ) |
Return whether given city can build given building; returns FALSE if the building is obsolete.
Definition at line 815 of file city.cpp.
Referenced by advisor_choose_build(), base_want(), building_advisor(), building_advisor_choose(), can_city_build_now(), choose_build_target(), city_build_building(), city_global_turn_notify(), collect_eventually_buildable_targets(), dai_build_adv_override(), dai_find_source_building(), military_advisor_choose_build(), process_attacker_want(), research_tech_lost(), and upgrade_building_prod().
Returns whether city can ever build given target, unit or improvement.
Definition at line 970 of file city.cpp.
Referenced by base_city_queue_insert().
Returns whether city can immediately build given target, unit or improvement.
This considers obsolete targets no longer buildable.
Definition at line 953 of file city.cpp.
Referenced by city_dialog::change_production(), clipboard_send_production_packet(), city_widget::display_list_menu(), city_widget::gen_select_labels(), handle_city_change(), city_production_model::populate(), transfer_city(), and worklist_change_build_target().
Return whether given city can build given unit, ignoring whether unit is obsolete.
Definition at line 860 of file city.cpp.
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().
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 912 of file city.cpp.
Referenced by can_city_build_later(), collect_eventually_buildable_targets(), dai_process_defender_want(), dai_wants_defender_against(), dai_wants_role_unit(), and worklist_change_build_target().
Return whether given city can build given unit; returns FALSE if unit is obsolete.
Definition at line 894 of file city.cpp.
Referenced by best_role_unit(), can_city_build_now(), choose_build_target(), collect_eventually_buildable_targets(), dai_barbarian_choose_build(), dai_choose_attacker(), dai_choose_attacker_air(), dai_choose_bodyguard(), dai_choose_defender_versus(), dai_choose_paratrooper(), dai_hunter_guess_best(), dai_hunter_missile_want(), dai_process_defender_want(), dai_wants_defender_against(), dai_wants_role_unit(), impr_provides_buildable_units(), process_attacker_want(), research_tech_lost(), role_unit_cb(), tai_city_worker_task_select(), and texai_city_worker_task_select().
Adds an improvement (and its effects) to a city.
Definition at line 3272 of file city.cpp.
Referenced by base_want(), build_free_small_wonders(), city_build_building(), city_build_free_buildings(), edit_buffer_copy(), handle_edit_city(), sg_load_player_city(), transfer_city(), and update_improvement_from_packet().
Return pointer to ai data of given city and ai type.
Definition at line 3509 of file city.cpp.
Referenced by def_ai_city_data().
| 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 2819 of file city.cpp.
Referenced by get_airlift_text(), and update_city_activity().
| 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 274 of file city.cpp.
Referenced by adjust_workers_button_pressed(), base_city_can_work_tile(), city_map_includes_tile(), do_map_click(), freeciv::layer_grid::fill_sprite_array(), freeciv::layer_overlays::fill_sprite_array(), put_one_element(), and resolve_city_emergency().
| int city_build_slots | ( | const struct city * | pcity | ) |
The maximum number of units a city can build per turn.
Definition at line 2809 of file city.cpp.
Referenced by city_production_build_units(), city_production_cost_str(), and cr_entry_build_slots().
| 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 2183 of file city.cpp.
Referenced by city_change_production_penalty(), dai_city_choose_build(), and should_force_recalc().
Returns TRUE if the given unit can build a city at the given map coordinates.
punit is the founding unit. It may be nullptr if a city is built out of the blue (e.g., through editing).
Definition at line 1423 of file city.cpp.
Referenced by api_methods_unit_city_can_be_built_here(), city_desirability(), dai_auto_settler_run(), find_city_or_settler_near_tile(), handle_edit_city_create(), and unit_drawn_with_city_outline().
| bool city_can_be_built_tile_only | ( | 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 1477 of file city.cpp.
Referenced by city_can_be_built_here().
| bool city_can_change_build | ( | const struct city * | pcity | ) |
Returns TRUE iff the given city can change what it is building.
Definition at line 1016 of file city.cpp.
Referenced by city_build_unit(), city_set_queue(), and handle_city_change().
| 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 1914 of file city.cpp.
Referenced by action_not_enabled_reason(), city_increase_size(), city_turn_notify(), dai_effect_value(), dai_manage_taxes(), and do_city_migration().
| 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 1005 of file city.cpp.
Referenced by best_specialist(), city_rotate_specialist(), handle_city_change_specialist(), and init_specialist_lattice_nodes().
Returns TRUE when a tile is available to be worked, or the city itself is currently working the tile (and can continue).
See also client_city_can_work_tile() (client/climap.[ch]).
Definition at line 1392 of file city.cpp.
Referenced by adjust_workers_button_pressed(), cma_yoloswag::apply_result_on_server(), city_increase_size(), city_map_update_radius_sq(), city_map_update_tile_direct(), do_city_migration(), do_map_click(), freeciv::layer_overlays::fill_sprite_array(), handle_city_make_worker(), init_tile_lattice(), min_food_surplus_for_fastest_growth(), settler_evaluate_improvements(), tai_tile_worker_task_select(), and texai_tile_worker_task_select().
| bool city_celebrating | ( | const struct city * | pcity | ) |
cities celebrate only after consecutive happy turns
Definition at line 1564 of file city.cpp.
Referenced by api_methods_is_city_celebrating(), city_incite_cost(), city_tile_output_now(), city_turn_notify(), civil_war_triggered(), cr_entry_hstate_concise(), get_city_dialog_status_text(), update_city_activity(), and city_dialog::update_title().
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 1777 of file city.cpp.
Referenced by change_build_target(), and city_turns_to_build().
| void city_choose_build_default | ( | struct city * | pcity | ) |
Always tile_set_owner(ptile, pplayer) sometime before this!
Definition at line 1024 of file city.cpp.
Referenced by cityresult_fill(), and create_city().
| bool city_exist | ( | int | id | ) |
Check if city with given id still exist.
Use this before using old city pointers when city might have disappeared.
Definition at line 3465 of file city.cpp.
Referenced by building_removed(), check_disasters(), city_build_building(), city_build_unit(), city_change_size(), city_increase_size(), city_populate(), city_reduce_size(), disband_city(), do_city_migration(), do_unit_conquer_city(), remove_city(), transfer_city(), transfer_city_units(), unit_conquer_city(), unit_do_destroy_city(), worklist_change_build_target(), and worklist_item_postpone_req_vec().
| bool city_exists_within_max_city_map | ( | 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 2013 of file city.cpp.
Referenced by api_methods_tile_city_exists_within_max_city_map(), and hut_get_limited().
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 1512 of file city.cpp.
Referenced by base_assess_defense_unit(), and dai_process_defender_want().
| int city_granary_size | ( | int | city_size | ) |
Generalized formula used to calculate granary size.
The AI may not deal well with non-default settings. See food_weighting().
Definition at line 2034 of file city.cpp.
Referenced by city_gold_worth(), city_increase_size(), city_populate(), city_reduce_size(), city_reset_foodbox(), city_turn_notify(), city_turns_to_grow(), cr_entry_growturns(), dai_effect_value(), dai_manage_cities(), handle_edit_city(), min_food_surplus_for_fastest_growth(), polished_citybar_painter::paint(), set_default_city_manager(), unit_foodbox_cost(), and city_info::update_labels().
| bool city_had_recent_plague | ( | const struct city * | pcity | ) |
Returns whether city had a plague outbreak this turn.
Definition at line 2800 of file city.cpp.
Referenced by city_populate().
| 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 1531 of file city.cpp.
Referenced by api_methods_is_city_happy(), city_celebrating(), cr_entry_hstate_concise(), dai_manage_taxes(), evaluate_solution(), get_city_dialog_status_text(), handle_city_info(), update_city_activity(), update_dumb_city(), and city_dialog::update_title().
Return TRUE iff the city has this building in it.
Definition at line 1189 of file city.cpp.
Referenced by adjust_ai_unit_choice(), api_methods_city_has_building(), ba_human_wants(), can_city_build_improvement_direct(), can_city_sell_building(), city_build_building(), city_building_present(), city_from_wonder(), dai_build_adv_adjust(), diplomat_sabotage(), city_widget::display_list_menu(), do_unit_strike_city_building(), edit_buffer_copy(), get_economy_report_data(), handle_edit_city(), is_baseflag_in_range(), package_city(), popup_info_text(), sell_all_improvements(), spy_send_sabotage_list(), and update_dumb_city().
| 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')
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 2746 of file city.cpp.
Referenced by city_handle_plague_risk(), city_illness_strike(), city_migration_score(), cr_entry_plague_risk(), get_city_dialog_illness_text(), sg_load_players(), and city_info::update_labels().
| const char* city_improvement_name_translation | ( | const struct city * | pcity, |
| const struct impr_type * | pimprove | ||
| ) |
Return the extended name of the building.
Definition at line 635 of file city.cpp.
Referenced by city_build_building(), city_production_name_translation(), name_and_sort_items(), freeciv::improvement_seller::operator()(), popup_sabotage_dialog(), report_wonders_of_the_world(), city_dialog::update_improvements(), worklist_change_build_target(), and worklist_item_postpone_req_vec().
Return the upkeep (gold) needed each turn to upkeep the given improvement in the given city.
Definition at line 1202 of file city.cpp.
Referenced by city_total_impr_gold_upkeep(), dai_city_want(), get_economy_report_data(), get_tooltip_improvement(), sell_random_building(), and city_dialog::update_improvements().
| bool city_is_occupied | ( | const struct city * | pcity | ) |
Returns TRUE iff the city is occupied.
Definition at line 1584 of file city.cpp.
Referenced by can_player_see_hypotetic_units_at(), and popup_info_text().
| 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 nullptr or that the city exists in the game.
Definition at line 3478 of file city.cpp.
Referenced by tile_virtual_destroy().
| struct city* city_list_find_name | ( | struct city_list * | This, |
| const char * | name | ||
| ) |
Find city with given name from list.
Definition at line 1616 of file city.cpp.
Referenced by game_city_by_name(), is_allowed_city_name(), and transfer_city().
| struct city* city_list_find_number | ( | struct city_list * | This, |
| int | id | ||
| ) |
Find city with given id from list.
Definition at line 1598 of file city.cpp.
Referenced by city_freeze_workers_queue(), city_refresh_queue_add(), and dai_goldequiv_clause().
Returns TRUE iff pcity's city map includes the specified tile.
Definition at line 286 of file city.cpp.
Referenced by handle_city_make_specialist(), and handle_city_make_worker().
| int city_map_radius_sq_get | ( | const struct city * | pcity | ) |
Returns the current squared radius of the city.
Definition at line 130 of file city.cpp.
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(), cma_yoloswag::apply_result_on_server(), build_landarea_map(), 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_tile_cache_get_output(), city_tile_cache_update(), citylog_map_workers(), citymap_turn_init(), cityresult_fill(), cm_print_city(), cm_result_new(), 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_tile_seen_city(), map_claim_border(), max_tile_trade(), min_food_surplus_for_fastest_growth(), place_pollution(), player_in_city_map(), resolve_city_emergency(), settler_evaluate_improvements(), tai_city_worker_task_select(), and texai_city_worker_task_select().
| void city_map_radius_sq_set | ( | struct city * | pcity, |
| int | radius_sq | ||
| ) |
Returns the current squared radius of the city.
Definition at line 141 of file city.cpp.
Referenced by city_map_update_radius_sq(), handle_city_short_info(), handle_tile_info(), and sg_load_player_city().
| 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 164 of file city.cpp.
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_new(), generate_city_map_indices(), max_tile_trade(), place_pollution(), and print_cityresult().
| struct tile* city_map_to_tile | ( | 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 298 of file city.cpp.
Referenced by city_map_update_radius_sq(), citylog_map_workers(), max_tile_trade(), min_food_surplus_for_fastest_growth(), and place_pollution().
| const char* city_name_get | ( | const struct city * | pcity | ) |
Return the name of the city.
Definition at line 1077 of file city.cpp.
Referenced by adv_city_worker_act_set(), adv_city_worker_extra_set(), adv_city_worker_rmextra_set(), apply_disaster(), cma_yoloswag::apply_result_on_server(), auto_arrange_workers(), bodyguard_log_prefix(), 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_from_wonder(), city_link(), city_log_prefix(), 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(), cr_entry_cityname(), 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_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_unit_strike_city_production(), 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(), cma_yoloswag::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(), look_for_charge(), plr_widget::nation_selected(), package_city(), place_pollution(), popup_action_selection(), popup_incite_dialog(), popup_info_text(), process_attacker_want(), cma_yoloswag::put_city_under_agent(), really_handle_city_buy(), report_top_five_cities(), report_wonders_of_the_world(), resolve_city_emergency(), cma_yoloswag::result_came_from_server(), send_player_cities(), sg_load_player_city(), 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(), city_dialog::update_title(), vision_site_new_from_city(), vision_site_update_from_city(), and want_tech_for_improvement_effect().
Return the owner of the city.
Definition at line 1083 of file city.cpp.
Referenced by action_not_enabled_reason(), adjust_ai_unit_choice(), adv_calc_extra(), adv_calc_rmextra(), adv_danger_at(), aiguard_assign_guard_city(), aiguard_check_guard(), aiguard_update_charge(), announce_trade_route_removal(), api_edit_create_unit_full(), api_edit_resize_city(), api_edit_unit_move(), api_edit_unit_teleport(), api_methods_enemy_tile(), apply_disaster(), assess_danger(), assess_danger_unit(), auto_arrange_workers(), base_city_can_work_tile(), begin_phase(), broadcast_city_info(), build_landarea_map(), building_advisor(), building_advisor_choose(), building_lost(), calculate_city_clusters(), calculate_want_for_paratrooper(), can_cities_trade(), can_city_build_improvement_direct(), can_city_build_improvement_later(), can_city_build_improvement_now(), can_city_build_unit_direct(), can_city_build_unit_later(), can_city_build_unit_now(), can_disaster_happen(), can_extra_be_removed(), can_player_attack_tile(), can_player_see_city_internals(), can_player_see_units_in_city(), caravan_find_best_destination_notransit(), cma_yoloswag::check_city(), check_city_migrations_player(), check_pollution(), choice_is_promising(), citizen_base_mood(), citizen_happiness_nationality(), citizens_convert(), citizens_convert_conquest(), citizens_nation_foreign(), citizens_print(), citizens_update(), city_add_unit(), city_balance_treasury_buildings(), city_balance_treasury_units(), city_build_free_buildings(), city_can_buy(), city_can_use_specialist(), city_can_work_tile(), city_create_unit(), city_desirability(), city_empty_food_stock(), city_gold_worth(), city_got_defense_effect(), city_handle_disorder(), city_illness_strike(), city_improvement_name_translation(), city_incite_cost(), city_increase_size(), city_landlocked_sell_coastal_improvements(), city_log_prefix(), city_map_update_radius_sq(), city_populate(), city_production_unit_veteran_level(), city_refresh(), city_refresh_queue_processing(), city_style(), city_support(), city_tile_output(), cityrep_buy(), cityresult_fill(), clear_worker_task(), clipboard_copy_production(), clipboard_paste_production(), cm_find_best_solution(), cm_state_init(), contemplate_new_city(), contemplate_terrain_improvements(), cr_entry_nation(), create_city(), create_unit_full(), dai_action_choose_sub_tgt_unit_vs_city(), dai_action_value_unit_vs_city(), dai_assess_military_unhappiness(), dai_can_requirement_be_met_in_city(), dai_choose_attacker(), dai_choose_bodyguard(), dai_choose_defender_versus(), dai_choose_diplomat_offensive(), dai_choose_help_wonder(), dai_choose_trade_route(), dai_city_sell_noncritical(), dai_city_want(), dai_consider_tile_dangerous(), dai_diplomat_city(), dai_diplomat_defend(), dai_do_build_city(), dai_effect_value(), dai_find_source_building(), dai_goldequiv_clause(), dai_gothere_bodyguard(), dai_hunter_guess_best(), dai_manage_diplomat(), dai_military_bodyguard(), dai_military_defend(), dai_military_findjob(), dai_rampage_want(), dai_unit_consider_bodyguard(), dai_unit_make_homecity(), dai_upgrade_units(), dai_wonder_city_distance(), diplomat_bribe(), diplomat_embassy(), diplomat_get_tech(), diplomat_incite(), diplomat_investigate(), diplomat_sabotage(), disband_all_units(), disband_city(), do_airline(), do_city_migration(), do_nuke_tile(), do_unit_change_homecity(), do_unit_conquer_city(), do_unit_establish_trade(), do_unit_strike_city_building(), do_unit_strike_city_production(), edit_buffer_copy(), editor_grab_applied_player(), estimate_fitness(), explorer_tb(), freeciv::layer_background::fill_sprite_array(), find_best_tile_to_paradrop_to(), find_city_or_settler_near_tile(), find_city_to_diplomat(), find_nearest_safe_city(), found_new_tech(), game_remove_city(), get_act_sel_action_custom_text(), get_airlift_text(), get_building_bonus(), get_caravan_enter_city_trade_bonus(), get_city_bonus(), get_city_bonus_effects(), get_city_dialog_culture_text(), get_city_dialog_illness_text(), get_city_dialog_output_text(), get_city_mapview_name_and_growth(), get_city_output_bonus(), get_city_specialist_output_bonus(), get_city_tile_output_bonus(), get_discounted_reward(), get_nearest_city(), get_potential_improvement_bonus(), get_tile_output_bonus(), goods_can_be_provided(), government_of_city(), handle_city_info(), handle_city_short_info(), handle_diplomacy_accept_treaty_req(), handle_edit_city(), handle_edit_player_vision(), handle_edit_unit_create(), handle_tile_info(), handle_unit_action_query(), impr_provides_buildable_extras(), improvement_has_effects(), invasion_funct(), is_action_enabled_unit_on_city_full(), is_action_possible_on_city(), is_allied_city_tile(), is_building_replaced(), is_enemy_city_tile(), is_friendly_city_near(), is_improvement_productive(), is_improvement_redundant(), is_non_allied_city_tile(), is_non_attack_city_tile(), is_req_knowable(), kill_something_with(), look_for_charge(), mapimg_client_tile_city(), mapimg_server_tile_city(), max_tile_trade(), maybe_make_contact(), nation_of_city(), need_war_player_hlp(), notify_goto::notify_goto(), one_city_trade_benefit(), overview_tile_color(), package_and_send_worker_tasks(), package_city(), package_player_info(), simple_citybar_painter::paint(), traditional_citybar_painter::paint(), polished_citybar_painter::paint(), paste_tile(), player_can_place_extra(), player_can_see_city_externals(), player_city_by_number(), player_in_city_map(), player_limit_to_max_rates(), player_owns_city(), popup_info_text(), process_attacker_want(), cma_yoloswag::put_city_under_agent(), raze_city(), reestablish_city_trade_routes(), freeciv::upkeep_widget::refresh(), refresh_dumb_city(), remove_city(), remove_obsolete_buildings_city(), remove_trade_route(), report_top_five_cities(), report_wonders_of_the_world(), resolve_city_emergency(), sdi_try_defend(), send_city_info(), send_city_info_at_tile(), server_remove_unit_full(), set_city_production(), sg_order_to_action(), spy_nuke_city(), spy_poison(), spy_spread_plague(), spy_steal_gold(), spy_steal_shared(), spy_steal_some_maps(), tai_req_worker_task_rcv(), teleport_unit_to_city(), texai_city_update(), texai_refresh(), texai_req_worker_task_rcv(), text_happiness_cities(), text_happiness_nationality(), text_happiness_units(), throw_units_from_illegal_cities(), transfer_city(), transfer_city_units(), transfer_unit(), try_summon_barbarians(), unit_change_homecity_handling(), unit_conquer_city(), unit_do_destroy_city(), unit_do_help_build(), unit_nuke(), update_city_activity(), city_dialog::update_disabled(), update_dumb_city(), city_dialog::update_prod_buttons(), city_dialog::update_units(), upgrade_building_prod(), upgrade_city_extras(), upgrade_unit_prod(), utype_build_shield_cost(), utype_buy_gold_cost(), utype_needs_improvement(), vision_site_new_from_city(), vision_site_update_from_city(), wonder_benefit(), wonder_built(), and wonder_destroyed().
| int city_pollution | ( | const struct city * | pcity, |
| int | shield_total, | ||
| int | trade_total | ||
| ) |
Calculate pollution for the city.
The shield_total and trade_total must be passed in (most callers will want to pass pcity->shield_prod).
Definition at line 2692 of file city.cpp.
Referenced by city_refresh_from_main_map(), and dai_city_want().
| int city_pollution_types | ( | const struct city * | pcity, |
| int | shield_total, | ||
| int | trade_total, | ||
| int * | pollu_prod, | ||
| int * | pollu_trade, | ||
| int * | pollu_pop, | ||
| int * | pollu_mod | ||
| ) |
Calculate the pollution from production and population in the city.
Definition at line 2651 of file city.cpp.
Referenced by city_pollution(), and get_city_dialog_pollution_text().
| int city_population | ( | const struct city * | pcity | ) |
Returns how many thousand citizen live in this city.
Definition at line 1137 of file city.cpp.
Referenced by calc_civ_score(), civ_population(), and city_dialog::update_title().
| int city_production_build_shield_cost | ( | const struct city * | pcity | ) |
Return the number of shields it takes to build current city production.
Definition at line 701 of file city.cpp.
Referenced by build_points_left(), city_production_cost_str(), get_act_sel_action_custom_text(), really_handle_city_buy(), and city_dialog::update_building().
| 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 711 of file city.cpp.
Referenced by city_build_unit(), and city_production_cost_str().
| void city_production_caravan_shields_init | ( | ) |
Initialize the cache of what city production can use shields from caravans.
Definition at line 1664 of file city.cpp.
Referenced by handle_rulesets_ready(), and load_rulesetdir().
| 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 1752 of file city.cpp.
Referenced by city_change_production_penalty(), dai_choose_help_wonder(), dai_manage_caravan(), unit_do_help_build(), and wonder_benefit().
| bool city_production_has_flag | ( | const struct city * | pcity, |
| enum impr_flag_id | flag | ||
| ) |
Return TRUE when the current production has this flag.
Definition at line 691 of file city.cpp.
Referenced by city_build_building(), cityrep_buy(), cr_entry_build_cost(), cr_entry_build_cost_gold(), cr_entry_building(), get_city_dialog_production(), get_city_mapview_production(), get_economy_report_data(), player_get_expected_income(), and really_handle_city_buy().
| const char* city_production_name_translation | ( | const struct city * | pcity | ) |
Return the extended name of the current production.
Definition at line 672 of file city.cpp.
Referenced by city_dialog::buy(), change_build_target(), cityrep_buy(), cr_entry_building(), unit_do_help_build(), and city_dialog::update_building().
| 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 784 of file city.cpp.
Referenced by city_global_turn_notify(), cr_entry_build_cost(), cr_entry_build_cost_turns(), get_city_dialog_production(), get_city_mapview_production(), and polished_citybar_painter::paint().
How many veteran levels will created unit of this type get?
Definition at line 768 of file city.cpp.
Referenced by adjust_ai_unit_choice(), city_create_unit(), dai_choose_attacker_air(), dai_choose_diplomat_offensive(), dai_choose_paratrooper(), dai_gothere_bodyguard(), dai_hunter_choice(), dai_unit_consider_bodyguard(), find_something_to_kill(), kill_something_with(), military_advisor_choose_build(), and send_rally_tile().
| bool city_rapture_grow | ( | const struct city * | pcity | ) |
Returns whether city is growing by rapture.
Definition at line 1572 of file city.cpp.
Referenced by city_populate(), and granary_savings().
| void city_refresh_from_main_map | ( | struct city * | pcity, |
| bool * | workers_map, | ||
| const std::vector< city * > & | gov_centers, | ||
| const std::array< cached_waste, O_LAST > * | pcwaste, | ||
| const std::vector< std::array< int, O_LAST >> * | pcsoutputs | ||
| ) |
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 3052 of file city.cpp.
Referenced by apply_solution(), city_refresh(), cm_query_result(), and dai_manage_taxes().
Removes an improvement (and its effects) from a city.
Definition at line 3287 of file city.cpp.
Referenced by base_want(), building_removed(), city_build_building(), client_remove_city(), do_nuke_tile(), handle_edit_city(), transfer_city(), and update_improvement_from_packet().
Attach ai data to city.
Definition at line 3517 of file city.cpp.
Referenced by dai_city_alloc(), dai_city_free(), texai_city_alloc(), and texai_city_free().
| 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 1112 of file city.cpp.
Referenced by city_add_unit(), city_increase_size(), city_reduce_size(), cityresult_fill(), and handle_city_info().
Get the city size.
Definition at line 1101 of file city.cpp.
Referenced by achievement_check(), action_not_enabled_reason(), add_workers(), api_methods_city_size_get(), cma_yoloswag::apply_result_on_server(), apply_solution(), base_city_celebrating(), begin_search(), calculate_want_for_paratrooper(), citizen_base_mood(), citizens_convert(), citizens_convert_conquest(), citizens_count(), citizens_print(), citizens_update(), city_build_unit(), city_change_size(), city_desirability(), city_gold_worth(), city_happy(), city_illness_calc(), city_incite_cost(), city_increase_size(), city_log_prefix(), city_map_update_radius_sq(), city_migration_score(), city_pollution_types(), city_populate(), city_population(), city_reduce_size(), city_repair_size(), city_reset_foodbox(), city_size_add(), city_support(), city_turn_notify(), city_turns_to_grow(), city_waste(), clean_lattice(), cm_print_city(), cm_state_init(), 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_city_migration(), do_nuke_tile(), edit_buffer_copy(), freeciv::layer_city_size::fill_sprite_array(), find_best_tile_to_paradrop_to(), get_city_citizen_types(), get_trade_illness(), handle_city_info(), handle_edit_city(), is_req_active(), min_food_surplus_for_fastest_growth(), package_city(), traditional_citybar_painter::paint(), polished_citybar_painter::paint(), paste_tile(), report_top_five_cities(), set_default_city_manager(), sg_load_player_city(), sg_load_player_city_citizens(), sg_save_player_cities(), text_happiness_cities(), tile_border_source_radius_sq(), tile_border_source_strength(), trade_base_between_cities(), unit_attack_civilian_casualties(), unit_conquer_city(), unit_foodbox_cost(), update_dumb_city(), city_info::update_labels(), vision_site_new_from_city(), and vision_site_update_from_city().
Set the city size.
Definition at line 1126 of file city.cpp.
Referenced by city_size_add(), create_city_virtual(), edit_buffer_copy(), handle_city_info(), handle_city_short_info(), and sg_load_player_city().
Give the number of specialists in a city.
Definition at line 3228 of file city.cpp.
Referenced by citizen_base_mood(), city_map_update_radius_sq(), and handle_city_make_worker().
| 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 1633 of file city.cpp.
Referenced by sg_load_player_city(), and sg_load_player_vision_city().
| 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 1651 of file city.cpp.
Referenced by city_style_by_rule_name(), freeciv::layer_city::initialize_city_style(), is_universal_needed(), load_ruleset_styles(), sanity_check_ruleset_data(), sg_save_player_cities(), and sg_save_player_vision().
| void city_styles_alloc | ( | int | num | ) |
Allocate memory for this amount of city styles.
Definition at line 3312 of file city.cpp.
Referenced by handle_ruleset_control(), and load_style_names().
| void city_styles_free | ( | ) |
De-allocate the memory used by the city styles.
Definition at line 3327 of file city.cpp.
Referenced by game_ruleset_free().
Return the tile location of the city.
Not (yet) always used, mostly for debugging.
Definition at line 1095 of file city.cpp.
Referenced by action_not_enabled_reason(), adjust_improvement_wants_by_effects(), announce_trade_route_removal(), api_methods_city_inspire_partisans(), apply_cmresult_to_city(), apply_disaster(), cma_yoloswag::apply_result_on_server(), assess_danger(), assess_danger_unit(), auto_arrange_workers(), blocked_find_target_tile(), bodyguard_log_prefix(), build_free_small_wonders(), build_landarea_map(), can_city_build_unit_direct(), can_disaster_happen(), change_build_target(), check_city_migrations_player(), check_pollution(), city_add_unit(), city_build_building(), city_build_unit(), city_choose_build_default(), city_distribute_surplus_shields(), city_empty_food_stock(), city_global_turn_notify(), city_handle_disorder(), city_illness_strike(), city_increase_size(), city_is_occupied(), city_map_update_all(), city_map_update_radius_sq(), city_populate(), city_reduce_workers(), city_style(), city_tile_link(), city_turn_notify(), citylog_map_workers(), citymap_turn_init(), civil_war(), client_city_tile(), client_remove_city(), client_remove_unit(), clipboard_paste_production(), cm_print_city(), cm_result_copy(), contemplate_new_city(), contemplate_terrain_improvements(), dai_action_value_unit_vs_city(), dai_city_want(), dai_effect_value(), dai_find_source_building(), dai_is_unit_tired_waiting_boat(), dai_wants_defender_against(), diplomat_embassy(), diplomat_escape(), diplomat_get_tech(), diplomat_incite(), diplomat_investigate(), diplomat_sabotage(), do_airline(), do_city_migration(), do_nuke_tile(), do_unit_change_homecity(), do_unit_conquer_city(), do_unit_establish_trade(), do_unit_strike_city_building(), do_unit_strike_city_production(), draw_trade_routes_for_city(), find_city_or_settler_near_tile(), find_closest_city(), find_something_to_kill(), game_remove_city(), get_caravan_enter_city_trade_bonus(), get_city_bonus(), get_discounted_reward(), get_units_seen_via_ally(), get_worked_tile_output(), give_citymap_from_player_to_player(), goods_can_be_provided(), cma_yoloswag::handle_city(), handle_city_info(), handle_city_remove(), handle_city_short_info(), handle_diplomacy_accept_treaty_req(), handle_edit_city(), handle_player_diplstate(), handle_tile_info(), has_defense(), impr_provides_buildable_extras(), improvement_obsolete(), init_tile_lattice(), initialize_infrastructure_cache(), is_action_enabled_unit_on_city_full(), is_action_possible_on_city(), is_city_center(), is_city_surrounded_by_our_spies(), is_tile_seen_city(), goto_dialog::item_selected(), look_for_charge(), multiairlift(), package_city(), pf_reverse_map_new_for_city(), place_pollution(), player_can_see_city_externals(), process_attacker_want(), remove_city(), remove_obsolete_buildings_city(), research_tech_lost(), resolve_city_emergency(), search_homecity_for_caravan(), sell_random_building(), settler_evaluate_improvements(), sg_load_player_cities(), sg_load_player_city(), sg_save_player_cities(), spy_nuke_city(), spy_poison(), spy_send_sabotage_list(), spy_spread_plague(), spy_steal_gold(), spy_steal_some_maps(), tai_city_worker_task_select(), teleport_unit_to_city(), texai_city_destruction_recv(), texai_city_update(), texai_city_worker_task_select(), texai_city_worker_wants(), text_tag_replace_text(), transfer_city(), unit_conquer_city(), unit_do_destroy_city(), unit_do_help_build(), unit_perform_action(), freeciv::map_updates_handler::update(), update_city_activity(), freeciv::map_updates_handler::update_city_description(), update_dumb_city(), upgrade_building_prod(), upgrade_unit_prod(), utype_build_shield_cost(), utype_buy_gold_cost(), utype_needs_improvement(), vision_site_new_from_city(), worklist_change_build_target(), and worklist_item_postpone_req_vec().
| 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 95 of file city.cpp.
Referenced by cm_print_city(), and place_pollution().
| 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 nullptr. 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 1230 of file city.cpp.
Referenced by city_tile_cache_update(), city_tile_output_now(), cityresult_fill(), compute_tile_production(), dai_city_want(), do_city_migration(), get_tile_output_text(), get_tile_value(), get_worked_tile_output(), init_tile_lattice(), max_tile_trade(), and min_food_surplus_for_fastest_growth().
| 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).
Definition at line 1322 of file city.cpp.
Referenced by city_tile_value(), and freeciv::layer_overlays::fill_sprite_array().
| 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 257 of file city.cpp.
Referenced by city_base_to_city_map(), and freeciv::layer_grid::fill_sprite_array().
| 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 117 of file city.cpp.
Referenced by citylog_map_line().
| 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 1147 of file city.cpp.
Referenced by city_support(), player_get_expected_income(), and update_city_activities().
| 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 1168 of file city.cpp.
Referenced by city_support(), military_advisor_choose_build(), player_get_expected_income(), and update_city_activities().
| 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 1865 of file city.cpp.
Referenced by city_production_turns_to_build().
| 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 1897 of file city.cpp.
Referenced by cr_entry_growturns(), get_city_dialog_growth_value(), get_city_mapview_name_and_growth(), and cityIconInfoLabel::updateText().
| bool city_unhappy | ( | const struct city * | pcity | ) |
Return TRUE iff the city is unhappy.
An unhappy city will fall into disorder soon.
Definition at line 1544 of file city.cpp.
Referenced by api_methods_is_city_unhappy(), city_gold_worth(), city_handle_disorder(), city_incite_cost(), civil_war_triggered(), cr_entry_hstate_concise(), evaluate_solution(), get_city_dialog_status_text(), handle_city_info(), resolve_city_emergency(), unhappy_city_check(), update_dumb_city(), and city_dialog::update_title().
| int city_unit_slots_available | ( | const struct city * | pcity | ) |
Return number of free unit slots in a city.
Definition at line 987 of file city.cpp.
Referenced by can_city_build_unit_direct().
| int city_unit_unhappiness | ( | const unit * | punit, |
| int * | free_unhappy | ||
| ) |
Query unhappiness caused by a given unit.
Definition at line 2921 of file city.cpp.
Referenced by city_support(), unit_list_widget::create_unit_image(), dai_assess_military_unhappiness(), freeciv::upkeep_widget::refresh(), and text_happiness_units().
| int city_waste | ( | const struct city * | pcity, |
| Output_type_id | otype, | ||
| int | total, | ||
| int * | breakdown, | ||
| const std::vector< city * > & | gov_centers, | ||
| const cached_waste * | pcwaste | ||
| ) |
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-nullptr, '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 3108 of file city.cpp.
Referenced by cityresult_fill(), dai_city_want(), get_city_dialog_output_text(), and set_city_production().
| void citylog_map_data | ( | QtMsgType | 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 404 of file city.cpp.
Referenced by citylog_map_workers(), cm_print_result(), and print_cityresult().
| void citylog_map_workers | ( | QtMsgType | level, |
| struct city * | pcity | ||
| ) |
Display the location of the workers within the city map of pcity.
Definition at line 435 of file city.cpp.
Referenced by city_map_update_radius_sq().
| bool citymindist_prevents_city_on_tile | ( | const struct tile * | ptile | ) |
Returns TRUE iff it is illegal to found a city on the specified tile because of citymindist.
Definition at line 1401 of file city.cpp.
Referenced by action_not_enabled_reason(), and city_can_be_built_tile_only().
| 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 reproducable.
Definition at line 335 of file city.cpp.
Referenced by generate_city_map_indices(), and generate_map_indices().
| 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 3346 of file city.cpp.
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(), and texai_city_info_recv().
| 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 3421 of file city.cpp.
Referenced by cityresult_fill(), trade_generator::clear_trade_planing(), game_remove_city(), packhand_free(), sg_load_player_cities(), texai_city_destruction_recv(), and tile_virtual_destroy().
| void free_city_map_index | ( | ) |
Free memory allocated by generate_citymap_index.
Definition at line 581 of file city.cpp.
Referenced by game_free(), game_reset(), handle_map_info(), and srv_ready().
| void generate_city_map_indices | ( | ) |
Fill the arrays city_map_index, city_map_xy and city_map_numtiles.
This may depend on topology and ruleset settings.
Definition at line 499 of file city.cpp.
Referenced by main_map_allocate().
| int get_city_tithes_bonus | ( | const struct city * | pcity | ) |
Return the amount of gold generated by buildings under "tithe" attribute governments.
Definition at line 2132 of file city.cpp.
Referenced by dai_city_want(), get_city_dialog_output_text(), and set_city_production().
| 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 2114 of file city.cpp.
Referenced by calc_civ_score(), dai_city_want(), and set_city_bonuses().
| 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 592 of file city.cpp.
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().
| 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 602 of file city.cpp.
Referenced by choice_is_promising(), cm_print_result(), helptext_government(), helptext_unit_upkeep_str(), req_text_insert(), universal_kind_values(), and universal_name_translation().
| struct output_type* get_output_type | ( | Output_type_id | output | ) |
Return the output type for this index.
Definition at line 611 of file city.cpp.
Referenced by city_units_upkeep(), city_waste(), cm_state_init(), get_specialist_output(), get_tile_output_text(), helptext_government(), upkeep_kill_unit(), and utype_upkeep_cost().
Is there an friendly city on this tile?
Definition at line 1938 of file city.cpp.
Referenced by freeciv::path_finder::path_finder_private::attempt_paradrop(), is_airunit_refuel_point(), is_possible_base_fuel(), freeciv::allied_city_destination::reached(), and freeciv::refuel_destination::reached().
| bool is_capital | ( | const struct city * | pcity | ) |
Return TRUE iff this city is its nation's capital.
The capital city is special-cased in a number of ways.
Definition at line 1495 of file city.cpp.
Referenced by adjust_improvement_wants_by_effects(), api_methods_is_capital(), building_lost(), check_city_migrations_player(), city_incite_cost(), city_migration_score(), civil_war(), dai_goldequiv_clause(), dai_gov_value(), dai_tech_effect_values(), do_expel_unit(), handle_diplomacy_accept_treaty_req(), diplo_wdg::show_menu(), unit_bribe_cost(), and unit_conquer_city().
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 3497 of file city.cpp.
Referenced by base_city_can_work_tile(), city_map_update_radius_sq(), city_map_update_tile_direct(), city_tile_output(), handle_city_make_specialist(), handle_city_make_worker(), init_tile_lattice(), is_achievement_in_range(), resolve_city_emergency(), and tile_city().
| 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 3304 of file city.cpp.
Referenced by city_build_unit(), city_increase_size(), and city_dialog::display_worklist_menu().
Is there an enemy city on this tile?
Definition at line 1923 of file city.cpp.
Referenced by adv_unit_move(), control_mouse_cursor(), dai_unit_move(), and unit_can_be_retired().
Return TRUE if there is a friendly city near to this tile (within 3 steps).
Definition at line 1993 of file city.cpp.
Referenced by is_unit_near_a_friendly_city(), and unit_move_consequences().
| bool is_gov_center | ( | const struct city * | pcity | ) |
Return TRUE iff this city is governmental center.
Definition at line 1503 of file city.cpp.
Referenced by api_methods_is_gov_center(), city_waste(), and player_gov_centers().
Is there an non_allied city on this tile?
Definition at line 1968 of file city.cpp.
Referenced by do_paradrop(), mr_menu::find_last_unit_pos(), is_my_zoc(), make_path_orders(), maybe_cancel_goto_due_to_enemy(), stack_risk(), and unit_move_handling().
Is there an enemy city on this tile?
Definition at line 1953 of file city.cpp.
Referenced by do_paradrop(), and need_war_player_hlp().
| bool is_unit_near_a_friendly_city | ( | const struct unit * | punit | ) |
Return TRUE if there is a friendly city near to this unit (within 3 steps).
Definition at line 1984 of file city.cpp.
Referenced by unit_being_aggressive().
| 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 181 of file city.cpp.
Referenced by city_map_to_tile(), city_tile_to_city_map(), city_tile_xy_to_index(), and citylog_map_line().
| Output_type_id output_type_by_identifier | ( | const char * | id | ) |
Find the output type for this output identifier.
Definition at line 620 of file city.cpp.
Referenced by universal_by_number().
Give base number of angry citizens in any city owned by pplayer.
Definition at line 2098 of file city.cpp.
Referenced by citizen_base_mood(), create_city(), remove_city(), and transfer_city().
| int player_base_citizen_happiness | ( | const struct player * | pplayer | ) |
Give base happiness in any city owned by pplayer.
A positive number is a number of content citizens. A negative number is a number of angry citizens (a city never starts with both).
Definition at line 2062 of file city.cpp.
Referenced by player_angry_citizens(), player_content_citizens(), and text_happiness_cities().
Give base number of content citizens in any city owned by pplayer.
Definition at line 2088 of file city.cpp.
Referenced by choice_is_promising(), citizen_base_mood(), create_city(), remove_city(), and transfer_city().
| int rs_max_city_radius_sq | ( | ) |
Maximum city radius in this ruleset.
Definition at line 152 of file city.cpp.
Referenced by find_city_or_settler_near_tile(), and generate_citydlg_dimensions().
| void set_city_production | ( | struct city * | pcity, |
| const std::vector< city * > & | gov_centers, | ||
| const std::array< cached_waste, O_LAST > * | pcwaste | ||
| ) |
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 2830 of file city.cpp.
Referenced by city_refresh_from_main_map(), and compute_max_stats_heuristic().
|
extern |
Definition at line 78 of file city.cpp.
Referenced by basic_city_style_for_style(), city_style(), city_style_rule_name(), city_styles_alloc(), city_styles_free(), handle_ruleset_city(), is_universal_needed(), load_ruleset_styles(), load_style_names(), sanity_check_ruleset_data(), save_styles_ruleset(), send_ruleset_cities(), and tileset_setup_city_tiles().
|
extern |
|
extern |
Definition at line 78 of file city.cpp.
Referenced by city_tile_output(), get_city_dialog_output_text(), get_final_city_output_bonus(), get_output_identifier(), get_output_name(), get_output_type(), output_type_by_identifier(), and unhappy_city_check().