Freeciv-3.2: /fast/freeciv/nightly/S3_2/common/city.h Source File

Freeciv-3.2

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