Freeciv21
Develop your civilization from humble roots to a global empire
city.h
Go to the documentation of this file.
1 /*__ ___ ***************************************
2 / \ / \ Copyright (c) 1996-2020 Freeciv21 and Freeciv
3 \_ \ / __/ contributors. This file is part of Freeciv21.
4  _\ \ / /__ Freeciv21 is free software: you can redistribute it
5  \___ \____/ __/ and/or modify it under the terms of the GNU General
6  \_ _/ Public License as published by the Free Software
7  | @ @ \_ Foundation, either version 3 of the License,
8  | or (at your option) any later version.
9  _/ /\ You should have received a copy of the GNU
10  /o) (o/\ \_ General Public License along with Freeciv21.
11  \_____/ / If not, see https://www.gnu.org/licenses/.
12  \____/ ********************************************************/
13 #pragma once
14 
15 // common
16 #include "improvement.h"
17 #include "worklist.h"
18 
23  PCT_LAST
24 };
25 
26 /* Various city options. These are stored by the server and can be
27  * toggled by the user. Each one defaults to off. Adding new ones
28  * will break network compatibility. If you want to reorder or remove
29  * an option remember to load the city option order from the savegame.
30  * It is stored in savefile.city_options_vector
31  *
32  * Used in the network protocol.
33  */
34 #define SPECENUM_NAME city_options
35 // If unit production (e.g. settler) is allowed to disband a small city
36 #define SPECENUM_VALUE0 CITYO_DISBAND
37 #define SPECENUM_VALUE0NAME "Disband"
38 // If new citizens are science specialists
39 #define SPECENUM_VALUE1 CITYO_SCIENCE_SPECIALISTS
40 #define SPECENUM_VALUE1NAME "Sci_Specialists"
41 // If new citizens are gold specialists
42 #define SPECENUM_VALUE2 CITYO_GOLD_SPECIALISTS
43 #define SPECENUM_VALUE2NAME "Tax_Specialists"
44 #define SPECENUM_COUNT CITYO_LAST
45 #define SPECENUM_BITVECTOR bv_city_options
46 #include "specenum_gen.h"
47 
48 /* Changing the max radius requires updating network capabilities and results
49  * in incompatible savefiles. */
50 #define CITY_MAP_MIN_RADIUS 0
51 #define CITY_MAP_DEFAULT_RADIUS 2
52 #define CITY_MAP_MAX_RADIUS 5
53 
54 // The city includes all tiles dx^2 + dy^2 <= CITY_MAP_*_RADIUS_SQ
55 #define CITY_MAP_DEFAULT_RADIUS_SQ \
56  (CITY_MAP_DEFAULT_RADIUS * CITY_MAP_DEFAULT_RADIUS + 1)
57 #define CITY_MAP_MIN_RADIUS_SQ \
58  (CITY_MAP_MIN_RADIUS * CITY_MAP_MIN_RADIUS + 1)
59 #define CITY_MAP_MAX_RADIUS_SQ \
60  (CITY_MAP_MAX_RADIUS * CITY_MAP_MAX_RADIUS + 1)
61 // the id for the city center
62 #define CITY_MAP_CENTER_RADIUS_SQ -1
63 // the tile index of the city center
64 #define CITY_MAP_CENTER_TILE_INDEX 0
65 
66 // Maximum diameter of the workable city area.
67 #define CITY_MAP_MAX_SIZE (CITY_MAP_MAX_RADIUS * 2 + 1)
68 
69 #define INCITE_IMPOSSIBLE_COST (1000 * 1000 * 1000)
70 
71 /*
72  * Size of the biggest possible city.
73  *
74  * The constant may be changed since it isn't externally visible.
75  *
76  * The city size is saved as unsigned char. Therefore, MAX_CITY_SIZE should
77  * be below 255!
78  */
79 #define MAX_CITY_SIZE 0xFF
80 
81 // Iterate a city map, from the center (the city) outwards
82 struct iter_index {
83  int dx, dy, dist;
84 };
85 
86 /* City map coordinates are positive integers shifted by the maximum
87  * radius the game engine allows (not the current ruleset) */
88 #define CITY_REL2ABS(_coor) (_coor + CITY_MAP_MAX_RADIUS)
89 #define CITY_ABS2REL(_coor) (_coor - CITY_MAP_MAX_RADIUS)
90 
91 bool city_tile_index_to_xy(int *city_map_x, int *city_map_y,
92  int city_tile_index, int city_radius_sq);
93 int city_tile_xy_to_index(int city_map_x, int city_map_y,
94  int city_radius_sq);
95 
97 int city_map_radius_sq_get(const struct city *pcity);
98 void city_map_radius_sq_set(struct city *pcity, int radius_sq);
99 int city_map_tiles(int city_radius_sq);
100 #define city_map_tiles_from_city(_pcity) \
101  city_map_tiles(city_map_radius_sq_get(_pcity))
102 
103 void citylog_map_data(QtMsgType level, int radius_sq, int *map_data);
104 void citylog_map_workers(QtMsgType level, struct city *pcity);
105 
106 /* Iterate over the tiles of a city map. Starting at a given city radius
107  * (the city center is _radius_sq_min = 0) outward to the tiles of
108  * _radius_sq_max. (_x, _y) will be the valid elements of
109  * [0, CITY_MAP_MAX_SIZE] taking into account the city radius. */
110 #define city_map_iterate_outwards_radius_sq_index( \
111  _radius_sq_min, _radius_sq_max, _index, _x, _y) \
112  { \
113  fc_assert(_radius_sq_min <= _radius_sq_max); \
114  int _x = 0, _y = 0, _index; \
115  int _x##_y##_index = city_map_tiles(_radius_sq_min); \
116  while ( \
117  city_tile_index_to_xy(&_x, &_y, _x##_y##_index, _radius_sq_max)) { \
118  _index = _x##_y##_index; \
119  _x##_y##_index++;
120 
121 #define city_map_iterate_outwards_radius_sq_index_end \
122  } \
123  }
124 
125 // Same as above, but don't set index
126 #define city_map_iterate_outwards_radius_sq(_radius_sq_min, _radius_sq_max, \
127  _x, _y) \
128  { \
129  fc_assert(_radius_sq_min <= _radius_sq_max); \
130  int _x = 0, _y = 0; \
131  int _x##_y##_index = city_map_tiles(_radius_sq_min); \
132  while ( \
133  city_tile_index_to_xy(&_x, &_y, _x##_y##_index, _radius_sq_max)) { \
134  _x##_y##_index++;
135 
136 #define city_map_iterate_outwards_radius_sq_end \
137  } \
138  }
139 
140 /* Iterate a city map. This iterates over all city positions in the city
141  * map starting at the city center (i.e., positions that are workable by
142  * the city) using the index (_index) and the coordinates (_x, _y). It
143  * is an abbreviation for city_map_iterate_outwards_radius_sq(_end). */
144 #define city_map_iterate(_radius_sq, _index, _x, _y) \
145  city_map_iterate_outwards_radius_sq_index(CITY_MAP_CENTER_RADIUS_SQ, \
146  _radius_sq, _index, _x, _y)
147 
148 #define city_map_iterate_end city_map_iterate_outwards_radius_sq_index_end
149 
150 #define city_map_iterate_without_index(_radius_sq, _x, _y) \
151  city_map_iterate_outwards_radius_sq(CITY_MAP_CENTER_RADIUS_SQ, \
152  _radius_sq, _x, _y)
153 
154 #define city_map_iterate_without_index_end \
155  city_map_iterate_outwards_radius_sq_end
156 
157 // Iterate the tiles between two radii of a city map.
158 #define city_map_iterate_radius_sq(_radius_sq_min, _radius_sq_max, _x, _y) \
159  city_map_iterate_outwards_radius_sq(_radius_sq_min, _radius_sq_max, _x, _y)
160 
161 #define city_map_iterate_radius_sq_end \
162  city_map_iterate_outwards_radius_sq_end
163 
164 /* Iterate a city map in checked real map coordinates.
165  * _radius_sq is the squared city radius.
166  * _city_tile is the center of the (possible) city.
167  * (_index) will be the city tile index in the intervall
168  * [0, city_map_tiles(_radius_sq)] */
169 #define city_tile_iterate_index(_radius_sq, _city_tile, _tile, _index) \
170  { \
171  city_map_iterate_outwards_radius_sq_index(CITY_MAP_CENTER_RADIUS_SQ, \
172  _radius_sq, _index, _x, \
173  _y) struct tile *_tile = \
174  city_map_to_tile(_city_tile, _radius_sq, _x, _y); \
175  if (nullptr != _tile) {
176 
177 #define city_tile_iterate_index_end \
178  } \
179  } \
180  city_map_iterate_outwards_radius_sq_index_end;
181 
182 // simple extension to skip the city center.
183 #define city_tile_iterate_skip_center(_radius_sq, _city_tile, _tile, \
184  _index, _x, _y) \
185  { \
186  city_map_iterate(_radius_sq, _index, _x, _y) \
187  { \
188  if (!is_city_center_index(_index)) { \
189  struct tile *_tile = \
190  city_map_to_tile(_city_tile, _radius_sq, _x, _y); \
191  if (nullptr != _tile) {
192 
193 #define city_tile_iterate_skip_center_end \
194  } \
195  } \
196  } \
197  city_map_iterate_end; \
198  }
199 
200 /* Does the same thing as city_tile_iterate_index, but keeps the city
201  * coordinates hidden. */
202 #define city_tile_iterate(_radius_sq, _city_tile, _tile) \
203  { \
204  city_map_iterate_outwards_radius_sq( \
205  CITY_MAP_CENTER_RADIUS_SQ, _radius_sq, _x, _y) struct tile *_tile = \
206  city_map_to_tile(_city_tile, _radius_sq, _x, _y); \
207  if (nullptr != _tile) {
208 
209 #define city_tile_iterate_end \
210  } \
211  } \
212  city_map_iterate_outwards_radius_sq_end;
213 
214 /* Improvement status (for cities' lists of improvements)
215  * (replaced Impr_Status) */
216 
217 struct built_status {
218  int turn; // turn built, negative for old state
219 #define I_NEVER (-1) // Improvement never built
220 #define I_DESTROYED (-2) // Improvement built and destroyed
221 };
222 
223 /* How much this output type is penalized for unhappy cities: not at all,
224  * surplus knocked down to 0, or all production removed. */
229 };
230 
231 struct output_type {
232  int index;
233  const char *name; // Untranslated name
234  const char *id; // Identifier string (for rulesets, etc.)
235  bool harvested; // Is this output type gathered by city workers?
237 };
238 
246 };
247 
248 /* changing this order will break network compatibility,
249  * and clients that don't use the symbols. */
251  FEELING_BASE, // before any of the modifiers below
252  FEELING_LUXURY, // after luxury
253  FEELING_EFFECT, // after building effects
254  FEELING_NATIONALITY, // after citizen nationality effects
255  FEELING_MARTIAL, // after units enforce martial order
256  FEELING_FINAL, // after wonders (final result)
258 };
259 
260 // Ways city output can be lost. Not currently part of network protocol.
262  OLOSS_WASTE, // regular corruption or waste
263  OLOSS_SIZE, /* notradesize/fulltradesize */
264  OLOSS_LAST
265 };
266 
267 /* This enumerators are used at client side only (so changing it doesn't
268  * break the compability) to mark that the city need specific gui updates
269  * (e.g. city dialog, or city report). */
274  CU_POPUP_DIALOG = 1 << 2
275 };
276 
278 struct cached_waste {
279  int level = 0; // EFT_OUTPUT_WASTE
280  int relative = 0; // EFT_OUTPUT_WASTE_PCT
281  int by_distance = 0; // EFT_OUTPUT_WASTE_BY_DISTANCE
282  int by_rel_distance = 0; // EFT_OUTPUT_WASTE_BY_REL_DISTANCE
283 };
284 
285 struct tile_cache; // defined and only used within city.c
286 
287 struct adv_city; /* defined in ./server/advisors/infracache.h */
288 
289 struct cm_parameter; /* defined in ./common/aicore/cm.h */
290 
291 struct city {
293  struct tile *tile; // May be nullptr, should check!
294  struct player *owner; // Cannot be nullptr.
295  struct player *original; // Cannot be nullptr.
296  int id;
297  int style;
298  enum capital_type capital;
299 
300  // the people
303 
304  // Specialists
306 
307  citizens martial_law; // Citizens pacified by martial law.
308  citizens unit_happy_upkeep; // Citizens angered by military action.
309 
310  citizens *nationality; // Nationality of the citizens.
311 
312  // trade routes
313  struct trade_route_list *routes;
314 
315  /* Tile output, regardless of if the tile is actually worked. It is used
316  * as cache for the output of the tiles within the city map.
317  * (see city_tile_cache_update() and city_tile_cache_get_output()) */
319  /* The memory allocated for tile_cache is valid for this squared city
320  * radius. */
322 
323  // the productions
324  int surplus[O_LAST]; // Final surplus in each category.
325  int waste[O_LAST]; /* Waste/corruption in each category. */
326  int unhappy_penalty[O_LAST]; // Penalty from unhappy cities.
327  int prod[O_LAST]; // Production is total minus waste and penalty.
328  int citizen_base[O_LAST]; // Base production from citizens.
329  int usage[O_LAST]; // Amount of each resource being used.
330 
331  /* Surplus saved for use during city processing loop */
333 
334  // Cached values for CPU savings.
335  int bonus[O_LAST];
336 
337  // the physics
340  int pollution; // not saved
341  int illness_trade; /* not saved; illness due to trade; it is
342  calculated within the server and send to
343  the clients as the clients do not have all
344  information about the trade cities */
345  int turn_plague; // last turn with an illness in the city
346  int city_radius_sq; // current squared city radius
347 
348  // turn states
349  int airlift;
351  bool did_buy;
352  bool did_sell;
353  bool was_happy;
354 
355  int anarchy; // anarchy rounds count
356  int rapture; // rapture rounds count
359 
360  int before_change_shields; /* If changed this turn, shields before penalty
361  */
362  int caravan_shields; // If caravan has helped city to build wonder.
363  int disbanded_shields; // If you disband unit in a city. Count them
364  int last_turns_shield_surplus; // The surplus we had last turn.
365 
366  struct built_status built[B_LAST];
367 
368  struct universal production;
369 
370  // If changed this turn, what we changed from
371  struct universal changed_from;
372 
373  struct worklist worklist;
374 
375  bv_city_options city_options;
376 
377  struct unit_list *units_supported;
378 
379  int history; // Cumulative culture
380 
381  struct worker_task_list *task_reqs;
382 
383  int steal; // diplomats steal once; for spies, gets harder
384 
385  struct {
386  int length;
387  // If true, rally point is active until owner cancels or loses city.
389  // Orders should be cleared if an enemy is met.
390  bool vigilant;
393 
395 
396  union {
397  struct {
398  /* Only used in the server (./ai/ and ./server/). */
399 
400  float migration_score; // updated by city_migration_score.
401  int mgr_score_calc_turn; // turn the migration score was calculated
402 
403  int illness;
404 
405  // If > 0, workers will not be rearranged until they are unfrozen.
407 
408  /* If set, workers need to be arranged when the city is unfrozen.
409  * Set inside auto_arrange_workers() and city_freeze_workers_queue().
410  */
412 
413  /* If set, city needs to be refreshed at a later time.
414  * Set inside city_refresh() and city_refresh_queue_add(). */
416 
417  // the city map is synced with the client.
418  bool synced;
419 
420  bool debug; // not saved
421 
422  struct adv_city *adv;
423  void *ais[FREECIV_AI_MOD_LAST];
424 
425  struct vision *vision;
426 
427  /* when city production was changed by player */
431 
432  struct {
433  /* Only used at the client (the server is omniscient; ./client/). */
434  bool full; // Did we get a full city info packet (owner or investigate)
435  bool occupied;
436  int walls;
437  bool happy;
438  bool unhappy;
440  int culture;
441  int buy_cost;
442 
443  /* The color is an index into the city_colors array in mapview_common
444  */
445  bool colored;
447 
448  /* info for dipl/spy investigation */
449  struct unit_list *info_units_supported;
450  struct unit_list *info_units_present;
451  /* Before popup the city dialog, units go there. In normal process,
452  * these pointers are set to nullptr. */
454  struct unit_list *collecting_info_units_present;
455 
456  // Updates needed for the city.
458 
459  unsigned char first_citizen_index;
461  };
462 };
463 
464 struct citystyle {
465  struct name_translation name;
470  struct requirement_vector reqs;
471 };
472 
473 extern struct citystyle *city_styles;
474 extern const Output_type_id num_output_types;
475 extern struct output_type output_types[];
476 
477 // get 'struct city_list' and related functions:
478 #define SPECLIST_TAG city
479 #define SPECLIST_TYPE struct city
480 #include "speclist.h"
481 
482 #define city_list_iterate(citylist, pcity) \
483  TYPED_LIST_ITERATE(struct city, citylist, pcity)
484 #define city_list_iterate_end LIST_ITERATE_END
485 
486 #define cities_iterate(pcity) \
487  { \
488  players_iterate(pcity##_player) \
489  { \
490  city_list_iterate(pcity##_player->cities, pcity) \
491  {
492 
493 #define cities_iterate_end \
494  } \
495  city_list_iterate_end; \
496  } \
497  players_iterate_end; \
498  }
499 
500 #define city_list_iterate_safe(citylist, _city) \
501  { \
502  int _city##_size = city_list_size(citylist); \
503  \
504  if (_city##_size > 0) { \
505  int _city##_numbers[_city##_size]; \
506  int _city##_index = 0; \
507  \
508  city_list_iterate(citylist, _city) \
509  { \
510  _city##_numbers[_city##_index++] = _city->id; \
511  } \
512  city_list_iterate_end; \
513  \
514  for (_city##_index = 0; _city##_index < _city##_size; \
515  _city##_index++) { \
516  struct city *_city = \
517  game_city_by_number(_city##_numbers[_city##_index]); \
518  \
519  if (nullptr != _city) {
520 
521 #define city_list_iterate_safe_end \
522  } \
523  } \
524  } \
525  }
526 
527 // output type functions
528 
529 const char *get_output_identifier(Output_type_id output);
530 const char *get_output_name(Output_type_id output);
534  const struct city *pcity, int *output,
535  const std::vector<std::array<int, O_LAST>> *pcsoutputs = nullptr);
537  struct city *pcity, const std::vector<city *> &gov_centers,
538  const std::array<cached_waste, O_LAST> *pcwaste = nullptr);
539 
540 // properties
541 
542 const char *city_name_get(const struct city *pcity);
543 struct player *city_owner(const struct city *pcity);
544 struct tile *city_tile(const struct city *pcity);
545 
546 citizens city_size_get(const struct city *pcity);
547 void city_size_add(struct city *pcity, int add);
548 void city_size_set(struct city *pcity, citizens size);
549 
550 citizens city_specialists(const struct city *pcity);
551 
552 int player_base_citizen_happiness(const struct player *pplayer);
553 citizens player_content_citizens(const struct player *pplayer);
554 citizens player_angry_citizens(const struct player *pplayer);
555 
556 int city_population(const struct city *pcity);
557 int city_total_impr_gold_upkeep(const struct city *pcity);
558 int city_total_unit_gold_upkeep(const struct city *pcity);
559 int city_unit_unhappiness(const unit *punit, int *free_unhappy);
560 bool city_happy(
561  const struct city *pcity); // generally use celebrating instead
562 bool city_unhappy(const struct city *pcity); // anarchy???
563 bool base_city_celebrating(const struct city *pcity);
564 bool city_celebrating(const struct city *pcity); // love the king ???
565 bool city_rapture_grow(const struct city *pcity);
566 bool city_is_occupied(const struct city *pcity);
567 
568 // city related improvement and unit functions
569 
570 int city_improvement_upkeep(const struct city *pcity,
571  const struct impr_type *pimprove);
572 
573 bool can_city_build_improvement_direct(const struct city *pcity,
574  const struct impr_type *pimprove);
575 bool can_city_build_improvement_later(const struct city *pcity,
576  const struct impr_type *pimprove);
577 bool can_city_build_improvement_now(const struct city *pcity,
578  const struct impr_type *pimprove);
579 
580 bool can_city_build_unit_direct(const struct city *pcity,
581  const struct unit_type *punittype);
582 bool can_city_build_unit_later(const struct city *pcity,
583  const struct unit_type *punittype);
584 bool can_city_build_unit_now(const struct city *pcity,
585  const struct unit_type *punittype);
586 
587 bool can_city_build_direct(const struct city *pcity,
588  const struct universal *target);
589 bool can_city_build_later(const struct city *pcity,
590  const struct universal *target);
591 bool can_city_build_now(const struct city *pcity,
592  const struct universal *target);
593 
594 int city_unit_slots_available(const struct city *pcity);
595 bool city_can_use_specialist(const struct city *pcity,
596  Specialist_type_id type);
597 bool city_has_building(const struct city *pcity,
598  const struct impr_type *pimprove);
599 bool is_capital(const struct city *pcity);
600 bool is_gov_center(const struct city *pcity);
601 bool city_got_defense_effect(const struct city *pcity,
602  const struct unit_type *attacker);
603 
604 int city_production_build_shield_cost(const struct city *pcity);
605 bool city_production_build_units(const struct city *pcity,
606  bool add_production, int *num_units);
607 int city_production_unit_veteran_level(struct city *pcity,
608  const struct unit_type *punittype);
609 
610 bool city_production_has_flag(const struct city *pcity,
611  enum impr_flag_id flag);
612 int city_production_turns_to_build(const struct city *pcity,
613  bool include_shield_stock);
614 
615 bool city_production_gets_caravan_shields(const struct universal *tgt);
616 
617 int city_change_production_penalty(const struct city *pcity,
618  const struct universal *target);
619 int city_turns_to_build(const struct city *pcity,
620  const struct universal *target,
621  bool include_shield_stock);
622 int city_turns_to_grow(const struct city *pcity);
623 bool city_can_grow_to(const struct city *pcity, int pop_size);
624 bool city_can_change_build(const struct city *pcity);
625 
626 void city_choose_build_default(struct city *pcity);
627 
628 // textual representation of buildings
629 
630 const char *
631 city_improvement_name_translation(const struct city *pcity,
632  const struct impr_type *pimprove);
633 const char *city_production_name_translation(const struct city *pcity);
634 
635 // city map functions
636 bool is_valid_city_coords(const int city_radius_sq, const int city_map_x,
637  const int city_map_y);
638 bool city_map_includes_tile(const struct city *const pcity,
639  const struct tile *map_tile);
640 bool city_base_to_city_map(int *city_map_x, int *city_map_y,
641  const struct city *const pcity,
642  const struct tile *map_tile);
643 bool city_tile_to_city_map(int *city_map_x, int *city_map_y,
644  const int city_radius_sq,
645  const struct tile *city_center,
646  const struct tile *map_tile);
647 
648 struct tile *city_map_to_tile(const struct tile *city_center,
649  int city_radius_sq, int city_map_x,
650  int city_map_y);
651 
652 // Initialization functions
653 int compare_iter_index(const void *a, const void *b);
655 void free_city_map_index();
657 
658 // output on spot
659 int city_tile_output(const struct city *pcity, const struct tile *ptile,
660  bool is_celebrating, Output_type_id otype);
661 int city_tile_output_now(const struct city *pcity, const struct tile *ptile,
662  Output_type_id otype);
663 
664 bool base_city_can_work_tile(const struct player *restriction,
665  const struct city *pcity,
666  const struct tile *ptile);
667 bool city_can_work_tile(const struct city *pcity, const struct tile *ptile);
668 
669 bool citymindist_prevents_city_on_tile(const struct tile *ptile);
670 
671 bool city_can_be_built_here(const struct tile *ptile,
672  const struct unit *punit);
673 bool city_can_be_built_tile_only(const struct tile *ptile);
674 
675 // list functions
676 struct city *city_list_find_number(struct city_list *This, int id);
677 struct city *city_list_find_name(struct city_list *This, const char *name);
678 
679 // city style functions
680 const char *city_style_rule_name(const int style);
681 
682 int city_style_by_rule_name(const char *s);
683 
684 struct city *is_enemy_city_tile(const struct tile *ptile,
685  const struct player *pplayer);
686 struct city *is_allied_city_tile(const struct tile *ptile,
687  const struct player *pplayer);
688 struct city *is_non_attack_city_tile(const struct tile *ptile,
689  const struct player *pplayer);
690 struct city *is_non_allied_city_tile(const struct tile *ptile,
691  const struct player *pplayer);
692 
693 bool is_unit_near_a_friendly_city(const struct unit *punit);
694 bool is_friendly_city_near(const struct player *owner,
695  const struct tile *ptile);
696 bool city_exists_within_max_city_map(const struct tile *ptile,
697  bool may_be_on_center);
698 
699 // granary size as a function of city size
700 int city_granary_size(int city_size);
701 
702 void city_add_improvement(struct city *pcity,
703  const struct impr_type *pimprove);
704 void city_remove_improvement(struct city *pcity,
705  const struct impr_type *pimprove);
706 
707 // city update functions
709  struct city *pcity, bool *workers_map,
710  const std::vector<city *> &gov_centers,
711  const std::array<cached_waste, O_LAST> *pcwaste = nullptr,
712  const std::vector<std::array<int, O_LAST>> *pcsoutputs = nullptr);
713 int city_waste(const struct city *pcity, Output_type_id otype, int total,
714  int *breakdown, const std::vector<city *> &gov_centers,
715  const cached_waste *pcwaste = nullptr);
717  const struct city *pcity);
718 int get_final_city_output_bonus(const struct city *pcity,
719  Output_type_id otype);
720 bool city_built_last_turn(const struct city *pcity);
721 
722 /* city creation / destruction */
723 struct city *create_city_virtual(struct player *pplayer, struct tile *ptile,
724  const char *name);
725 void destroy_city_virtual(struct city *pcity);
726 bool city_is_virtual(const struct city *pcity);
727 
728 // misc
729 bool is_city_option_set(const struct city *pcity, enum city_options option);
730 void city_styles_alloc(int num);
731 void city_styles_free();
732 
733 void add_tax_income(const struct player *pplayer, int trade, int *output);
734 int get_city_tithes_bonus(const struct city *pcity);
735 int city_pollution_types(const struct city *pcity, int shield_total,
736  int trade_total, int *pollu_prod, int *pollu_trade,
737  int *pollu_pop, int *pollu_mod);
738 int city_pollution(const struct city *pcity, int shield_total,
739  int trade_total);
740 int city_illness_calc(const struct city *pcity, int *ill_base, int *ill_size,
741  int *ill_trade, int *ill_pollution);
742 bool city_had_recent_plague(const struct city *pcity);
743 int city_build_slots(const struct city *pcity);
744 int city_airlift_max(const struct city *pcity);
745 
746 bool city_exist(int id);
747 
748 /*
749  * Iterates over all improvements, skipping those not yet built in the
750  * given city.
751  */
752 #define city_built_iterate(_pcity, _p) \
753  improvement_iterate(_p) \
754  { \
755  if ((_pcity)->built[improvement_index(_p)].turn <= I_NEVER) { \
756  continue; \
757  }
758 
759 #define city_built_iterate_end \
760  } \
761  improvement_iterate_end;
762 
763 // Iterates over all output types in the game.
764 #define output_type_iterate(output) \
765  { \
766  int ioutput; \
767  \
768  for (ioutput = 0; ioutput < O_LAST; ioutput++) { \
769  Output_type_id output = (enum output_type_id) ioutput;
770 
771 #define output_type_iterate_end \
772  } \
773  }
774 
775 // ===
776 
777 bool is_city_center(const struct city *pcity, const struct tile *ptile);
778 #define is_city_center_index(city_tile_index) \
779  (CITY_MAP_CENTER_TILE_INDEX == city_tile_index)
780 
781 void *city_ai_data(const struct city *pcity, const struct ai_type *ai);
782 void city_set_ai_data(struct city *pcity, const struct ai_type *ai,
783  void *data);
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...
Definition: city.cpp:1555
bool city_is_virtual(const struct city *pcity)
Return TRUE if the city is a virtual city.
Definition: city.cpp:3478
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: city.cpp:1401
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.
Definition: city.cpp:1865
struct output_type * get_output_type(Output_type_id output)
Return the output type for this index.
Definition: city.cpp:611
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.
Definition: city.cpp:2013
int rs_max_city_radius_sq()
Maximum city radius in this ruleset.
Definition: city.cpp:152
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_WON...
Definition: city.cpp:1752
void city_map_radius_sq_set(struct city *pcity, int radius_sq)
Returns the current squared radius of the city.
Definition: city.cpp:141
int city_production_build_shield_cost(const struct city *pcity)
Return the number of shields it takes to build current city production.
Definition: city.cpp:701
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 p...
Definition: city.cpp:912
int city_granary_size(int city_size)
Generalized formula used to calculate granary size.
Definition: city.cpp:2034
citizens player_angry_citizens(const struct player *pplayer)
Give base number of angry citizens in any city owned by pplayer.
Definition: city.cpp:2098
void city_set_ai_data(struct city *pcity, const struct ai_type *ai, void *data)
Attach ai data to city.
Definition: city.cpp:3517
output_unhappy_penalty
Definition: city.h:225
@ UNHAPPY_PENALTY_ALL_PRODUCTION
Definition: city.h:228
@ UNHAPPY_PENALTY_NONE
Definition: city.h:226
@ UNHAPPY_PENALTY_SURPLUS
Definition: city.h:227
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...
Definition: city.cpp:2183
bool can_city_build_now(const struct city *pcity, const struct universal *target)
Returns whether city can immediately build given target, unit or improvement.
Definition: city.cpp:953
void city_styles_free()
De-allocate the memory used by the city styles.
Definition: city.cpp:3327
struct city * city_list_find_number(struct city_list *This, int id)
Find city with given id from list.
Definition: city.cpp:1598
struct city * is_non_allied_city_tile(const struct tile *ptile, const struct player *pplayer)
Is there an non_allied city on this tile?
Definition: city.cpp:1968
int city_build_slots(const struct city *pcity)
The maximum number of units a city can build per turn.
Definition: city.cpp:2809
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
Return TRUE iff the city has this building in it.
Definition: city.cpp:1189
struct city * is_enemy_city_tile(const struct tile *ptile, const struct player *pplayer)
Is there an enemy city on this tile?
Definition: city.cpp:1923
struct player * city_owner(const struct city *pcity)
Return the owner of the city.
Definition: city.cpp:1083
citizen_category
Definition: city.h:239
@ CITIZEN_LAST
Definition: city.h:244
@ CITIZEN_SPECIALIST
Definition: city.h:245
@ CITIZEN_ANGRY
Definition: city.h:243
@ CITIZEN_HAPPY
Definition: city.h:240
@ CITIZEN_CONTENT
Definition: city.h:241
@ CITIZEN_UNHAPPY
Definition: city.h:242
int player_base_citizen_happiness(const struct player *pplayer)
Give base happiness in any city owned by pplayer.
Definition: city.cpp:2062
city_updates
Definition: city.h:270
@ CU_POPUP_DIALOG
Definition: city.h:274
@ CU_UPDATE_REPORT
Definition: city.h:272
@ CU_UPDATE_DIALOG
Definition: city.h:273
@ CU_NO_UPDATE
Definition: city.h:271
struct city * is_allied_city_tile(const struct tile *ptile, const struct player *pplayer)
Is there an friendly city on this tile?
Definition: city.cpp:1938
Output_type_id output_type_by_identifier(const char *id)
Find the output type for this output identifier.
Definition: city.cpp:620
bool is_capital(const struct city *pcity)
Return TRUE iff this city is its nation's capital.
Definition: city.cpp:1495
void citylog_map_workers(QtMsgType level, struct city *pcity)
Display the location of the workers within the city map of pcity.
Definition: city.cpp:435
struct citystyle * city_styles
Definition: city.cpp:78
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.
Definition: city.cpp:1202
void city_styles_alloc(int num)
Allocate memory for this amount of city styles.
Definition: city.cpp:3312
struct city * is_non_attack_city_tile(const struct tile *ptile, const struct player *pplayer)
Is there an enemy city on this tile?
Definition: city.cpp:1953
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 ...
Definition: city.cpp:1339
int city_unit_slots_available(const struct city *pcity)
Return number of free unit slots in a city.
Definition: city.cpp:987
void city_remove_improvement(struct city *pcity, const struct impr_type *pimprove)
Removes an improvement (and its effects) from a city.
Definition: city.cpp:3287
int city_airlift_max(const struct city *pcity)
A city's maximum airlift capacity.
Definition: city.cpp:2819
bool is_city_option_set(const struct city *pcity, enum city_options option)
Returns TRUE iff the city has set the given option.
Definition: city.cpp:3304
int city_population(const struct city *pcity)
Returns how many thousand citizen live in this city.
Definition: city.cpp:1137
struct tile * city_tile(const struct city *pcity)
Return the tile location of the city.
Definition: city.cpp:1095
void city_size_add(struct city *pcity, int add)
Add a (positive or negative) value to the city size.
Definition: city.cpp:1112
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: city.cpp:1005
bool city_production_has_flag(const struct city *pcity, enum impr_flag_id flag)
Return TRUE when the current production has this flag.
Definition: city.cpp:691
bool city_is_occupied(const struct city *pcity)
Returns TRUE iff the city is occupied.
Definition: city.cpp:1584
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.
Definition: city.cpp:298
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.
Definition: city.cpp:1477
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?
Definition: city.cpp:768
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).
Definition: city.cpp:2150
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: city.cpp:815
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: city.cpp:95
bool city_got_defense_effect(const struct city *pcity, const struct unit_type *attacker)
This can be City Walls, Coastal defense...
Definition: city.cpp:1512
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.
Definition: city.cpp:1423
int city_pollution(const struct city *pcity, int shield_total, int trade_total)
Calculate pollution for the city.
Definition: city.cpp:2692
citizens player_content_citizens(const struct player *pplayer)
Give base number of content citizens in any city owned by pplayer.
Definition: city.cpp:2088
bool city_map_includes_tile(const struct city *const pcity, const struct tile *map_tile)
Returns TRUE iff pcity's city map includes the specified tile.
Definition: city.cpp:286
int get_city_tithes_bonus(const struct city *pcity)
Return the amount of gold generated by buildings under "tithe" attribute governments.
Definition: city.cpp:2132
const char * city_name_get(const struct city *pcity)
Return the name of the city.
Definition: city.cpp:1077
bool city_rapture_grow(const struct city *pcity)
Returns whether city is growing by rapture.
Definition: city.cpp:1572
void * city_ai_data(const struct city *pcity, const struct ai_type *ai)
Return pointer to ai data of given city and ai type.
Definition: city.cpp:3509
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.
Definition: city.cpp:784
bool city_unhappy(const struct city *pcity)
Return TRUE iff the city is unhappy.
Definition: city.cpp:1544
Specialist_type_id best_specialist(Output_type_id otype, const struct city *pcity)
Return the "best" specialist available in the game.
Definition: city.cpp:3247
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: city.cpp:2114
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.
Definition: city.cpp:3052
bool city_celebrating(const struct city *pcity)
cities celebrate only after consecutive happy turns
Definition: city.cpp:1564
const char * city_improvement_name_translation(const struct city *pcity, const struct impr_type *pimprove)
Return the extended name of the building.
Definition: city.cpp:635
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: city.cpp:795
void generate_city_map_indices()
Fill the arrays city_map_index, city_map_xy and city_map_numtiles.
Definition: city.cpp:499
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:
Definition: city.cpp:2746
int city_unit_unhappiness(const unit *punit, int *free_unhappy)
Query unhappiness caused by a given unit.
Definition: city.cpp:2921
bool city_can_grow_to(const struct city *pcity, int pop_size)
Return TRUE iff the city can grow to the given size.
Definition: city.cpp:1914
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...
Definition: city.cpp:1777
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...
Definition: city.cpp:181
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.
Definition: city.cpp:404
citizen_feeling
Definition: city.h:250
@ FEELING_EFFECT
Definition: city.h:253
@ FEELING_LUXURY
Definition: city.h:252
@ FEELING_FINAL
Definition: city.h:256
@ FEELING_LAST
Definition: city.h:257
@ FEELING_BASE
Definition: city.h:251
@ FEELING_NATIONALITY
Definition: city.h:254
@ FEELING_MARTIAL
Definition: city.h:255
bool city_happy(const struct city *pcity)
Return TRUE iff the city is happy.
Definition: city.cpp:1531
void city_size_set(struct city *pcity, citizens size)
Set the city size.
Definition: city.cpp:1126
void city_add_improvement(struct city *pcity, const struct impr_type *pimprove)
Adds an improvement (and its effects) to a city.
Definition: city.cpp:3272
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.
Definition: city.cpp:2239
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.
Definition: city.cpp:1322
int city_map_radius_sq_get(const struct city *pcity)
Returns the current squared radius of the city.
Definition: city.cpp:130
bool can_city_build_direct(const struct city *pcity, const struct universal *target)
Returns whether city can immediately build given target, unit or improvement.
Definition: city.cpp:935
const char * get_output_identifier(Output_type_id output)
Return an id string for the output type.
Definition: city.cpp:592
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.
Definition: city.cpp:274
output_loss
Definition: city.h:261
@ OLOSS_SIZE
Definition: city.h:263
@ OLOSS_WASTE
Definition: city.h:262
@ OLOSS_LAST
Definition: city.h:264
void destroy_city_virtual(struct city *pcity)
Removes the virtual skeleton of a city.
Definition: city.cpp:3421
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.
Definition: city.cpp:257
citizens city_specialists(const struct city *pcity)
Give the number of specialists in a city.
Definition: city.cpp:3228
struct city * city_list_find_name(struct city_list *This, const char *name)
Find city with given name from list.
Definition: city.cpp:1616
const char * city_style_rule_name(const int style)
Return the (untranslated) rule name of the city style.
Definition: city.cpp:1651
const Output_type_id num_output_types
production_class_type
Definition: city.h:19
@ PCT_LAST
Definition: city.h:23
@ PCT_UNIT
Definition: city.h:20
@ PCT_NORMAL_IMPROVEMENT
Definition: city.h:21
@ PCT_WONDER
Definition: city.h:22
void city_choose_build_default(struct city *pcity)
Always tile_set_owner(ptile, pplayer) sometime before this!
Definition: city.cpp:1024
bool can_city_build_later(const struct city *pcity, const struct universal *target)
Returns whether city can ever build given target, unit or improvement.
Definition: city.cpp:970
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.
Definition: city.cpp:1230
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.
Definition: city.cpp:2830
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: city.cpp:117
bool is_gov_center(const struct city *pcity)
Return TRUE iff this city is governmental center.
Definition: city.cpp:1503
int city_map_tiles(int city_radius_sq)
Return the number of tiles for the given city radius.
Definition: city.cpp:164
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: city.cpp:1984
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.
Definition: city.cpp:860
void free_city_map_index()
Free memory allocated by generate_citymap_index.
Definition: city.cpp:581
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: city.cpp:2651
bool city_exist(int id)
Check if city with given id still exist.
Definition: city.cpp:3465
bool is_city_center(const struct city *pcity, const struct tile *ptile)
Return TRUE if the city is centered at the given tile.
Definition: city.cpp:3497
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 ...
Definition: city.cpp:1392
struct city * create_city_virtual(struct player *pplayer, struct tile *ptile, const char *name)
Create virtual skeleton for a city.
Definition: city.cpp:3346
const char * get_output_name(Output_type_id output)
Return a translated name for the output type.
Definition: city.cpp:602
int compare_iter_index(const void *a, const void *b)
Compare two iter_index values from the city_map_index.
Definition: city.cpp:335
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.
Definition: city.cpp:3108
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.
Definition: city.cpp:711
int city_turns_to_grow(const struct city *pcity)
Calculates the turns which are needed for the city to grow.
Definition: city.cpp:1897
citizens city_size_get(const struct city *pcity)
Get the city size.
Definition: city.cpp:1101
struct output_type output_types[]
Definition: city.cpp:82
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 c...
Definition: city.cpp:832
const char * city_production_name_translation(const struct city *pcity)
Return the extended name of the current production.
Definition: city.cpp:672
bool city_had_recent_plague(const struct city *pcity)
Returns whether city had a plague outbreak this turn.
Definition: city.cpp:2800
bool city_can_change_build(const struct city *pcity)
Returns TRUE iff the given city can change what it is building.
Definition: city.cpp:1016
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.
Definition: city.cpp:1168
int city_style_by_rule_name(const char *s)
Returns the city style that has the given (untranslated) rule name.
Definition: city.cpp:1633
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: city.cpp:1147
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.
Definition: city.cpp:894
void city_production_caravan_shields_init()
Initialize the cache of what city production can use shields from caravans.
Definition: city.cpp:1664
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).
Definition: city.cpp:1993
unsigned char citizens
Definition: fc_types.h:305
#define SP_MAX
Definition: fc_types.h:324
int Specialist_type_id
Definition: fc_types.h:292
#define MAX_LEN_NAME
Definition: fc_types.h:61
@ O_LAST
Definition: fc_types.h:91
#define MAX_LEN_CITYNAME
Definition: fc_types.h:62
enum output_type_id Output_type_id
Definition: fc_types.h:295
#define B_LAST
Definition: improvement.h:33
const char * name
Definition: inputfile.cpp:118
struct setting_list * level[OLEVELS_NUM]
Definition: settings.cpp:167
size_t size
Definition: specvec.h:64
Definition: ai.h:42
int turn
Definition: city.h:218
Used to cache the value of waste effects to speed up governors.
Definition: city.h:278
int level
Definition: city.h:279
int relative
Definition: city.h:280
int by_rel_distance
Definition: city.h:282
int by_distance
Definition: city.h:281
Definition: city.h:291
bool full
Definition: city.h:434
struct worker_task_list * task_reqs
Definition: city.h:381
struct tile_cache * tile_cache
Definition: city.h:318
struct city::@15::@18 client
int color_index
Definition: city.h:446
int turn_last_built
Definition: city.h:358
struct city::@14 rally_point
int surplus[O_LAST]
Definition: city.h:324
int food_stock
Definition: city.h:338
struct built_status built[B_LAST]
Definition: city.h:366
struct player * original
Definition: city.h:295
int history
Definition: city.h:379
int pollution
Definition: city.h:340
bool did_sell
Definition: city.h:352
int id
Definition: city.h:296
int saved_surplus[O_LAST]
Definition: city.h:332
int last_turns_shield_surplus
Definition: city.h:364
enum capital_type capital
Definition: city.h:298
int disbanded_shields
Definition: city.h:363
int waste[O_LAST]
Definition: city.h:325
int workers_frozen
Definition: city.h:406
int turn_plague
Definition: city.h:345
struct unit_list * info_units_present
Definition: city.h:450
bv_city_options city_options
Definition: city.h:375
citizens unit_happy_upkeep
Definition: city.h:308
time_t prod_change_timestamp
Definition: city.h:428
int city_radius_sq
Definition: city.h:346
bool was_happy
Definition: city.h:353
struct player * owner
Definition: city.h:294
int turn_founded
Definition: city.h:357
int airlift
Definition: city.h:349
int citizen_base[O_LAST]
Definition: city.h:328
int caravan_shields
Definition: city.h:362
bool did_buy
Definition: city.h:351
struct unit_list * info_units_supported
Definition: city.h:449
void * ais[FREECIV_AI_MOD_LAST]
Definition: city.h:423
struct trade_route_list * routes
Definition: city.h:313
int anarchy
Definition: city.h:355
bool occupied
Definition: city.h:435
int usage[O_LAST]
Definition: city.h:329
int tile_cache_radius_sq
Definition: city.h:321
struct universal production
Definition: city.h:368
struct unit_order * orders
Definition: city.h:391
int walls
Definition: city.h:436
bool happy
Definition: city.h:437
struct unit_list * collecting_info_units_supported
Definition: city.h:453
int bonus[O_LAST]
Definition: city.h:335
struct adv_city * adv
Definition: city.h:422
citizens * nationality
Definition: city.h:310
bool vigilant
Definition: city.h:390
int steal
Definition: city.h:383
int unhappy_penalty[O_LAST]
Definition: city.h:326
char name[MAX_LEN_CITYNAME]
Definition: city.h:292
citizens size
Definition: city.h:301
unsigned char first_citizen_index
Definition: city.h:459
int illness
Definition: city.h:403
int before_change_shields
Definition: city.h:360
int culture
Definition: city.h:440
int length
Definition: city.h:386
struct city::@15::@17 server
int bought_shields
Definition: city.h:350
int style
Definition: city.h:297
bool synced
Definition: city.h:418
float migration_score
Definition: city.h:400
bool needs_refresh
Definition: city.h:415
struct unit_list * collecting_info_units_present
Definition: city.h:454
int buy_cost
Definition: city.h:441
citizens feel[CITIZEN_LAST][FEELING_LAST]
Definition: city.h:302
citizens specialists[SP_MAX]
Definition: city.h:305
struct tile * tile
Definition: city.h:293
int shield_stock
Definition: city.h:339
int prod_change_turn
Definition: city.h:429
int prod[O_LAST]
Definition: city.h:327
struct vision * vision
Definition: city.h:425
bool needs_arrange
Definition: city.h:411
struct cm_parameter * cm_parameter
Definition: city.h:394
int city_image
Definition: city.h:439
bool debug
Definition: city.h:420
struct universal changed_from
Definition: city.h:371
bool colored
Definition: city.h:445
bool unhappy
Definition: city.h:438
struct unit_list * units_supported
Definition: city.h:377
int mgr_score_calc_turn
Definition: city.h:401
int illness_trade
Definition: city.h:341
enum city_updates need_updates
Definition: city.h:457
bool persistent
Definition: city.h:388
int rapture
Definition: city.h:356
citizens martial_law
Definition: city.h:307
struct requirement_vector reqs
Definition: city.h:470
char citizens_graphic[MAX_LEN_NAME]
Definition: city.h:468
char graphic_alt[MAX_LEN_NAME]
Definition: city.h:467
struct name_translation name
Definition: city.h:465
char graphic[MAX_LEN_NAME]
Definition: city.h:466
char citizens_graphic_alt[MAX_LEN_NAME]
Definition: city.h:469
int dist
Definition: city.h:83
int dx
Definition: city.h:83
int dy
Definition: city.h:83
The base class for options.
Definition: options.cpp:209
const char * id
Definition: city.h:234
enum output_unhappy_penalty unhappy_penalty
Definition: city.h:236
int index
Definition: city.h:232
bool harvested
Definition: city.h:235
const char * name
Definition: city.h:233
Definition: player.h:231
Definition: tile.h:42
Definition: unit.h:134
Definition: vision.h:83