Freeciv-3.1: /fast/freeciv/nightly/S3_1/common/city.h Source File

Freeciv-3.1

Loading...
Searching...
No Matches
city.h
Go to the documentation of this file.
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)
6 any later version.
7
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***********************************************************************/
13#ifndef FC__CITY_H
14#define FC__CITY_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* utility */
21#include "bitvector.h"
22#include "log.h"
23
24/* common */
25#include "fc_types.h"
26#include "name_translation.h"
27#include "improvement.h"
28#include "tile.h"
29#include "traderoutes.h"
30#include "unit.h"
31#include "unitlist.h"
32#include "vision.h"
33#include "workertask.h"
34#include "worklist.h"
35
36struct packet_city_rally_point;
37
38 enum production_class_type {
39 PCT_UNIT,
40 PCT_NORMAL_IMPROVEMENT,
41 PCT_WONDER,
42 PCT_LAST
43};
44
45/* Various city options. These are stored by the server and can be
46 * toggled by the user. Each one defaults to off. Adding new ones
47 * will break network compatibility. If you want to reorder or remove
48 * an option remember to load the city option order from the savegame.
49 * It is stored in savefile.city_options_vector
50 *
51 * Used in the network protocol.
52 */
53#define SPECENUM_NAME city_options
54/* If unit production (e.g. settler) is allowed to disband a small city */
55#define SPECENUM_VALUE0 CITYO_DISBAND
56#define SPECENUM_VALUE0NAME "Disband"
57/* If new citizens are science specialists */
58#define SPECENUM_VALUE1 CITYO_SCIENCE_SPECIALISTS
59#define SPECENUM_VALUE1NAME "Sci_Specialists"
60/* If new citizens are gold specialists */
61#define SPECENUM_VALUE2 CITYO_GOLD_SPECIALISTS
62#define SPECENUM_VALUE2NAME "Tax_Specialists"
63#define SPECENUM_COUNT CITYO_LAST
64#define SPECENUM_BITVECTOR bv_city_options
65#include "specenum_gen.h"
66
67/* Changing the max radius requires updating network capabilities and results
68 * in incompatible savefiles. */
69#define CITY_MAP_MIN_RADIUS 0
70#define CITY_MAP_DEFAULT_RADIUS 2
71#define CITY_MAP_MAX_RADIUS 5
72
73/* The city includes all tiles dx^2 + dy^2 <= CITY_MAP_*_RADIUS_SQ */
74#define CITY_MAP_DEFAULT_RADIUS_SQ \
75 (CITY_MAP_DEFAULT_RADIUS * CITY_MAP_DEFAULT_RADIUS + 1)
76#define CITY_MAP_MIN_RADIUS_SQ \
77 (CITY_MAP_MIN_RADIUS * CITY_MAP_MIN_RADIUS + 1)
78#define CITY_MAP_MAX_RADIUS_SQ \
79 (CITY_MAP_MAX_RADIUS * CITY_MAP_MAX_RADIUS + 1)
80/* the id for the city center */
81#define CITY_MAP_CENTER_RADIUS_SQ -1
82/* the tile index of the city center */
83#define CITY_MAP_CENTER_TILE_INDEX 0
84
85/* Maximum diameter of the workable city area. */
86#define CITY_MAP_MAX_SIZE (CITY_MAP_MAX_RADIUS * 2 + 1)
87
88#define INCITE_IMPOSSIBLE_COST (1000 * 1000 * 1000)
89
90/*
91 * Size of the biggest possible city.
92 *
93 * The constant may be changed since it isn't externally visible.
94 *
95 * The city size is saved as unsigned char. Therefore, MAX_CITY_SIZE should
96 * be below 255!
97 */
98#define MAX_CITY_SIZE 0xFF
99
100/* Iterate a city map, from the center (the city) outwards */
101 struct iter_index {
102 int dx, dy, dist;
103};
104
105/* City map coordinates are positive integers shifted by the maximum
106 * radius the game engine allows (not the current ruleset) */
107#define CITY_REL2ABS(_coor) (_coor + CITY_MAP_MAX_RADIUS)
108#define CITY_ABS2REL(_coor) (_coor - CITY_MAP_MAX_RADIUS)
109
110bool city_tile_index_to_xy(int *city_map_x, int *city_map_y,
111 int city_tile_index, int city_radius_sq);
112int city_tile_xy_to_index(int city_map_x, int city_map_y,
113 int city_radius_sq);
114
115int rs_max_city_radius_sq(void);
116int city_map_radius_sq_get(const struct city *pcity);
117void city_map_radius_sq_set(struct city *pcity, int radius_sq);
118int city_map_tiles(int city_radius_sq);
119#define city_map_tiles_from_city(_pcity) \
120 city_map_tiles(city_map_radius_sq_get(_pcity))
121
122void citylog_map_data(enum log_level level, int radius_sq, int *map_data);
123void citylog_map_workers(enum log_level level, struct city *pcity);
124
125/* Iterate over the tiles of a city map. Starting at a given city radius
126 * (the city center is _radius_sq_min = 0) outward to the tiles of
127 * _radius_sq_max. (_x, _y) will be the valid elements of
128 * [0, CITY_MAP_MAX_SIZE] taking into account the city radius. */
129#define city_map_iterate_outwards_radius_sq_index(_radius_sq_min, \
130 _radius_sq_max, \
131 _index, _x, _y) \
132{ \
133 fc_assert(_radius_sq_min <= _radius_sq_max); \
134 int _x = 0, _y = 0, _index; \
135 int _x##_y##_index = city_map_tiles(_radius_sq_min); \
136 while (city_tile_index_to_xy(&_x, &_y, _x##_y##_index, \
137 _radius_sq_max)) { \
138 _index = _x##_y##_index; \
139 _x##_y##_index++;
140
141#define city_map_iterate_outwards_radius_sq_index_end \
142 } \
143}
144
145 /* Same as above, but don't set index */
146#define city_map_iterate_outwards_radius_sq(_radius_sq_min, \
147 _radius_sq_max, \
148 _x, _y) \
149{ \
150 fc_assert(_radius_sq_min <= _radius_sq_max); \
151 int _x = 0, _y = 0; \
152 int _x##_y##_index = city_map_tiles(_radius_sq_min); \
153 while (city_tile_index_to_xy(&_x, &_y, _x##_y##_index, \
154 _radius_sq_max)) { \
155 _x##_y##_index++;
156
157#define city_map_iterate_outwards_radius_sq_end \
158 } \
159}
160
161/* Iterate a city map. This iterates over all city positions in the city
162 * map starting at the city center (i.e., positions that are workable by
163 * the city) using the index (_index) and the coordinates (_x, _y). It
164 * is an abbreviation for city_map_iterate_outwards_radius_sq(_end). */
165#define city_map_iterate(_radius_sq, _index, _x, _y) \
166 city_map_iterate_outwards_radius_sq_index(CITY_MAP_CENTER_RADIUS_SQ, \
167 _radius_sq, _index, _x, _y)
168
169#define city_map_iterate_end \
170 city_map_iterate_outwards_radius_sq_index_end
171
172#define city_map_iterate_without_index(_radius_sq, _x, _y) \
173 city_map_iterate_outwards_radius_sq(CITY_MAP_CENTER_RADIUS_SQ, \
174 _radius_sq, _x, _y)
175
176#define city_map_iterate_without_index_end \
177 city_map_iterate_outwards_radius_sq_end
178
179/* Iterate the tiles between two radii of a city map. */
180#define city_map_iterate_radius_sq(_radius_sq_min, _radius_sq_max, \
181 _x, _y) \
182 city_map_iterate_outwards_radius_sq(_radius_sq_min, _radius_sq_max, \
183 _x, _y)
184
185#define city_map_iterate_radius_sq_end \
186 city_map_iterate_outwards_radius_sq_end
187
188/* Iterate a city map in checked real map coordinates.
189 * _radius_sq is the squared city radius.
190 * _city_tile is the center of the (possible) city.
191 * (_index) will be the city tile index in the interval
192 * [0, city_map_tiles(_radius_sq)] */
193#define city_tile_iterate_index(_nmap, _radius_sq, _city_tile, _tile, \
194 _index) { \
195 city_map_iterate_outwards_radius_sq_index(CITY_MAP_CENTER_RADIUS_SQ, \
196 _radius_sq, _index, _x, _y) \
197 struct tile *_tile = city_map_to_tile(_nmap, _city_tile, _radius_sq, \
198 _x, _y); \
199 if (NULL != _tile) {
200
201#define city_tile_iterate_index_end \
202 } \
203 } city_map_iterate_outwards_radius_sq_index_end;
204
205/* simple extension to skip is_free_worked() tiles. */
206#define city_tile_iterate_skip_free_worked(_nmap, _radius_sq, _city_tile, \
207 _tile, _index, _x, _y) { \
208 city_map_iterate(_radius_sq, _index, _x, _y) { \
209 if (!is_free_worked_index(_index)) { \
210 struct tile *_tile = city_map_to_tile(_nmap, _city_tile, _radius_sq, \
211 _x, _y); \
212 if (NULL != _tile) {
213
214#define city_tile_iterate_skip_free_worked_end \
215 } \
216 } \
217 } city_map_iterate_end; \
218}
219
220/* Does the same thing as city_tile_iterate_index(), but keeps the city
221 * coordinates hidden. */
222#define city_tile_iterate(_nmap, _radius_sq, _city_tile, _tile) { \
223 const struct tile *_center##_tile = _city_tile; \
224 city_map_iterate_outwards_radius_sq(CITY_MAP_CENTER_RADIUS_SQ, \
225 _radius_sq, _x, _y) \
226 struct tile *_tile = city_map_to_tile(_nmap, _center##_tile, _radius_sq, \
227 _x, _y); \
228 if (NULL != _tile) {
229
230#define city_tile_iterate_end \
231 } \
232 } city_map_iterate_outwards_radius_sq_end;
233
234/* Improvement status (for cities' lists of improvements)
235 * (replaced Impr_Status) */
236
237 struct built_status {
238 int turn; /* turn built, negative for old state */
239#define I_NEVER (-1) /* Improvement never built */
240#define I_DESTROYED (-2) /* Improvement built and destroyed */
241};
242
243/* How much this output type is penalized for unhappy cities: not at all,
244 * surplus knocked down to 0, or all production removed. */
245 enum output_unhappy_penalty {
246 UNHAPPY_PENALTY_NONE,
247 UNHAPPY_PENALTY_SURPLUS,
248 UNHAPPY_PENALTY_ALL_PRODUCTION
249};
250
251 struct output_type {
252 int index;
253 const char *name; /* Untranslated name */
254 const char *id; /* Identifier string (for rulesets, etc.) */
255 bool harvested; /* Is this output type gathered by city workers? */
256 enum output_unhappy_penalty unhappy_penalty;
257};
258
259 enum citizen_category {
260 CITIZEN_HAPPY,
261 CITIZEN_CONTENT,
262 CITIZEN_UNHAPPY,
263 CITIZEN_ANGRY,
264 CITIZEN_LAST,
265 CITIZEN_SPECIALIST = CITIZEN_LAST,
266};
267
268/* changing this order will break network compatibility,
269 * and clients that don't use the symbols. */
270 enum citizen_feeling {
271 FEELING_BASE, /* before any of the modifiers below */
272 FEELING_LUXURY, /* after luxury */
273 FEELING_EFFECT, /* after building effects */
274 FEELING_NATIONALITY, /* after citizen nationality effects */
275 FEELING_MARTIAL, /* after units enforce martial order */
276 FEELING_FINAL, /* after wonders (final result) */
277 FEELING_LAST
278};
279
280/* Ways city output can be lost. Not currently part of network protocol. */
281 enum output_loss {
282 OLOSS_WASTE, /* regular corruption or waste */
283 OLOSS_SIZE, /* notradesize/fulltradesize */
284 OLOSS_LAST
285};
286
287/* This enumerators are used at client side only (so changing it doesn't
288 * break the compability) to mark that the city need specific gui updates
289 * (e.g. city dialog, or city report). */
290 enum city_updates {
291 CU_NO_UPDATE = 0,
292 CU_UPDATE_REPORT = 1 << 0,
293 CU_UPDATE_DIALOG = 1 << 1,
294 CU_POPUP_DIALOG = 1 << 2
295};
296
297 enum city_needs_arrange {
298 CNA_NOT = 0,
299 CNA_NORMAL,
300 CNA_BROADCAST_PENDING
301};
302
303struct tile_cache; /* defined and only used within city.c */
304
305struct adv_city; /* defined in ./server/advisors/infracache.h */
306
307struct cm_parameter; /* defined in ./common/aicore/cm.h */
308
309 struct city {
310 char *name;
311 struct tile *tile; /* May be NULL, should check! */
312 struct player *owner; /* Cannot be NULL. */
313 struct player *original; /* Often NULL in client,
314 * can be NULL on server after player removal */
315 int id;
316 int style;
317 enum capital_type capital;
318
319 /* the people */
320 citizens size;
321 citizens feel[CITIZEN_LAST][FEELING_LAST];
322
323 /* Specialists */
324 citizens specialists[SP_MAX];
325
326 citizens martial_law; /* Citizens pacified by martial law. */
327 citizens unit_happy_upkeep; /* Citizens angered by military action. */
328
329 citizens *nationality; /* Nationality of the citizens. */
330
331 /* trade routes */
332 struct trade_route_list *routes;
333
334 /* Tile output, regardless of if the tile is actually worked. It is used
335 * as cache for the output of the tiles within the city map.
336 * (see city_tile_cache_update() and city_tile_cache_get_output()) */
337 struct tile_cache *tile_cache;
338 /* The memory allocated for tile_cache is valid for this squared city
339 * radius. */
340 int tile_cache_radius_sq;
341
342 /* the productions */
343 int surplus[O_LAST]; /* Final surplus in each category. */
344 int waste[O_LAST]; /* Waste/corruption in each category. */
345 int unhappy_penalty[O_LAST]; /* Penalty from unhappy cities. */
346 int prod[O_LAST]; /* Production is total minus waste and penalty. */
347 int citizen_base[O_LAST]; /* Base production from citizens. */
348 int usage[O_LAST]; /* Amount of each resource being used. */
349
350 /* Cached values for CPU savings. */
351 int bonus[O_LAST];
352
353 /* the physics */
354 int food_stock;
355 int shield_stock;
356 int pollution; /* not saved */
357 int illness_trade; /* not saved; illness due to trade; it is
358 calculated within the server and send to
359 the clients as the clients do not have all
360 information about the trade cities */
361 int turn_plague; /* last turn with an illness in the city */
362 int city_radius_sq; /* current squared city radius */
363
364 /* turn states */
365 int airlift;
366 bool did_buy;
367 bool did_sell;
368 bool was_happy;
369
370 int anarchy; /* anarchy rounds count */
371 int rapture; /* rapture rounds count */
372 int turn_founded;
373 int turn_last_built;
374
375 int before_change_shields; /* If changed this turn, shields before penalty */
376 int caravan_shields; /* If caravan has helped city to build wonder. */
377 int disbanded_shields; /* If you disband unit in a city. Count them */
378 int last_turns_shield_surplus; /* The surplus we had last turn. */
379
380 struct built_status built[B_LAST];
381
382 struct universal production;
383
384 /* If changed this turn, what we changed from */
385 struct universal changed_from;
386
387 struct worklist worklist;
388
389 bv_city_options city_options;
390
391 struct unit_list *units_supported;
392
393 int history; /* Cumulative culture */
394
395 struct worker_task_list *task_reqs;
396
397 int steal; /* diplomats steal once; for spies, gets harder */
398
399 struct {
400 size_t length;
401 /* If true, rally point is active until owner cancels or loses city. */
402 bool persistent;
403 /* Orders should be cleared if an enemy is met. */
404 bool vigilant;
405 struct unit_order *orders;
406 } rally_point;
407
408 struct cm_parameter *cm_parameter;
409
410 union {
411 struct {
412 /* Only used in the server (./ai/ and ./server/). */
413
414 float migration_score; /* updated by city_migration_score. */
415 int mgr_score_calc_turn; /* turn the migration score was calculated */
416
417 int illness;
418
419 /* If > 0, workers will not be rearranged until they are unfrozen. */
420 int workers_frozen;
421
422 /* If set, workers need to be arranged when the city is unfrozen.
423 * Set inside auto_arrange_workers() and city_freeze_workers_queue(). */
424 enum city_needs_arrange needs_arrange;
425
426 /* If set, city needs to be refreshed at a later time.
427 * Set inside city_refresh() and city_refresh_queue_add(). */
428 bool needs_refresh;
429
430 /* the city map is synced with the client. */
431 bool synced;
432
433 bool debug; /* not saved */
434
435 struct adv_city *adv;
436 void *ais[FREECIV_AI_MOD_LAST];
437
438 struct vision *vision;
439 } server;
440
441 struct {
442 /* Only used at the client (the server is omniscient; ./client/). */
443 bool occupied;
444 int walls;
445 bool happy;
446 bool unhappy;
447 int city_image;
448 int culture;
449 int buy_cost;
450
451 /* The color is an index into the city_colors array in mapview_common */
452 bool colored;
453 int color_index;
454
455 /* info for dipl/spy investigation */
456 struct unit_list *info_units_supported;
457 struct unit_list *info_units_present;
458 /* Before popup the city dialog, units go there. In normal process,
459 * these pointers are set to NULL. */
460 struct unit_list *collecting_info_units_supported;
461 struct unit_list *collecting_info_units_present;
462
463 /* Updates needed for the city. */
464 enum city_updates need_updates;
465
466 unsigned char first_citizen_index;
467 } client;
468 };
469};
470
471 struct citystyle {
472 struct name_translation name;
473 char graphic[MAX_LEN_NAME];
474 char graphic_alt[MAX_LEN_NAME];
475 char citizens_graphic[MAX_LEN_NAME];
476 struct requirement_vector reqs;
477};
478
479extern struct citystyle *city_styles;
480extern const Output_type_id num_output_types;
481extern struct output_type output_types[];
482
483/* get 'struct city_list' and related functions: */
484#define SPECLIST_TAG city
485#define SPECLIST_TYPE struct city
486#include "speclist.h"
487
488#define city_list_iterate(citylist, pcity) \
489 TYPED_LIST_ITERATE(struct city, citylist, pcity)
490#define city_list_iterate_end LIST_ITERATE_END
491
492#define cities_iterate(pcity) \
493{ \
494 players_iterate(pcity##_player) { \
495 city_list_iterate(pcity##_player->cities, pcity) {
496
497#define cities_iterate_end \
498 } city_list_iterate_end; \
499 } players_iterate_end; \
500}
501
502#define city_list_iterate_safe(citylist, _city) \
503{ \
504 struct city_list *_city##_cl = citylist; \
505 int _city##_size = city_list_size(_city##_cl); \
506 \
507 if (_city##_size > 0) { \
508 int _city##_numbers[_city##_size]; \
509 int _city##_index; \
510 \
511 _city##_size = 0; \
512 city_list_iterate(_city##_cl, _city) { \
513 _city##_numbers[_city##_size++] = _city->id; \
514 } city_list_iterate_end; \
515 \
516 for (_city##_index = 0; \
517 _city##_index < _city##_size; \
518 _city##_index++) { \
519 struct city *_city = \
520 game_city_by_number(_city##_numbers[_city##_index]); \
521 \
522 if (NULL != _city) {
523
524#define city_list_iterate_safe_end \
525 } \
526 } \
527 } \
528}
529
530/* Output type functions */
531
532const char *get_output_identifier(Output_type_id output);
533const char *get_output_name(Output_type_id output);
534struct output_type *get_output_type(Output_type_id output);
535 Output_type_id output_type_by_identifier(const char *id);
536void add_specialist_output(const struct city *pcity, int *output);
537void set_city_production(struct city *pcity);
538
539/* Properties */
540
541const char *city_name_get(const struct city *pcity);
542void city_name_set(struct city *pcity, const char *new_name);
543#define city_owner(_pcity_) (_pcity_)->owner
544#define city_tile(_pcity_) (_pcity_)->tile
545
546/**********************************************************************/
549 static inline citizens city_size_get(const struct city *pcity)
550{
551 fc_assert_ret_val(pcity != NULL, 0);
552
553 return pcity->size;
554}
555
556void city_size_add(struct city *pcity, int add);
557void city_size_set(struct city *pcity, citizens size);
558
559 citizens city_specialists(const struct city *pcity);
560
561 citizens player_content_citizens(const struct player *pplayer);
562 citizens player_angry_citizens(const struct player *pplayer);
563
564int city_population(const struct city *pcity);
565int city_total_impr_gold_upkeep(const struct city *pcity);
566int city_total_unit_gold_upkeep(const struct city *pcity);
567int city_unit_unhappiness(struct unit *punit, int *free_unhappy);
568bool city_happy(const struct city *pcity); /* generally use celebrating instead */
569bool city_unhappy(const struct city *pcity); /* anarchy??? */
570bool base_city_celebrating(const struct city *pcity);
571bool city_celebrating(const struct city *pcity); /* love the king ??? */
572bool city_rapture_grow(const struct city *pcity);
573bool city_is_occupied(const struct city *pcity);
574
575/* city related improvement and unit functions */
576
577int city_improvement_upkeep(const struct city *pcity,
578 const struct impr_type *pimprove);
579
580bool can_city_build_improvement_direct(const struct city *pcity,
581 const struct impr_type *pimprove);
582bool can_city_build_improvement_later(const struct city *pcity,
583 const struct impr_type *pimprove);
584bool can_city_build_improvement_now(const struct city *pcity,
585 const struct impr_type *pimprove);
586
587bool can_city_build_unit_direct(const struct city *pcity,
588 const struct unit_type *punittype);
589bool can_city_build_unit_later(const struct city *pcity,
590 const struct unit_type *punittype);
591bool can_city_build_unit_now(const struct city *pcity,
592 const struct unit_type *punittype);
593
594bool can_city_build_direct(const struct city *pcity,
595 const struct universal *target);
596bool can_city_build_later(const struct city *pcity,
597 const struct universal *target);
598bool can_city_build_now(const struct city *pcity,
599 const struct universal *target);
600
601int city_unit_slots_available(const struct city *pcity);
602bool city_can_use_specialist(const struct city *pcity,
603 Specialist_type_id type);
604bool city_has_building(const struct city *pcity,
605 const struct impr_type *pimprove);
606bool is_capital(const struct city *pcity);
607bool is_gov_center(const struct city *pcity);
608bool city_got_defense_effect(const struct city *pcity,
609 const struct unit_type *attacker);
610
611int city_production_build_shield_cost(const struct city *pcity);
612bool city_production_build_units(const struct city *pcity,
613 bool add_production, int *num_units);
614int city_production_unit_veteran_level(struct city *pcity,
615 const struct unit_type *punittype);
616
617bool city_production_has_flag(const struct city *pcity,
618 enum impr_flag_id flag);
619int city_production_turns_to_build(const struct city *pcity,
620 bool include_shield_stock);
621
622bool city_production_gets_caravan_shields(const struct universal *tgt);
623
624int city_change_production_penalty(const struct city *pcity,
625 const struct universal *target);
626int city_turns_to_build(const struct city *pcity,
627 const struct universal *target,
628 bool include_shield_stock);
629int city_turns_to_grow(const struct city *pcity);
630bool city_can_grow_to(const struct city *pcity, int pop_size);
631bool city_can_change_build(const struct city *pcity);
632
633void city_choose_build_default(struct city *pcity);
634
635/* textual representation of buildings */
636
637const char *city_improvement_name_translation(const struct city *pcity,
638 const struct impr_type *pimprove);
639const char *city_production_name_translation(const struct city *pcity);
640
641/* city map functions */
642bool is_valid_city_coords(const int city_radius_sq, const int city_map_x,
643 const int city_map_y);
644bool city_map_includes_tile(const struct city *const pcity,
645 const struct tile *map_tile);
646bool city_base_to_city_map(int *city_map_x, int *city_map_y,
647 const struct city *const pcity,
648 const struct tile *map_tile);
649bool city_tile_to_city_map(int *city_map_x, int *city_map_y,
650 const int city_radius_sq,
651 const struct tile *city_center,
652 const struct tile *map_tile);
653
654struct tile *city_map_to_tile(const struct civ_map *nmap,
655 const struct tile *city_center,
656 int city_radius_sq, int city_map_x,
657 int city_map_y);
658
659/* Initialization functions */
660int compare_iter_index(const void *a, const void *b);
661void generate_city_map_indices(void);
662void free_city_map_index(void);
663void city_production_caravan_shields_init(void);
664
665/* Output on spot */
666int city_tile_output(const struct city *pcity, const struct tile *ptile,
667 bool is_celebrating, Output_type_id otype);
668int city_tile_output_now(const struct city *pcity, const struct tile *ptile,
669 Output_type_id otype);
670
671bool base_city_can_work_tile(const struct player *restriction,
672 const struct city *pcity,
673 const struct tile *ptile);
674bool city_can_work_tile(const struct city *pcity, const struct tile *ptile);
675
676bool citymindist_prevents_city_on_tile(const struct civ_map *nmap,
677 const struct tile *ptile);
678
679bool city_can_be_built_here(const struct tile *ptile,
680 const struct unit *punit,
681 bool hut_test);
682bool city_can_be_built_tile_only(const struct civ_map *nmap,
683 const struct tile *ptile);
684
685/* List functions */
686struct city *city_list_find_number(struct city_list *This, int id);
687struct city *city_list_find_name(struct city_list *This, const char *name);
688
689int city_name_compare(const void *p1, const void *p2);
690
691/* City style functions */
692const char *city_style_rule_name(const int style);
693const char *city_style_name_translation(const int style);
694
695int city_style_by_rule_name(const char *s);
696int city_style_by_translated_name(const char *s);
697
698struct city *tile_enemy_city(const struct tile *ptile,
699 const struct player *pplayer);
700
701/**********************************************************************/
704 static inline bool is_enemy_city_tile(const struct tile *ptile,
705 const struct player *pplayer)
706{
707 return NULL != tile_enemy_city(ptile, pplayer);
708}
709
710struct city *tile_allied_city(const struct tile *ptile,
711 const struct player *pplayer);
712
713/**********************************************************************/
716 static inline bool is_allied_city_tile(const struct tile *ptile,
717 const struct player *pplayer)
718{
719 return NULL != tile_allied_city(ptile, pplayer);
720}
721
722struct city *tile_non_attack_city(const struct tile *ptile,
723 const struct player *pplayer);
724
725/**********************************************************************/
728 static inline bool is_non_attack_city_tile(const struct tile *ptile,
729 const struct player *pplayer)
730{
731 return NULL != tile_non_attack_city(ptile, pplayer);
732}
733
734struct city *tile_non_allied_city(const struct tile *ptile,
735 const struct player *pplayer);
736
737/**********************************************************************/
740 static inline bool is_non_allied_city_tile(const struct tile *ptile,
741 const struct player *pplayer)
742{
743 return NULL != tile_non_allied_city(ptile, pplayer);
744}
745
746bool is_unit_near_a_friendly_city(const struct unit *punit);
747bool is_friendly_city_near(const struct player *owner,
748 const struct tile *ptile);
749bool city_exists_within_max_city_map(const struct tile *ptile,
750 bool may_be_on_center);
751
752/* Granary size as a function of city size */
753int city_granary_size(int city_size);
754
755void city_add_improvement(struct city *pcity,
756 const struct impr_type *pimprove);
757void city_remove_improvement(struct city *pcity,
758 const struct impr_type *pimprove);
759
760/* city update functions */
761void city_refresh_from_main_map(struct city *pcity, bool *workers_map);
762
763int city_waste(const struct city *pcity, Output_type_id otype, int total,
764 int *breakdown);
765 Specialist_type_id best_specialist(Output_type_id otype,
766 const struct city *pcity);
767int get_final_city_output_bonus(const struct city *pcity, Output_type_id otype);
768bool city_built_last_turn(const struct city *pcity);
769
770/* city creation / destruction */
771struct city *create_city_virtual(struct player *pplayer,
772 struct tile *ptile, const char *name);
773void destroy_city_virtual(struct city *pcity);
774bool city_is_virtual(const struct city *pcity);
775
776/* misc */
777bool is_city_option_set(const struct city *pcity, enum city_options option);
778void city_styles_alloc(int num);
779void city_styles_free(void);
780
781void add_tax_income(const struct player *pplayer, int trade, int *output);
782int get_city_tithes_bonus(const struct city *pcity);
783int city_pollution_types(const struct city *pcity, int shield_total,
784 int *pollu_prod, int *pollu_pop, int *pollu_mod);
785int city_pollution(const struct city *pcity, int shield_total);
786int city_illness_calc(const struct city *pcity, int *ill_base,
787 int *ill_size, int *ill_trade, int *ill_pollution);
788bool city_had_recent_plague(const struct city *pcity);
789int city_build_slots(const struct city *pcity);
790int city_airlift_max(const struct city *pcity);
791
792bool city_exist(int id);
793
794/*
795 * Iterates over all improvements, skipping those not yet built in the
796 * given city.
797 */
798#define city_built_iterate(_pcity, _p) \
799 improvement_iterate(_p) { \
800 if ((_pcity)->built[improvement_index(_p)].turn <= I_NEVER) { \
801 continue; \
802 }
803
804#define city_built_iterate_end \
805 } improvement_iterate_end;
806
807
808/* Iterates over all output types in the game. */
809#define output_type_iterate(output) \
810{ \
811 Output_type_id output; \
812 \
813 for (output = 0; output < O_LAST; output++) {
814
815#define output_type_iterate_end \
816 } \
817}
818
819
820/* === */
821
822/**********************************************************************/
832 static inline bool is_city_center(const struct city *pcity,
833 const struct tile *ptile)
834{
835 if (!pcity || !pcity->tile || !ptile) {
836 return FALSE;
837 }
838
839 return tile_index(city_tile(pcity)) == tile_index(ptile);
840}
841
842bool is_free_worked(const struct city *pcity, const struct tile *ptile);
843
844#define is_free_worked_index(city_tile_index) \
845 (CITY_MAP_CENTER_TILE_INDEX == city_tile_index)
846#define FREE_WORKED_TILES (1)
847
848void *city_ai_data(const struct city *pcity, const struct ai_type *ai);
849void city_set_ai_data(struct city *pcity, const struct ai_type *ai,
850 void *data);
851
852void city_rally_point_clear(struct city *pcity);
853void city_rally_point_receive(const struct packet_city_rally_point *packet,
854 struct city *pcity)
855 fc__attribute((nonnull (1)));
856
857#ifdef __cplusplus
858}
859#endif /* __cplusplus */
860
861#endif /* FC__CITY_H */
bitvector.h
base_city_celebrating
bool base_city_celebrating(const struct city *pcity)
Definition city.c:1602
is_non_allied_city_tile
static bool is_non_allied_city_tile(const struct tile *ptile, const struct player *pplayer)
Definition city.h:740
city_is_virtual
bool city_is_virtual(const struct city *pcity)
Definition city.c:3476
city_needs_arrange
city_needs_arrange
Definition city.h:297
CNA_BROADCAST_PENDING
@ CNA_BROADCAST_PENDING
Definition city.h:300
CNA_NOT
@ CNA_NOT
Definition city.h:298
CNA_NORMAL
@ CNA_NORMAL
Definition city.h:299
city_turns_to_build
int city_turns_to_build(const struct city *pcity, const struct universal *target, bool include_shield_stock)
Definition city.c:1930
city_improvement_name_translation
const char * city_improvement_name_translation(const struct city *pcity, const struct impr_type *pimprove)
Definition city.c:657
city_exists_within_max_city_map
bool city_exists_within_max_city_map(const struct tile *ptile, bool may_be_on_center)
Definition city.c:2074
is_free_worked
bool is_free_worked(const struct city *pcity, const struct tile *ptile)
Definition city.c:3488
is_non_attack_city_tile
static bool is_non_attack_city_tile(const struct tile *ptile, const struct player *pplayer)
Definition city.h:728
city_tile
#define city_tile(_pcity_)
Definition city.h:544
city_production_gets_caravan_shields
bool city_production_gets_caravan_shields(const struct universal *tgt)
Definition city.c:1825
city_map_radius_sq_set
void city_map_radius_sq_set(struct city *pcity, int radius_sq)
Definition city.c:142
city_production_build_shield_cost
int city_production_build_shield_cost(const struct city *pcity)
Definition city.c:721
city_name_set
void city_name_set(struct city *pcity, const char *new_name)
Definition city.c:1114
can_city_build_unit_later
bool can_city_build_unit_later(const struct city *pcity, const struct unit_type *punittype)
Definition city.c:943
is_enemy_city_tile
static bool is_enemy_city_tile(const struct tile *ptile, const struct player *pplayer)
Definition city.h:704
city_granary_size
int city_granary_size(int city_size)
Definition city.c:2095
player_angry_citizens
citizens player_angry_citizens(const struct player *pplayer)
Definition city.c:2159
city_pollution_types
int city_pollution_types(const struct city *pcity, int shield_total, int *pollu_prod, int *pollu_pop, int *pollu_mod)
Definition city.c:2680
city_set_ai_data
void city_set_ai_data(struct city *pcity, const struct ai_type *ai, void *data)
Definition city.c:3504
output_unhappy_penalty
output_unhappy_penalty
Definition city.h:245
UNHAPPY_PENALTY_ALL_PRODUCTION
@ UNHAPPY_PENALTY_ALL_PRODUCTION
Definition city.h:248
UNHAPPY_PENALTY_NONE
@ UNHAPPY_PENALTY_NONE
Definition city.h:246
UNHAPPY_PENALTY_SURPLUS
@ UNHAPPY_PENALTY_SURPLUS
Definition city.h:247
city_built_last_turn
bool city_built_last_turn(const struct city *pcity)
Definition city.c:2242
can_city_build_now
bool can_city_build_now(const struct city *pcity, const struct universal *target)
Definition city.c:984
city_size_get
static citizens city_size_get(const struct city *pcity)
Definition city.h:549
city_waste
int city_waste(const struct city *pcity, Output_type_id otype, int total, int *breakdown)
Definition city.c:3110
city_unit_unhappiness
int city_unit_unhappiness(struct unit *punit, int *free_unhappy)
Definition city.c:2934
generate_city_map_indices
void generate_city_map_indices(void)
Definition city.c:521
city_build_slots
int city_build_slots(const struct city *pcity)
Definition city.c:2825
city_map_to_tile
struct tile * city_map_to_tile(const struct civ_map *nmap, const struct tile *city_center, int city_radius_sq, int city_map_x, int city_map_y)
Definition city.c:299
city_has_building
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
Definition city.c:1207
city_style_name_translation
const char * city_style_name_translation(const int style)
Definition city.c:1721
citizen_category
citizen_category
Definition city.h:259
CITIZEN_LAST
@ CITIZEN_LAST
Definition city.h:264
CITIZEN_SPECIALIST
@ CITIZEN_SPECIALIST
Definition city.h:265
CITIZEN_ANGRY
@ CITIZEN_ANGRY
Definition city.h:263
CITIZEN_HAPPY
@ CITIZEN_HAPPY
Definition city.h:260
CITIZEN_CONTENT
@ CITIZEN_CONTENT
Definition city.h:261
CITIZEN_UNHAPPY
@ CITIZEN_UNHAPPY
Definition city.h:262
city_styles_free
void city_styles_free(void)
Definition city.c:3312
city_rally_point_receive
void city_rally_point_receive(const struct packet_city_rally_point *packet, struct city *pcity) fc__attribute((nonnull(1)))
Definition city.c:3528
city_updates
city_updates
Definition city.h:290
CU_POPUP_DIALOG
@ CU_POPUP_DIALOG
Definition city.h:294
CU_UPDATE_REPORT
@ CU_UPDATE_REPORT
Definition city.h:292
CU_UPDATE_DIALOG
@ CU_UPDATE_DIALOG
Definition city.h:293
CU_NO_UPDATE
@ CU_NO_UPDATE
Definition city.h:291
output_type_by_identifier
Output_type_id output_type_by_identifier(const char *id)
Definition city.c:641
is_capital
bool is_capital(const struct city *pcity)
Definition city.c:1544
city_styles
struct citystyle * city_styles
Definition city.c:78
city_improvement_upkeep
int city_improvement_upkeep(const struct city *pcity, const struct impr_type *pimprove)
Definition city.c:1222
city_styles_alloc
void city_styles_alloc(int num)
Definition city.c:3297
city_name_get
const char * city_name_get(const struct city *pcity)
Definition city.c:1106
base_city_can_work_tile
bool base_city_can_work_tile(const struct player *restriction, const struct city *pcity, const struct tile *ptile)
Definition city.c:1368
city_unit_slots_available
int city_unit_slots_available(const struct city *pcity)
Definition city.c:1018
is_allied_city_tile
static bool is_allied_city_tile(const struct tile *ptile, const struct player *pplayer)
Definition city.h:716
city_production_caravan_shields_init
void city_production_caravan_shields_init(void)
Definition city.c:1743
city_remove_improvement
void city_remove_improvement(struct city *pcity, const struct impr_type *pimprove)
Definition city.c:3272
city_airlift_max
int city_airlift_max(const struct city *pcity)
Definition city.c:2835
city_can_be_built_here
bool city_can_be_built_here(const struct tile *ptile, const struct unit *punit, bool hut_test)
Definition city.c:1451
citymindist_prevents_city_on_tile
bool citymindist_prevents_city_on_tile(const struct civ_map *nmap, const struct tile *ptile)
Definition city.c:1429
get_output_type
struct output_type * get_output_type(Output_type_id output)
Definition city.c:632
is_city_option_set
bool is_city_option_set(const struct city *pcity, enum city_options option)
Definition city.c:3289
city_population
int city_population(const struct city *pcity)
Definition city.c:1160
city_style_rule_name
const char * city_style_rule_name(const int style)
Definition city.c:1730
city_size_add
void city_size_add(struct city *pcity, int add)
Definition city.c:1133
city_can_use_specialist
bool city_can_use_specialist(const struct city *pcity, Specialist_type_id type)
Definition city.c:1034
city_production_has_flag
bool city_production_has_flag(const struct city *pcity, enum impr_flag_id flag)
Definition city.c:711
city_is_occupied
bool city_is_occupied(const struct city *pcity)
Definition city.c:1630
free_city_map_index
void free_city_map_index(void)
Definition city.c:603
city_refresh_from_main_map
void city_refresh_from_main_map(struct city *pcity, bool *workers_map)
Definition city.c:3059
city_production_unit_veteran_level
int city_production_unit_veteran_level(struct city *pcity, const struct unit_type *punittype)
Definition city.c:788
add_tax_income
void add_tax_income(const struct player *pplayer, int trade, int *output)
Definition city.c:2208
can_city_build_improvement_now
bool can_city_build_improvement_now(const struct city *pcity, const struct impr_type *pimprove)
Definition city.c:838
city_tile_index_to_xy
bool city_tile_index_to_xy(int *city_map_x, int *city_map_y, int city_tile_index, int city_radius_sq)
Definition city.c:95
tile_non_allied_city
struct city * tile_non_allied_city(const struct tile *ptile, const struct player *pplayer)
Definition city.c:2031
city_got_defense_effect
bool city_got_defense_effect(const struct city *pcity, const struct unit_type *attacker)
Definition city.c:1561
player_content_citizens
citizens player_content_citizens(const struct player *pplayer)
Definition city.c:2149
city_map_includes_tile
bool city_map_includes_tile(const struct city *const pcity, const struct tile *map_tile)
Definition city.c:287
get_city_tithes_bonus
int get_city_tithes_bonus(const struct city *pcity)
Definition city.c:2190
citylog_map_data
void citylog_map_data(enum log_level level, int radius_sq, int *map_data)
Definition city.c:405
city_rapture_grow
bool city_rapture_grow(const struct city *pcity)
Definition city.c:1618
is_city_center
static bool is_city_center(const struct city *pcity, const struct tile *ptile)
Definition city.h:832
city_production_turns_to_build
int city_production_turns_to_build(const struct city *pcity, bool include_shield_stock)
Definition city.c:804
city_unhappy
bool city_unhappy(const struct city *pcity)
Definition city.c:1591
best_specialist
Specialist_type_id best_specialist(Output_type_id otype, const struct city *pcity)
Definition city.c:3235
create_city_virtual
struct city * create_city_virtual(struct player *pplayer, struct tile *ptile, const char *name)
Definition city.c:3331
set_city_production
void set_city_production(struct city *pcity)
Definition city.c:2846
city_list_find_number
struct city * city_list_find_number(struct city_list *This, int id)
Definition city.c:1644
get_final_city_output_bonus
int get_final_city_output_bonus(const struct city *pcity, Output_type_id otype)
Definition city.c:2175
city_celebrating
bool city_celebrating(const struct city *pcity)
Definition city.c:1610
city_can_be_built_tile_only
bool city_can_be_built_tile_only(const struct civ_map *nmap, const struct tile *ptile)
Definition city.c:1525
can_city_build_improvement_direct
bool can_city_build_improvement_direct(const struct city *pcity, const struct impr_type *pimprove)
Definition city.c:814
get_output_identifier
const char * get_output_identifier(Output_type_id output)
Definition city.c:613
city_illness_calc
int city_illness_calc(const struct city *pcity, int *ill_base, int *ill_size, int *ill_trade, int *ill_pollution)
Definition city.c:2763
get_output_name
const char * get_output_name(Output_type_id output)
Definition city.c:623
city_can_grow_to
bool city_can_grow_to(const struct city *pcity, int pop_size)
Definition city.c:1977
city_change_production_penalty
int city_change_production_penalty(const struct city *pcity, const struct universal *target)
Definition city.c:1851
is_valid_city_coords
bool is_valid_city_coords(const int city_radius_sq, const int city_map_x, const int city_map_y)
Definition city.c:182
citizen_feeling
citizen_feeling
Definition city.h:270
FEELING_EFFECT
@ FEELING_EFFECT
Definition city.h:273
FEELING_LUXURY
@ FEELING_LUXURY
Definition city.h:272
FEELING_FINAL
@ FEELING_FINAL
Definition city.h:276
FEELING_LAST
@ FEELING_LAST
Definition city.h:277
FEELING_BASE
@ FEELING_BASE
Definition city.h:271
FEELING_NATIONALITY
@ FEELING_NATIONALITY
Definition city.h:274
FEELING_MARTIAL
@ FEELING_MARTIAL
Definition city.h:275
city_pollution
int city_pollution(const struct city *pcity, int shield_total)
Definition city.c:2714
city_happy
bool city_happy(const struct city *pcity)
Definition city.c:1579
city_size_set
void city_size_set(struct city *pcity, citizens size)
Definition city.c:1149
city_add_improvement
void city_add_improvement(struct city *pcity, const struct impr_type *pimprove)
Definition city.c:3258
city_tile_output_now
int city_tile_output_now(const struct city *pcity, const struct tile *ptile, Output_type_id otype)
Definition city.c:1351
city_map_radius_sq_get
int city_map_radius_sq_get(const struct city *pcity)
Definition city.c:131
can_city_build_direct
bool can_city_build_direct(const struct city *pcity, const struct universal *target)
Definition city.c:966
tile_allied_city
struct city * tile_allied_city(const struct tile *ptile, const struct player *pplayer)
Definition city.c:2001
tile_enemy_city
struct city * tile_enemy_city(const struct tile *ptile, const struct player *pplayer)
Definition city.c:1986
citylog_map_workers
void citylog_map_workers(enum log_level level, struct city *pcity)
Definition city.c:440
city_base_to_city_map
bool city_base_to_city_map(int *city_map_x, int *city_map_y, const struct city *const pcity, const struct tile *map_tile)
Definition city.c:275
output_loss
output_loss
Definition city.h:281
OLOSS_SIZE
@ OLOSS_SIZE
Definition city.h:283
OLOSS_WASTE
@ OLOSS_WASTE
Definition city.h:282
OLOSS_LAST
@ OLOSS_LAST
Definition city.h:284
destroy_city_virtual
void destroy_city_virtual(struct city *pcity)
Definition city.c:3407
rs_max_city_radius_sq
int rs_max_city_radius_sq(void)
Definition city.c:153
city_tile_to_city_map
bool city_tile_to_city_map(int *city_map_x, int *city_map_y, const int city_radius_sq, const struct tile *city_center, const struct tile *map_tile)
Definition city.c:258
city_specialists
citizens city_specialists(const struct city *pcity)
Definition city.c:3218
num_output_types
const Output_type_id num_output_types
production_class_type
production_class_type
Definition city.h:38
PCT_LAST
@ PCT_LAST
Definition city.h:42
PCT_UNIT
@ PCT_UNIT
Definition city.h:39
PCT_NORMAL_IMPROVEMENT
@ PCT_NORMAL_IMPROVEMENT
Definition city.h:40
PCT_WONDER
@ PCT_WONDER
Definition city.h:41
city_choose_build_default
void city_choose_build_default(struct city *pcity)
Definition city.c:1056
city_style_by_translated_name
int city_style_by_translated_name(const char *s)
Definition city.c:1686
add_specialist_output
void add_specialist_output(const struct city *pcity, int *output)
Definition city.c:2295
city_ai_data
void * city_ai_data(const struct city *pcity, const struct ai_type *ai)
Definition city.c:3496
city_list_find_name
struct city * city_list_find_name(struct city_list *This, const char *name)
Definition city.c:1660
can_city_build_later
bool can_city_build_later(const struct city *pcity, const struct universal *target)
Definition city.c:1001
city_tile_output
int city_tile_output(const struct city *pcity, const struct tile *ptile, bool is_celebrating, Output_type_id otype)
Definition city.c:1250
city_tile_xy_to_index
int city_tile_xy_to_index(int city_map_x, int city_map_y, int city_radius_sq)
Definition city.c:117
is_gov_center
bool is_gov_center(const struct city *pcity)
Definition city.c:1552
city_map_tiles
int city_map_tiles(int city_radius_sq)
Definition city.c:165
is_unit_near_a_friendly_city
bool is_unit_near_a_friendly_city(const struct unit *punit)
Definition city.c:2047
can_city_build_unit_direct
bool can_city_build_unit_direct(const struct city *pcity, const struct unit_type *punittype)
Definition city.c:887
tile_non_attack_city
struct city * tile_non_attack_city(const struct tile *ptile, const struct player *pplayer)
Definition city.c:2016
city_exist
bool city_exist(int id)
Definition city.c:3459
city_can_work_tile
bool city_can_work_tile(const struct city *pcity, const struct tile *ptile)
Definition city.c:1420
compare_iter_index
int compare_iter_index(const void *a, const void *b)
Definition city.c:337
city_production_build_units
bool city_production_build_units(const struct city *pcity, bool add_production, int *num_units)
Definition city.c:731
city_turns_to_grow
int city_turns_to_grow(const struct city *pcity)
Definition city.c:1961
city_rally_point_clear
void city_rally_point_clear(struct city *pcity)
Definition city.c:3513
output_types
struct output_type output_types[]
Definition city.c:82
can_city_build_improvement_later
bool can_city_build_improvement_later(const struct city *pcity, const struct impr_type *pimprove)
Definition city.c:855
city_had_recent_plague
bool city_had_recent_plague(const struct city *pcity)
Definition city.c:2816
city_can_change_build
bool city_can_change_build(const struct city *pcity)
Definition city.c:1048
city_total_unit_gold_upkeep
int city_total_unit_gold_upkeep(const struct city *pcity)
Definition city.c:1189
city_style_by_rule_name
int city_style_by_rule_name(const char *s)
Definition city.c:1703
city_name_compare
int city_name_compare(const void *p1, const void *p2)
Definition city.c:1676
city_total_impr_gold_upkeep
int city_total_impr_gold_upkeep(const struct city *pcity)
Definition city.c:1170
can_city_build_unit_now
bool can_city_build_unit_now(const struct city *pcity, const struct unit_type *punittype)
Definition city.c:925
city_production_name_translation
const char * city_production_name_translation(const struct city *pcity)
Definition city.c:694
is_friendly_city_near
bool is_friendly_city_near(const struct player *owner, const struct tile *ptile)
Definition city.c:2056
punit
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
Definition dialogs_g.h:73
fc_types.h
citizens
unsigned char citizens
Definition fc_types.h:358
SP_MAX
#define SP_MAX
Definition fc_types.h:379
Specialist_type_id
int Specialist_type_id
Definition fc_types.h:345
MAX_LEN_NAME
#define MAX_LEN_NAME
Definition fc_types.h:66
O_LAST
@ O_LAST
Definition fc_types.h:91
Output_type_id
enum output_type_id Output_type_id
Definition fc_types.h:348
owner
struct city * owner
Definition citydlg.c:219
type
GType type
Definition repodlgs.c:1312
improvement.h
B_LAST
#define B_LAST
Definition improvement.h:42
name
const char * name
Definition inputfile.c:127
log.h
fc_assert_ret_val
#define fc_assert_ret_val(condition, val)
Definition log.h:194
log_level
log_level
Definition log.h:28
name_translation.h
level
struct setting_list * level[OLEVELS_NUM]
Definition settings.c:183
specenum_gen.h
speclist.h
size
size_t size
Definition specvec.h:72
adv_city
Definition infracache.h:21
ai_type
Definition ai.h:50
built_status
Definition city.h:237
built_status::turn
int turn
Definition city.h:238
city
Definition city.h:309
city::task_reqs
struct worker_task_list * task_reqs
Definition city.h:395
city::tile_cache
struct tile_cache * tile_cache
Definition city.h:337
city::color_index
int color_index
Definition city.h:453
city::turn_last_built
int turn_last_built
Definition city.h:373
city::surplus
int surplus[O_LAST]
Definition city.h:343
city::food_stock
int food_stock
Definition city.h:354
city::built
struct built_status built[B_LAST]
Definition city.h:380
city::original
struct player * original
Definition city.h:313
city::history
int history
Definition city.h:393
city::pollution
int pollution
Definition city.h:356
city::did_sell
bool did_sell
Definition city.h:367
city::id
int id
Definition city.h:315
city::last_turns_shield_surplus
int last_turns_shield_surplus
Definition city.h:378
city::capital
enum capital_type capital
Definition city.h:317
city::disbanded_shields
int disbanded_shields
Definition city.h:377
city::waste
int waste[O_LAST]
Definition city.h:344
city::workers_frozen
int workers_frozen
Definition city.h:420
city::turn_plague
int turn_plague
Definition city.h:361
city::info_units_present
struct unit_list * info_units_present
Definition city.h:457
city::city_options
bv_city_options city_options
Definition city.h:389
city::unit_happy_upkeep
citizens unit_happy_upkeep
Definition city.h:327
city::city_radius_sq
int city_radius_sq
Definition city.h:362
city::was_happy
bool was_happy
Definition city.h:368
city::owner
struct player * owner
Definition city.h:312
city::turn_founded
int turn_founded
Definition city.h:372
city::airlift
int airlift
Definition city.h:365
city::citizen_base
int citizen_base[O_LAST]
Definition city.h:347
city::caravan_shields
int caravan_shields
Definition city.h:376
city::did_buy
bool did_buy
Definition city.h:366
city::info_units_supported
struct unit_list * info_units_supported
Definition city.h:456
city::name
char * name
Definition city.h:310
city::ais
void * ais[FREECIV_AI_MOD_LAST]
Definition city.h:436
city::routes
struct trade_route_list * routes
Definition city.h:332
city::anarchy
int anarchy
Definition city.h:370
city::needs_arrange
enum city_needs_arrange needs_arrange
Definition city.h:424
city::occupied
bool occupied
Definition city.h:443
city::usage
int usage[O_LAST]
Definition city.h:348
city::tile_cache_radius_sq
int tile_cache_radius_sq
Definition city.h:340
city::production
struct universal production
Definition city.h:382
city::orders
struct unit_order * orders
Definition city.h:405
city::walls
int walls
Definition city.h:444
city::rally_point
struct city::@16 rally_point
city::happy
bool happy
Definition city.h:445
city::collecting_info_units_supported
struct unit_list * collecting_info_units_supported
Definition city.h:460
city::bonus
int bonus[O_LAST]
Definition city.h:351
city::adv
struct adv_city * adv
Definition city.h:435
city::nationality
citizens * nationality
Definition city.h:329
city::vigilant
bool vigilant
Definition city.h:404
city::steal
int steal
Definition city.h:397
city::unhappy_penalty
int unhappy_penalty[O_LAST]
Definition city.h:345
city::size
citizens size
Definition city.h:320
city::first_citizen_index
unsigned char first_citizen_index
Definition city.h:466
city::illness
int illness
Definition city.h:417
city::before_change_shields
int before_change_shields
Definition city.h:375
city::culture
int culture
Definition city.h:448
city::style
int style
Definition city.h:316
city::length
size_t length
Definition city.h:400
city::synced
bool synced
Definition city.h:431
city::migration_score
float migration_score
Definition city.h:414
city::needs_refresh
bool needs_refresh
Definition city.h:428
city::collecting_info_units_present
struct unit_list * collecting_info_units_present
Definition city.h:461
city::buy_cost
int buy_cost
Definition city.h:449
city::feel
citizens feel[CITIZEN_LAST][FEELING_LAST]
Definition city.h:321
city::specialists
citizens specialists[SP_MAX]
Definition city.h:324
city::tile
struct tile * tile
Definition city.h:311
city::shield_stock
int shield_stock
Definition city.h:355
city::prod
int prod[O_LAST]
Definition city.h:346
city::vision
struct vision * vision
Definition city.h:438
city::server
struct city::@17::@19 server
city::cm_parameter
struct cm_parameter * cm_parameter
Definition city.h:408
city::city_image
int city_image
Definition city.h:447
city::debug
bool debug
Definition city.h:433
city::changed_from
struct universal changed_from
Definition city.h:385
city::colored
bool colored
Definition city.h:452
city::unhappy
bool unhappy
Definition city.h:446
city::units_supported
struct unit_list * units_supported
Definition city.h:391
city::mgr_score_calc_turn
int mgr_score_calc_turn
Definition city.h:415
city::illness_trade
int illness_trade
Definition city.h:357
city::need_updates
enum city_updates need_updates
Definition city.h:464
city::persistent
bool persistent
Definition city.h:402
city::client
struct city::@17::@20 client
city::rapture
int rapture
Definition city.h:371
city::martial_law
citizens martial_law
Definition city.h:326
citystyle
Definition city.h:471
citystyle::reqs
struct requirement_vector reqs
Definition city.h:476
citystyle::citizens_graphic
char citizens_graphic[MAX_LEN_NAME]
Definition city.h:475
citystyle::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition city.h:474
citystyle::name
struct name_translation name
Definition city.h:472
citystyle::graphic
char graphic[MAX_LEN_NAME]
Definition city.h:473
civ_map
Definition map_types.h:71
cm_parameter
Definition cm.h:40
impr_type
Definition improvement.h:68
iter_index
Definition city.h:101
iter_index::dist
int dist
Definition city.h:102
iter_index::dx
int dx
Definition city.h:102
iter_index::dy
int dy
Definition city.h:102
name_translation
Definition name_translation.h:35
option
Definition options.c:454
output_type
Definition city.h:251
output_type::id
const char * id
Definition city.h:254
output_type::unhappy_penalty
enum output_unhappy_penalty unhappy_penalty
Definition city.h:256
output_type::index
int index
Definition city.h:252
output_type::harvested
bool harvested
Definition city.h:255
output_type::name
const char * name
Definition city.h:253
packet_city_rally_point
Definition packets_gen.h:497
player
Definition player.h:249
tile_cache
Definition city.c:69
tile
Definition tile.h:49
unit_order
Definition unit.h:92
unit_type
Definition unittype.h:481
unit
Definition unit.h:138
universal
Definition fc_types.h:756
vision
Definition vision.h:85
worklist
Definition worklist.h:28
fc__attribute
#define fc__attribute(x)
Definition support.h:89
FALSE
#define FALSE
Definition support.h:47
tile.h
tile_index
#define tile_index(_pt_)
Definition tile.h:87
traderoutes.h
unit.h
unitlist.h
vision.h
workertask.h
worklist.h