1 /***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
18 #endif /* __cplusplus */
21 #include "bitvector.h"
26 #include "name_translation.h"
27 #include "improvement.h"
30 #include "workertask.h"
33 enum production_class_type
{
35 PCT_NORMAL_IMPROVEMENT
,
40 /* Various city options. These are stored by the server and can be
41 * toggled by the user. Each one defaults to off. Adding new ones
42 * will break network compatibility. If you want to reorder or remove
43 * an option remeber to load the city option order from the savegame.
44 * It is stored in savefile.city_options_vector
46 * Used in the network protocol.
48 #define SPECENUM_NAME city_options
49 /* If building a settler at size 1 disbands the city */
50 #define SPECENUM_VALUE0 CITYO_DISBAND
51 #define SPECENUM_VALUE0NAME "Disband"
52 /* If new citizens are science specialists */
53 #define SPECENUM_VALUE1 CITYO_NEW_EINSTEIN
54 #define SPECENUM_VALUE1NAME "New_Einstein"
55 /* If new citizens are gold specialists */
56 #define SPECENUM_VALUE2 CITYO_NEW_TAXMAN
57 #define SPECENUM_VALUE2NAME "New_Taxman"
58 #define SPECENUM_COUNT CITYO_LAST
59 #define SPECENUM_BITVECTOR bv_city_options
60 #include "specenum_gen.h"
62 /* Changing the max radius requires updating network capabilities and results
63 * in incompatible savefiles. */
64 #define CITY_MAP_MIN_RADIUS 0
65 #define CITY_MAP_DEFAULT_RADIUS 2
66 #define CITY_MAP_MAX_RADIUS 5
68 /* The city includes all tiles dx^2 + dy^2 <= CITY_MAP_*_RADIUS_SQ */
69 #define CITY_MAP_DEFAULT_RADIUS_SQ \
70 (CITY_MAP_DEFAULT_RADIUS * CITY_MAP_DEFAULT_RADIUS + 1)
71 #define CITY_MAP_MIN_RADIUS_SQ \
72 (CITY_MAP_MIN_RADIUS * CITY_MAP_MIN_RADIUS + 1)
73 #define CITY_MAP_MAX_RADIUS_SQ \
74 (CITY_MAP_MAX_RADIUS * CITY_MAP_MAX_RADIUS + 1)
75 /* the id for the city center */
76 #define CITY_MAP_CENTER_RADIUS_SQ -1
77 /* the tile index of the city center */
78 #define CITY_MAP_CENTER_TILE_INDEX 0
80 /* Maximum diameter of the workable city area. */
81 #define CITY_MAP_MAX_SIZE (CITY_MAP_MAX_RADIUS * 2 + 1)
83 #define INCITE_IMPOSSIBLE_COST (1000 * 1000 * 1000)
86 * Size of the biggest possible city.
88 * The constant may be changed since it isn't externally visible.
90 * The city size is saved as unsigned char. Therefore, MAX_CITY_SIZE should
93 #define MAX_CITY_SIZE 0xFF
95 /* Iterate a city map, from the center (the city) outwards */
100 /* City map coordinates are positive integers shifted by the maximum
101 * radius the game engine allows (not the current ruleset) */
102 #define CITY_REL2ABS(_coor) (_coor + CITY_MAP_MAX_RADIUS)
103 #define CITY_ABS2REL(_coor) (_coor - CITY_MAP_MAX_RADIUS)
105 bool city_tile_index_to_xy(int *city_map_x
, int *city_map_y
,
106 int city_tile_index
, int city_radius_sq
);
107 int city_tile_xy_to_index(int city_map_x
, int city_map_y
,
110 int rs_max_city_radius_sq(void);
111 int city_map_radius_sq_get(const struct city
*pcity
);
112 void city_map_radius_sq_set(struct city
*pcity
, int radius_sq
);
113 int city_map_tiles(int city_radius_sq
);
114 #define city_map_tiles_from_city(_pcity) \
115 city_map_tiles(city_map_radius_sq_get(_pcity))
117 void citylog_map_data(enum log_level level
, int radius_sq
, int *map_data
);
118 void citylog_map_workers(enum log_level level
, struct city
*pcity
);
120 /* Iterate over the tiles of a city map. Starting at a given city radius
121 * (the city center is _radius_sq_min = 0) outward to the tiles of
122 * _radius_sq_max. (_x, _y) will be the valid elements of
123 * [0, CITY_MAP_MAX_SIZE] taking into account the city radius. */
124 #define city_map_iterate_outwards_radius_sq_index(_radius_sq_min, \
128 fc_assert(_radius_sq_min <= _radius_sq_max); \
129 int _x = 0, _y = 0, _index; \
130 int _x##_y##_index = city_map_tiles(_radius_sq_min); \
131 while (city_tile_index_to_xy(&_x, &_y, _x##_y##_index, \
133 _index = _x##_y##_index; \
136 #define city_map_iterate_outwards_radius_sq_index_end \
140 /* Same as above, but don't set index */
141 #define city_map_iterate_outwards_radius_sq(_radius_sq_min, \
145 fc_assert(_radius_sq_min <= _radius_sq_max); \
146 int _x = 0, _y = 0; \
147 int _x##_y##_index = city_map_tiles(_radius_sq_min); \
148 while (city_tile_index_to_xy(&_x, &_y, _x##_y##_index, \
152 #define city_map_iterate_outwards_radius_sq_end \
156 /* Iterate a city map. This iterates over all city positions in the city
157 * map starting at the city center (i.e., positions that are workable by
158 * the city) using the index (_index) and the coordinates (_x, _y). It
159 * is an abbreviation for city_map_iterate_outwards_radius_sq(_end). */
160 #define city_map_iterate(_radius_sq, _index, _x, _y) \
161 city_map_iterate_outwards_radius_sq_index(CITY_MAP_CENTER_RADIUS_SQ, \
162 _radius_sq, _index, _x, _y)
164 #define city_map_iterate_end \
165 city_map_iterate_outwards_radius_sq_index_end
167 #define city_map_iterate_without_index(_radius_sq, _x, _y) \
168 city_map_iterate_outwards_radius_sq(CITY_MAP_CENTER_RADIUS_SQ, \
171 #define city_map_iterate_without_index_end \
172 city_map_iterate_outwards_radius_sq_end
174 /* Iterate the tiles between two radii of a city map. */
175 #define city_map_iterate_radius_sq(_radius_sq_min, _radius_sq_max, \
177 city_map_iterate_outwards_radius_sq(_radius_sq_min, _radius_sq_max, \
180 #define city_map_iterate_radius_sq_end \
181 city_map_iterate_outwards_radius_sq_end
183 /* Iterate a city map in checked real map coordinates.
184 * _radius_sq is the squared city radius.
185 * _city_tile is the center of the (possible) city.
186 * (_index) will be the city tile index in the intervall
187 * [0, city_map_tiles(_radius_sq)] */
188 #define city_tile_iterate_index(_radius_sq, _city_tile, _tile, \
190 city_map_iterate_outwards_radius_sq_index(CITY_MAP_CENTER_RADIUS_SQ, \
191 _radius_sq, _index, _x, _y) \
192 struct tile *_tile = city_map_to_tile(_city_tile, _radius_sq, \
196 #define city_tile_iterate_index_end \
198 } city_map_iterate_outwards_radius_sq_index_end;
200 /* simple extension to skip is_free_worked() tiles. */
201 #define city_tile_iterate_skip_free_worked(_radius_sq, _city_tile, \
202 _tile, _index, _x, _y) { \
203 city_map_iterate(_radius_sq, _index, _x, _y) { \
204 if (!is_free_worked_index(_index)) { \
205 struct tile *_tile = city_map_to_tile(_city_tile, _radius_sq, \
209 #define city_tile_iterate_skip_free_worked_end \
212 } city_map_iterate_end; \
215 /* Does the same thing as city_tile_iterate_index, but keeps the city
216 * coordinates hidden. */
217 #define city_tile_iterate(_radius_sq, _city_tile, _tile) { \
218 city_map_iterate_outwards_radius_sq(CITY_MAP_CENTER_RADIUS_SQ, \
219 _radius_sq, _x, _y) \
220 struct tile *_tile = city_map_to_tile(_city_tile, _radius_sq, \
224 #define city_tile_iterate_end \
226 } city_map_iterate_outwards_radius_sq_end;
228 /* Improvement status (for cities' lists of improvements)
229 * (replaced Impr_Status) */
231 struct built_status
{
232 int turn
; /* turn built, negative for old state */
233 #define I_NEVER (-1) /* Improvement never built */
234 #define I_DESTROYED (-2) /* Improvement built and destroyed */
237 /* How much this output type is penalized for unhappy cities: not at all,
238 * surplus knocked down to 0, or all production removed. */
239 enum output_unhappy_penalty
{
240 UNHAPPY_PENALTY_NONE
,
241 UNHAPPY_PENALTY_SURPLUS
,
242 UNHAPPY_PENALTY_ALL_PRODUCTION
247 const char *name
; /* Untranslated name */
248 const char *id
; /* Identifier string (for rulesets, etc.) */
249 bool harvested
; /* Is this output type gathered by city workers? */
250 enum output_unhappy_penalty unhappy_penalty
;
253 enum citizen_category
{
259 CITIZEN_SPECIALIST
= CITIZEN_LAST
,
262 /* changing this order will break network compatibility,
263 * and clients that don't use the symbols. */
264 enum citizen_feeling
{
265 FEELING_BASE
, /* before any of the modifiers below */
266 FEELING_LUXURY
, /* after luxury */
267 FEELING_EFFECT
, /* after building effects */
268 FEELING_NATIONALITY
, /* after citizen nationality effects */
269 FEELING_MARTIAL
, /* after units enforce martial order */
270 FEELING_FINAL
, /* after wonders (final result) */
274 /* Ways city output can be lost. Not currently part of network protocol. */
276 OLOSS_WASTE
, /* regular corruption or waste */
277 OLOSS_SIZE
, /* notradesize/fulltradesize */
281 /* This enumerators are used at client side only (so changing it doesn't
282 * break the compability) to mark that the city need specific gui updates
283 * (e.g. city dialog, or city report). */
286 CU_UPDATE_REPORT
= 1 << 0,
287 CU_UPDATE_DIALOG
= 1 << 1,
288 CU_POPUP_DIALOG
= 1 << 2
291 /* See city_build_here_test(). */
292 enum city_build_result
{
300 struct tile_cache
; /* defined and only used within city.c */
302 struct adv_city
; /* defined in ./server/advisors/infracache.h */
305 char name
[MAX_LEN_NAME
];
306 struct tile
*tile
; /* May be NULL, should check! */
307 struct player
*owner
; /* Cannot be NULL. */
308 struct player
*original
; /* Cannot be NULL. */
314 citizens feel
[CITIZEN_LAST
][FEELING_LAST
];
317 citizens specialists
[SP_MAX
];
319 citizens martial_law
; /* Citizens pacified by martial law. */
320 citizens unit_happy_upkeep
; /* Citizens angered by military action. */
322 citizens
*nationality
; /* Nationality of the citizens. */
325 int trade
[MAX_TRADE_ROUTES
], trade_value
[MAX_TRADE_ROUTES
];
327 /* Tile output, regardless of if the tile is actually worked. It is used
328 * as cache for the output of the tiles within the city map.
329 * (see city_tile_cache_update() and city_tile_cache_get_output()) */
330 struct tile_cache
*tile_cache
;
331 /* The memory allocated for tile_cache is valid for this squared city
333 int tile_cache_radius_sq
;
335 /* the productions */
336 int surplus
[O_LAST
]; /* Final surplus in each category. */
337 int waste
[O_LAST
]; /* Waste/corruption in each category. */
338 int unhappy_penalty
[O_LAST
]; /* Penalty from unhappy cities. */
339 int prod
[O_LAST
]; /* Production is total minus waste and penalty. */
340 int citizen_base
[O_LAST
]; /* Base production from citizens. */
341 int usage
[O_LAST
]; /* Amount of each resource being used. */
343 /* Cached values for CPU savings. */
349 int pollution
; /* not saved */
350 int illness_trade
; /* not saved; illness due to trade; it is
351 calculated within the server and send to
352 the clients as the clients do not have all
353 information about the trade cities */
354 int turn_plague
; /* last turn with an illness in the city */
355 int city_radius_sq
; /* current squared city radius */
363 int anarchy
; /* anarchy rounds count */
364 int rapture
; /* rapture rounds count */
368 int before_change_shields
; /* If changed this turn, shields before penalty */
369 int caravan_shields
; /* If caravan has helped city to build wonder. */
370 int disbanded_shields
; /* If you disband unit in a city. Count them */
371 int last_turns_shield_surplus
; /* The surplus we had last turn. */
373 struct built_status built
[B_LAST
];
375 struct universal production
;
377 /* If changed this turn, what we changed from */
378 struct universal changed_from
;
380 struct worklist worklist
;
382 bv_city_options city_options
;
384 struct unit_list
*units_supported
;
386 int history
; /* Cumulative culture */
388 struct worker_task_list
*task_reqs
;
392 /* Only used in the server (./ai/ and ./server/). */
394 float migration_score
; /* updated by city_migration_score. */
395 int mgr_score_calc_turn
; /* turn the migration score was calculated */
399 int steal
; /* diplomats steal once; for spies, gets harder */
401 /* If > 0, workers will not be rearranged until they are unfrozen. */
404 /* If set, workers need to be arranged when the city is unfrozen.
405 * Set inside auto_arrange_workers() and city_freeze_workers_queue(). */
408 /* If set, city needs to be refreshed at a later time.
409 * Set inside city_refresh() and city_refresh_queue_add(). */
412 /* the city map is synced with the client. */
415 bool debug
; /* not saved */
417 struct adv_city
*adv
;
418 void *ais
[FREECIV_AI_MOD_LAST
];
420 struct vision
*vision
;
424 /* Only used at the client (the server is omniscient; ./client/). */
432 /* The color is an index into the city_colors array in mapview_common */
436 /* info for dipl/spy investigation */
437 struct unit_list
*info_units_supported
;
438 struct unit_list
*info_units_present
;
439 /* Before popup the city dialog, units go there. In normal process,
440 * these pointers are set to NULL. */
441 struct unit_list
*collecting_info_units_supported
;
442 struct unit_list
*collecting_info_units_present
;
444 /* Updates needed for the city. */
445 enum city_updates need_updates
;
447 unsigned char first_citizen_index
;
453 struct name_translation name
;
454 char graphic
[MAX_LEN_NAME
];
455 char graphic_alt
[MAX_LEN_NAME
];
456 char citizens_graphic
[MAX_LEN_NAME
];
457 char citizens_graphic_alt
[MAX_LEN_NAME
];
458 struct requirement_vector reqs
;
461 extern struct citystyle
*city_styles
;
462 extern const Output_type_id num_output_types
;
463 extern struct output_type output_types
[];
465 /* get 'struct city_list' and related functions: */
466 #define SPECLIST_TAG city
467 #define SPECLIST_TYPE struct city
468 #include "speclist.h"
470 #define city_list_iterate(citylist, pcity) \
471 TYPED_LIST_ITERATE(struct city, citylist, pcity)
472 #define city_list_iterate_end LIST_ITERATE_END
474 #define cities_iterate(pcity) \
476 players_iterate(pcity##_player) { \
477 city_list_iterate(pcity##_player->cities, pcity) {
479 #define cities_iterate_end \
480 } city_list_iterate_end; \
481 } players_iterate_end; \
484 #define city_list_iterate_safe(citylist, _city) \
486 int _city##_size = city_list_size(citylist); \
488 if (_city##_size > 0) { \
489 int _city##_numbers[_city##_size]; \
490 int _city##_index = 0; \
492 city_list_iterate(citylist, _city) { \
493 _city##_numbers[_city##_index++] = _city->id; \
494 } city_list_iterate_end; \
496 for (_city##_index = 0; \
497 _city##_index < _city##_size; \
499 struct city *_city = \
500 game_city_by_number(_city##_numbers[_city##_index]); \
504 #define city_list_iterate_safe_end \
510 /* output type functions */
512 const char *get_output_identifier(Output_type_id output
);
513 const char *get_output_name(Output_type_id output
);
514 struct output_type
*get_output_type(Output_type_id output
);
515 Output_type_id
output_type_by_identifier(const char *id
);
516 void add_specialist_output(const struct city
*pcity
, int *output
);
517 void set_city_production(struct city
*pcity
);
521 const char *city_name_get(const struct city
*pcity
);
522 struct player
*city_owner(const struct city
*pcity
);
523 struct tile
*city_tile(const struct city
*pcity
);
525 citizens
city_size_get(const struct city
*pcity
);
526 void city_size_add(struct city
*pcity
, int add
);
527 void city_size_set(struct city
*pcity
, citizens size
);
529 citizens
city_specialists(const struct city
*pcity
);
531 citizens
player_content_citizens(const struct player
*pplayer
);
532 citizens
player_angry_citizens(const struct player
*pplayer
);
534 int city_population(const struct city
*pcity
);
535 int city_total_impr_gold_upkeep(const struct city
*pcity
);
536 int city_total_unit_gold_upkeep(const struct city
*pcity
);
537 int city_unit_unhappiness(struct unit
*punit
, int *free_unhappy
);
538 bool city_happy(const struct city
*pcity
); /* generally use celebrating instead */
539 bool city_unhappy(const struct city
*pcity
); /* anarchy??? */
540 bool base_city_celebrating(const struct city
*pcity
);
541 bool city_celebrating(const struct city
*pcity
); /* love the king ??? */
542 bool city_rapture_grow(const struct city
*pcity
);
544 /* city related improvement and unit functions */
546 int city_improvement_upkeep(const struct city
*pcity
,
547 const struct impr_type
*pimprove
);
549 bool can_city_build_improvement_direct(const struct city
*pcity
,
550 struct impr_type
*pimprove
);
551 bool can_city_build_improvement_later(const struct city
*pcity
,
552 struct impr_type
*pimprove
);
553 bool can_city_build_improvement_now(const struct city
*pcity
,
554 struct impr_type
*pimprove
);
556 bool can_city_build_unit_direct(const struct city
*pcity
,
557 const struct unit_type
*punittype
);
558 bool can_city_build_unit_later(const struct city
*pcity
,
559 const struct unit_type
*punittype
);
560 bool can_city_build_unit_now(const struct city
*pcity
,
561 const struct unit_type
*punittype
);
563 bool can_city_build_direct(const struct city
*pcity
,
564 const struct universal
*target
);
565 bool can_city_build_later(const struct city
*pcity
,
566 const struct universal
*target
);
567 bool can_city_build_now(const struct city
*pcity
,
568 const struct universal
*target
);
570 bool city_can_use_specialist(const struct city
*pcity
,
571 Specialist_type_id type
);
572 bool city_has_building(const struct city
*pcity
,
573 const struct impr_type
*pimprove
);
574 bool is_capital(const struct city
*pcity
);
575 bool is_gov_center(const struct city
*pcity
);
576 bool city_got_defense_effect(const struct city
*pcity
,
577 const struct unit_type
*attacker
);
579 int city_production_build_shield_cost(const struct city
*pcity
);
580 bool city_production_build_units(const struct city
*pcity
,
581 bool add_production
, int *num_units
);
582 int city_production_buy_gold_cost(const struct city
*pcity
);
584 bool city_production_has_flag(const struct city
*pcity
,
585 enum impr_flag_id flag
);
586 int city_production_turns_to_build(const struct city
*pcity
,
587 bool include_shield_stock
);
589 int city_change_production_penalty(const struct city
*pcity
,
590 const struct universal
*target
);
591 int city_turns_to_build(const struct city
*pcity
,
592 const struct universal
*target
,
593 bool include_shield_stock
);
594 int city_turns_to_grow(const struct city
*pcity
);
595 bool city_can_grow_to(const struct city
*pcity
, int pop_size
);
596 bool city_can_change_build(const struct city
*pcity
);
598 void city_choose_build_default(struct city
*pcity
);
600 /* textual representation of buildings */
602 const char *city_improvement_name_translation(const struct city
*pcity
,
603 struct impr_type
*pimprove
);
604 const char *city_production_name_translation(const struct city
*pcity
);
606 /* city map functions */
607 bool is_valid_city_coords(const int city_radius_sq
, const int city_map_x
,
608 const int city_map_y
);
609 bool city_base_to_city_map(int *city_map_x
, int *city_map_y
,
610 const struct city
*const pcity
,
611 const struct tile
*map_tile
);
612 bool city_tile_to_city_map(int *city_map_x
, int *city_map_y
,
613 const int city_radius_sq
,
614 const struct tile
*city_center
,
615 const struct tile
*map_tile
);
617 struct tile
*city_map_to_tile(const struct tile
*city_center
,
618 int city_radius_sq
, int city_map_x
,
621 /* Initialization functions */
622 int compare_iter_index(const void *a
, const void *b
);
623 void generate_city_map_indices(void);
624 void free_city_map_index(void);
627 int city_tile_output(const struct city
*pcity
, const struct tile
*ptile
,
628 bool is_celebrating
, Output_type_id otype
);
629 int city_tile_output_now(const struct city
*pcity
, const struct tile
*ptile
,
630 Output_type_id otype
);
632 bool base_city_can_work_tile(const struct player
*restriction
,
633 const struct city
*pcity
,
634 const struct tile
*ptile
);
635 bool city_can_work_tile(const struct city
*pcity
, const struct tile
*ptile
);
637 bool city_can_be_built_here(const struct tile
*ptile
,
638 const struct unit
*punit
);
639 enum city_build_result
city_build_here_test(const struct tile
*ptile
,
640 const struct unit
*punit
);
643 struct city
*city_list_find_number(struct city_list
*This
, int id
);
644 struct city
*city_list_find_name(struct city_list
*This
, const char *name
);
646 int city_name_compare(const void *p1
, const void *p2
);
648 /* city style functions */
649 const char *city_style_rule_name(const int style
);
650 const char *city_style_name_translation(const int style
);
652 int city_style_by_rule_name(const char *s
);
653 int city_style_by_translated_name(const char *s
);
655 struct city
*is_enemy_city_tile(const struct tile
*ptile
,
656 const struct player
*pplayer
);
657 struct city
*is_allied_city_tile(const struct tile
*ptile
,
658 const struct player
*pplayer
);
659 struct city
*is_non_attack_city_tile(const struct tile
*ptile
,
660 const struct player
*pplayer
);
661 struct city
*is_non_allied_city_tile(const struct tile
*ptile
,
662 const struct player
*pplayer
);
664 bool is_unit_near_a_friendly_city(const struct unit
*punit
);
665 bool is_friendly_city_near(const struct player
*owner
,
666 const struct tile
*ptile
);
667 bool city_exists_within_max_city_map(const struct tile
*ptile
,
668 bool may_be_on_center
);
670 /* granary size as a function of city size */
671 int city_granary_size(int city_size
);
673 void city_add_improvement(struct city
*pcity
,
674 const struct impr_type
*pimprove
);
675 void city_remove_improvement(struct city
*pcity
,
676 const struct impr_type
*pimprove
);
678 /* city update functions */
679 void city_refresh_from_main_map(struct city
*pcity
, bool *workers_map
);
681 int city_waste(const struct city
*pcity
, Output_type_id otype
, int total
,
683 Specialist_type_id
best_specialist(Output_type_id otype
,
684 const struct city
*pcity
);
685 int get_final_city_output_bonus(const struct city
*pcity
, Output_type_id otype
);
686 bool city_built_last_turn(const struct city
*pcity
);
688 /* city creation / destruction */
689 struct city
*create_city_virtual(struct player
*pplayer
,
690 struct tile
*ptile
, const char *name
);
691 void destroy_city_virtual(struct city
*pcity
);
692 bool city_is_virtual(const struct city
*pcity
);
695 bool is_city_option_set(const struct city
*pcity
, enum city_options option
);
696 void city_styles_alloc(int num
);
697 void city_styles_free(void);
699 void add_tax_income(const struct player
*pplayer
, int trade
, int *output
);
700 int get_city_tithes_bonus(const struct city
*pcity
);
701 int city_pollution_types(const struct city
*pcity
, int shield_total
,
702 int *pollu_prod
, int *pollu_pop
, int *pollu_mod
);
703 int city_pollution(const struct city
*pcity
, int shield_total
);
704 int city_illness_calc(const struct city
*pcity
, int *ill_base
,
705 int *ill_size
, int *ill_trade
, int *ill_pollution
);
706 bool city_had_recent_plague(const struct city
*pcity
);
707 int city_build_slots(const struct city
*pcity
);
708 int city_airlift_max(const struct city
*pcity
);
710 bool city_exist(int id
);
713 * Iterates over all improvements, skipping those not yet built in the
716 #define city_built_iterate(_pcity, _p) \
717 improvement_iterate(_p) { \
718 if ((_pcity)->built[improvement_index(_p)].turn <= I_NEVER) { \
722 #define city_built_iterate_end \
723 } improvement_iterate_end;
726 /* Iterates over all output types in the game. */
727 #define output_type_iterate(output) \
729 Output_type_id output; \
731 for (output = 0; output < O_LAST; output++) {
733 #define output_type_iterate_end \
740 bool is_city_center(const struct city
*pcity
, const struct tile
*ptile
);
741 bool is_free_worked(const struct city
*pcity
, const struct tile
*ptile
);
743 #define is_free_worked_index(city_tile_index) \
744 (CITY_MAP_CENTER_TILE_INDEX == city_tile_index)
745 #define FREE_WORKED_TILES (1)
747 void *city_ai_data(const struct city
*pcity
, const struct ai_type
*ai
);
748 void city_set_ai_data(struct city
*pcity
, const struct ai_type
*ai
,
753 #endif /* __cplusplus */
755 #endif /* FC__CITY_H */