Freeciv-3.4
Loading...
Searching...
No Matches
game.c
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
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* utility */
19#include "fcintl.h"
20#include "ioz.h"
21#include "log.h"
22#include "mem.h"
23#include "shared.h"
24#include "support.h"
25
26/* aicore */
27#include "cm.h"
28
29/* common */
30#include "ai.h"
31#include "achievements.h"
32#include "actions.h"
33#include "actres.h"
34#include "city.h"
35#include "connection.h"
36#include "counters.h"
37#include "diptreaty.h"
38#include "disaster.h"
39#include "extras.h"
40#include "government.h"
41#include "idex.h"
42#include "map.h"
43#include "multipliers.h"
44#include "nation.h"
45#include "packets.h"
46#include "player.h"
47#include "research.h"
48#include "rgbcolor.h"
49#include "spaceship.h"
50#include "specialist.h"
51#include "style.h"
52#include "tech.h"
53#include "terrain.h"
54#include "tiledef.h"
55#include "traderoutes.h"
56#include "unit.h"
57#include "unitlist.h"
58#include "victory.h"
59
60#include "game.h"
61
63struct world wld;
64
66
68
69static void game_defaults(bool keep_ruleset_value);
70
71/**********************************************************************/
74int civ_population(const struct player *pplayer)
75{
76 int ppl = 0;
77
78 city_list_iterate(pplayer->cities, pcity) {
81
82 return ppl;
83}
84
85/**********************************************************************/
88struct city *game_city_by_name(const char *name)
89{
90 players_iterate(pplayer) {
91 struct city *pcity = city_list_find_name(pplayer->cities, name);
92
93 if (pcity) {
94 return pcity;
95 }
97
98 return NULL;
99}
100
101
102/**********************************************************************/
108{
109 return idex_lookup_city(&wld, id);
110}
111
112/**********************************************************************/
117{
118 return idex_lookup_unit(&wld, id);
119}
120
121/**********************************************************************/
124void game_remove_unit(struct world *gworld, struct unit *punit)
125{
126 struct city *pcity;
127 struct player *owner;
128
129 /* It's possible that during city transfer homecity/unit owner
130 * information is inconsistent, and client then tries to remove
131 * now unseen unit so that homecity is not in the list of cities
132 * of the player (seemingly) owning the unit.
133 * Thus cannot use player_city_by_number() here, but have to
134 * consider cities of all players. */
136
137 if (pcity != nullptr) {
138 unit_list_remove(pcity->units_supported, punit);
139
140 log_debug("game_remove_unit()"
141 " at (%d,%d) unit %d, %s %s home (%d,%d) city %d, %s %s",
143 punit->id,
150 } else if (IDENTITY_NUMBER_ZERO == punit->homecity) {
151 log_debug("game_remove_unit() at (%d,%d) unit %d, %s %s home %d",
153 punit->id,
156 punit->homecity);
157 } else {
158 log_error("game_remove_unit() at (%d,%d) unit %d, %s %s home %d invalid",
160 punit->id,
163 punit->homecity);
164 }
165
167
169 if (owner != nullptr) {
171 }
172
174
177 }
178
180}
181
182/**********************************************************************/
185void game_remove_city(struct world *gworld, struct city *pcity)
186{
187 struct tile *pcenter = city_tile(pcity);
188 struct player *powner = city_owner(pcity);
189 const struct civ_map *nmap = &(wld.map);
190
191 if (NULL != powner) {
192 /* Always unlink before clearing data */
193 city_list_remove(powner->cities, pcity);
194 }
195
196 if (NULL == pcenter) {
197 log_debug("game_remove_city() virtual city %d, %s",
198 pcity->id,
200 } else {
201 log_debug("game_remove_city() at (%d,%d) city %d, %s %s",
203 pcity->id,
206
208 if (tile_worked(ptile) == pcity) {
209 tile_set_worked(ptile, NULL);
210 }
212 }
213
216}
217
218/**********************************************************************/
222{
223 int i;
224
225 /* The control packet. */
247
251
252 /* The info packet. */
261 game.info.cooling = 0;
262 game.info.coolinglevel = 0; /* set later */
268 for (i = 0; i < A_LAST; i++) {
269 /* game.num_tech_types = 0 here */
271 }
272 for (i = 0; i < B_LAST; i++) {
273 /* game.num_impr_types = 0 here */
275 }
284 game.info.heating = 0;
309 game.info.turn = 0;
310 game.info.warminglevel = 0; /* Set later */
315
316 /* The scenario packets. */
318 game.scenario.name[0] = '\0';
319 game.scenario.authors[0] = '\0';
329
331
332 /* Veteran system. */
333 game.veteran = NULL;
334
335 /* Player colors */
337
339
340 if (is_server()) {
341 /* All settings only used by the server (./server/ and ./ai/ */
349 game.server.connectmsg[0] = '\0';
352 for (i = 0; i < DEBUG_LAST; i++) {
354 }
380 /* Do not clear meta_info.type here as it's already set to correct value */
403 if (!keep_ruleset_value) {
405 }
436 } else {
437 /* Client side takes care of itself in client_main() */
438 }
439}
440
441/**********************************************************************/
459
460/**********************************************************************/
465{
466 /* FIXME: it's not clear where these values should be initialized. It
467 * can't be done in game_init because the map isn't created yet. Maybe it
468 * should be done in the mapgen code or in the maphand code. It should
469 * surely be called when the map is generated. */
470 game.info.warminglevel = (map_num_tiles() + 499) / 500;
471 game.info.coolinglevel = (map_num_tiles() + 499) / 500;
472}
473
474/**********************************************************************/
477void game_free(void)
478{
483 idex_free(&wld);
487 cm_free();
488}
489
490/**********************************************************************/
494void game_reset(void)
495{
496 if (is_server()) {
497 game_free();
499 } else {
500 /* Reset the players infos. */
501 players_iterate(pplayer) {
502 player_clear(pplayer, FALSE);
504
507 idex_free(&wld);
508
510 idex_init(&wld);
512 }
513}
514
515/**********************************************************************/
564
565/**********************************************************************/
569{
570 int i;
571
572 CALL_FUNC_EACH_AI(units_ruleset_close);
573
574 /* Clear main structures which can points to the ruleset dependent
575 * structures. */
576 players_iterate(pplayer) {
577 player_ruleset_close(pplayer);
580
583 techs_free();
585 nations_free();
591 goods_free();
593 extras_free();
596 styles_free();
597 actions_free();
598 actres_free();
611
612 /* Destroy the default veteran system. */
614 game.veteran = NULL;
615
616 /* Player colors. */
617 if (game.plr_bg_color != NULL) {
620 }
621
622 if (is_server()) {
623 if (game.server.luadata != NULL) {
625 }
629 }
633 }
635 for (i = 0; i < game.server.ruledit.embedded_nations_count; i++) {
637 }
642 for (i = 0; i < game.server.ruledit.ag_count; i++) {
644 }
648 }
650 for (i = 0; i < game.server.ruledit.at_count; i++) {
652 }
656 }
658 for (i = 0; i < game.server.ruledit.as_count; i++) {
660 }
664 }
665 }
666 }
667
668 for (i = 0; i < MAX_CALENDAR_FRAGMENTS; i++) {
670 }
671
672 if (game.ruleset_summary != NULL) {
675 }
676
680 }
681
685 }
686}
687
688/**********************************************************************/
692{
693 players_iterate(pplayer) {
694 city_list_iterate(pplayer->cities, pcity) {
695 city_built_iterate(pcity, pimprove) {
696 if (is_wonder(pimprove)) {
697 if (is_great_wonder(pimprove)) {
699 player_number(pplayer);
700 }
701 pplayer->wonders[improvement_index(pimprove)] = pcity->id;
702 }
706}
707
708/**********************************************************************/
715bool is_player_phase(const struct player *pplayer, int phase)
716{
717 switch (game.info.phase_mode) {
718 case PMT_CONCURRENT:
719 return TRUE;
720 break;
722 return player_number(pplayer) == phase;
723 break;
725 fc_assert_ret_val(NULL != pplayer->team, FALSE);
726 return team_number(pplayer->team) == phase;
727 break;
728 default:
729 break;
730 }
731
732 fc_assert_msg(FALSE, "Unrecognized phase mode %d in is_player_phase().",
733 phase);
734 return TRUE;
735}
736
737/**********************************************************************/
743{
744 /* big_int_to_text can't handle negative values, and in any case we'd
745 * better not have a negative population. */
748}
749
750/**********************************************************************/
753static char *year_suffix(void)
754{
755 static char buf[MAX_LEN_NAME];
756 const char *suffix;
758 const char *max = safe_year_suffix + MAX_LEN_NAME - 1;
759 char *c = safe_year_suffix;
760
761 if (game.info.year < 0) {
763 } else {
765 }
766
767 /* Remove all non alphanumeric characters from the year suffix. */
768 for (; '\0' != *suffix && c < max; suffix++) {
769 if (fc_isalnum(*suffix)) {
770 *c++ = *suffix;
771 }
772 }
773 *c = '\0';
774
775 fc_snprintf(buf, sizeof(buf), "%s", safe_year_suffix);
776
777 return buf;
778}
779
780/**********************************************************************/
799int generate_save_name(const char *format, char *buf, int buflen,
800 const char *reason)
801{
802 struct cf_sequence sequences[5] = {
803 cf_str_seq('R', (reason == NULL) ? "auto" : reason),
804 cf_str_seq('S', year_suffix()),
805 { 0 }, { 0 }, /* Works for both gcc and tcc */
806 cf_end()
807 };
808
809 cf_int_seq('T', game.info.turn, &sequences[2]);
810 cf_int_seq('Y', game.info.year, &sequences[3]);
811
812 fc_vsnprintcf(buf, buflen, format, sequences, -1);
813
814 if (0 == strcmp(format, buf)) {
815 /* Use the default savename if 'format' does not contain
816 * printf information. */
817 char savename[512];
818
819 fc_snprintf(savename, sizeof(savename), "%s-T%%04T-Y%%05Y-%%R",
820 format);
822 }
823
824 log_debug("save name generated from '%s': %s", format, buf);
825
826 return strlen(buf);
827}
828
829/**********************************************************************/
832void user_flag_init(struct user_flag *flag)
833{
834 flag->name = NULL;
835 flag->helptxt = NULL;
836}
837
838/**********************************************************************/
841void user_flag_free(struct user_flag *flag)
842{
843 if (flag->name != NULL) {
844 FC_FREE(flag->name);
845 flag->name = NULL;
846 }
847 if (flag->helptxt != NULL) {
848 FC_FREE(flag->helptxt);
849 flag->helptxt = NULL;
850 }
851}
852
853/**********************************************************************/
857{
858 if (game.info.turn == 1 && game.info.first_timeout != -1) {
859 return game.info.first_timeout;
860 } else {
861 return game.info.timeout;
862 }
863}
void achievements_free(void)
void achievements_init(void)
void actions_free(void)
Definition actions.c:909
void actions_init(void)
Definition actions.c:850
void actres_free(void)
Definition actres.c:251
void actres_init(void)
Definition actres.c:244
#define CALL_FUNC_EACH_AI(_func,...)
Definition ai.h:387
#define BV_CLR_ALL(bv)
Definition bitvector.h:103
void city_styles_free(void)
Definition city.c:3451
const char * city_name_get(const struct city *pcity)
Definition city.c:1137
int city_population(const struct city *pcity)
Definition city.c:1191
void free_city_map_index(void)
Definition city.c:609
int city_map_radius_sq_get(const struct city *pcity)
Definition city.c:137
void destroy_city_virtual(struct city *pcity)
Definition city.c:3556
struct city * city_list_find_name(struct city_list *This, const char *name)
Definition city.c:1695
#define city_list_iterate(citylist, pcity)
Definition city.h:508
#define city_tile(_pcity_)
Definition city.h:564
#define city_owner(_pcity_)
Definition city.h:563
#define city_list_iterate_end
Definition city.h:510
#define city_tile_iterate(_nmap, _radius_sq, _city_tile, _tile)
Definition city.h:228
#define city_tile_iterate_end
Definition city.h:236
#define city_built_iterate(_pcity, _p)
Definition city.h:835
#define city_built_iterate_end
Definition city.h:841
void cm_init(void)
Definition cm.c:293
void cm_free(void)
Definition cm.c:330
char * incite_cost
Definition comments.c:76
void counters_init(void)
Definition counters.c:40
void counters_free(void)
Definition counters.c:51
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
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 int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:78
void clause_infos_init(void)
Definition diptreaty.c:262
void clause_infos_free(void)
Definition diptreaty.c:278
void treaties_init(void)
Definition diptreaty.c:329
void treaties_free(void)
Definition diptreaty.c:337
void disaster_types_init(void)
Definition disaster.c:33
void disaster_types_free(void)
Definition disaster.c:46
void ruleset_cache_free(void)
Definition effects.c:329
void ruleset_cache_init(void)
Definition effects.c:297
void user_extra_flags_init(void)
Definition extras.c:923
void extras_free(void)
Definition extras.c:84
void extra_flags_free(void)
Definition extras.c:935
void extras_init(void)
Definition extras.c:45
static bool is_server(void)
#define MAX_CALENDAR_FRAGMENTS
Definition fc_types.h:63
#define MAX_LEN_NAME
Definition fc_types.h:67
#define IDENTITY_NUMBER_ZERO
Definition fc_types.h:93
const char * population_to_text(int thousand_citizen)
Definition game.c:742
void game_reset(void)
Definition game.c:494
void user_flag_init(struct user_flag *flag)
Definition game.c:832
void user_flag_free(struct user_flag *flag)
Definition game.c:841
struct civ_game game
Definition game.c:62
void game_ruleset_init(void)
Definition game.c:518
bool is_player_phase(const struct player *pplayer, int phase)
Definition game.c:715
static void game_defaults(bool keep_ruleset_value)
Definition game.c:221
static char * year_suffix(void)
Definition game.c:753
int current_turn_timeout(void)
Definition game.c:856
struct city * game_city_by_name(const char *name)
Definition game.c:88
void game_ruleset_free(void)
Definition game.c:568
void game_init(bool keep_ruleset_value)
Definition game.c:446
struct world wld
Definition game.c:63
bool _ruleset_compat_mode
Definition game.c:67
void game_remove_unit(struct world *gworld, struct unit *punit)
Definition game.c:124
struct unit * game_unit_by_number(int id)
Definition game.c:116
int civ_population(const struct player *pplayer)
Definition game.c:74
void game_remove_city(struct world *gworld, struct city *pcity)
Definition game.c:185
void game_free(void)
Definition game.c:477
void game_map_init(void)
Definition game.c:464
void initialize_globals(void)
Definition game.c:691
int generate_save_name(const char *format, char *buf, int buflen, const char *reason)
Definition game.c:799
bool am_i_server
Definition game.c:65
struct city * game_city_by_number(int id)
Definition game.c:107
#define GAME_DEFAULT_TECHPENALTY
Definition game.h:559
#define GAME_DEFAULT_SKILL_LEVEL
Definition game.h:702
#define GAME_DEFAULT_KILLSTACK
Definition game.h:552
#define GAME_DEFAULT_INFRA
Definition game.h:383
#define GAME_DEFAULT_LUA_TIMEOUT
Definition game.h:759
#define GAME_DEFAULT_REVOLENTYPE
Definition game.h:743
#define GAME_DEFAULT_AUTO_AI_TOGGLE
Definition game.h:598
#define GAME_DEFAULT_CARAVAN_BONUS_STYLE
Definition game.h:658
#define GAME_DEFAULT_TIMEOUTINTINC
Definition game.h:603
#define GAME_DEFAULT_SCORETURN
Definition game.h:587
#define GAME_DEFAULT_TCPTIMEOUT
Definition game.h:624
#define GAME_DEFAULT_EVENT_CACHE_INFO
Definition game.h:723
#define GAME_DEFAULT_MGR_FOODNEEDED
Definition game.h:531
#define GAME_DEFAULT_TECHLOST_DONOR
Definition game.h:567
#define GAME_DEFAULT_TIMEOUTINT
Definition game.h:602
#define GAME_DEFAULT_ALLOWED_CITY_NAMES
Definition game.h:739
#define GAME_DEFAULT_SCORELOG
Definition game.h:580
#define GAME_DEFAULT_OCCUPYCHANCE
Definition game.h:672
#define GAME_DEFAULT_GLOBAL_WARMING_PERCENT
Definition game.h:452
#define GAME_DEFAULT_TRADING_TECH
Definition game.h:654
#define GAME_DEFAULT_SAVETURNS
Definition game.h:685
#define GAME_DEFAULT_BORDERS
Definition game.h:462
#define GAME_DEFAULT_AIRLIFTINGSTYLE
Definition game.h:750
#define GAME_DEFAULT_SPACESHIP_TRAVEL_PCT
Definition game.h:592
#define GAME_DEFAULT_TOP_CITIES_COUNT
Definition game.h:706
#define GAME_DEFAULT_KILLUNHOMED
Definition game.h:555
#define GAME_DEFAULT_SCIENCEBOX
Definition game.h:426
#define GAME_DEFAULT_MGR_WORLDCHANCE
Definition game.h:544
#define GAME_DEFAULT_ONSETBARBARIAN
Definition game.h:668
#define GAME_DEFAULT_KILLCITIZEN
Definition game.h:553
#define GAME_DEFAULT_SHIELDBOX
Definition game.h:422
@ DEBUG_LAST
Definition game.h:41
#define GAME_DEFAULT_MAXCONNECTIONSPERHOST
Definition game.h:609
#define GAME_DEFAULT_INCITE_GOLD_CAPT_CHANCE
Definition game.h:442
#define GAME_DEFAULT_DEMOGRAPHY
Definition game.h:710
#define GAME_DEFAULT_FULLTRADESIZE
Definition game.h:650
#define GAME_DEFAULT_TIMEOUTINCMULT
Definition game.h:605
#define GAME_DEFAULT_CELEBRATESIZE
Definition game.h:507
#define GAME_DEFAULT_RAPTUREDELAY
Definition game.h:509
#define GAME_DEFAULT_REVOLUTION_LENGTH
Definition game.h:744
#define GAME_DEFAULT_MGR_TURNINTERVAL
Definition game.h:527
#define GAME_DEFAULT_TIMEOUTINC
Definition game.h:604
#define GAME_DEFAULT_START_UNITS
Definition game.h:387
#define GAME_DEFAULT_ALLOW_TAKE
Definition game.h:711
#define GAME_DEFAULT_MIN_PLAYERS
Definition game.h:404
#define GAME_DEFAULT_RULESETDIR
Definition game.h:681
#define GAME_DEFAULT_AUTOATTACK
Definition game.h:676
#define GAME_DEFAULT_REVEALMAP
Definition game.h:578
#define GAME_DEFAULT_TEAM_POOLED_RESEARCH
Definition game.h:571
#define GAME_DEFAULT_SEED
Definition game.h:375
#define GAME_DEFAULT_HOMECAUGHTUNITS
Definition game.h:521
#define GAME_DEFAULT_NETWAIT
Definition game.h:628
#define GAME_DEFAULT_KICK_TIME
Definition game.h:755
#define GAME_DEFAULT_PLRCOLORMODE
Definition game.h:741
#define GAME_DEFAULT_DIPLCHANCE
Definition game.h:468
#define GAME_DEFAULT_RAZECHANCE
Definition game.h:574
#define GAME_DEFAULT_START_YEAR
Definition game.h:748
#define GAME_DEFAULT_INCITE_GOLD_LOSS_CHANCE
Definition game.h:438
#define GAME_DEFAULT_TIMEOUTCOUNTER
Definition game.h:607
#define GAME_DEFAULT_TRADING_CITY
Definition game.h:656
#define GAME_DEFAULT_FOODBOX
Definition game.h:418
#define GAME_DEFAULT_COMPRESS_TYPE
Definition game.h:736
#define GAME_DEFAULT_PINGTIMEOUT
Definition game.h:636
#define GAME_DEFAULT_TRADE_REVENUE_STYLE
Definition game.h:664
#define GAME_DEFAULT_SAVEPALACE
Definition game.h:519
#define GAME_DEFAULT_GLOBAL_WARMING
Definition game.h:450
#define GAME_DEFAULT_TECHLOST_RECV
Definition game.h:563
#define GAME_DEFAULT_NOTRADESIZE
Definition game.h:642
#define GAME_DEFAULT_COMPRESS_LEVEL
Definition game.h:725
#define GAME_DEFAULT_NUCLEAR_WINTER_PERCENT
Definition game.h:458
#define GAME_DEFAULT_TRADING_GOLD
Definition game.h:655
#define GAME_DEFAULT_TRAIT_DIST_MODE
Definition game.h:517
#define GAME_DEFAULT_NUCLEAR_WINTER
Definition game.h:456
#define GAME_DEFAULT_FREECOST
Definition game.h:472
#define GAME_DEFAULT_MAX_PLAYERS
Definition game.h:408
#define GAME_DEFAULT_CITYMINDIST
Definition game.h:492
#define GAME_DEFAULT_PHASE_MODE
Definition game.h:622
#define GAME_DEFAULT_AIFILL
Definition game.h:412
#define GAME_DEFAULT_MULTIRESEARCH
Definition game.h:572
#define GAME_DEFAULT_CONQUERCOST
Definition game.h:476
#define GAME_DEFAULT_TIMEOUT
Definition game.h:600
#define GAME_DEFAULT_CONTACTTURNS
Definition game.h:503
#define GAME_DEFAULT_SCORELOGLEVEL
Definition game.h:581
#define GAME_DEFAULT_TECHLEVEL
Definition game.h:394
#define GAME_DEFAULT_DISASTERS
Definition game.h:513
#define GAME_DEFAULT_GOLD
Definition game.h:379
#define GAME_DEFAULT_MIGRATION
Definition game.h:525
#define GAME_DEFAULT_NATURALCITYNAMES
Definition game.h:523
#define GAME_DEFAULT_EVENT_CACHE_TURNS
Definition game.h:713
#define GAME_DEFAULT_VICTORY_CONDITIONS
Definition game.h:589
#define GAME_DEFAULT_FOGGEDBORDERS
Definition game.h:448
#define GAME_DEFAULT_UNITWAITTIME
Definition game.h:620
#define GAME_DEFAULT_TIMEOUTADDEMOVE
Definition game.h:606
#define GAME_DEFAULT_DISPERSION
Definition game.h:390
#define GAME_DEFAULT_EVENT_CACHE_CHAT
Definition game.h:721
#define GAME_DEFAULT_DIPLOMACY
Definition game.h:466
#define GAME_DEFAULT_MGR_DISTANCE
Definition game.h:536
#define GAME_DEFAULT_TURNBLOCK
Definition game.h:596
#define GAME_DEFAULT_PINGTIME
Definition game.h:632
#define GAME_DEFAULT_AQUEDUCTLOSS
Definition game.h:548
#define GAME_DEFAULT_TRADEMINDIST
Definition game.h:660
#define GAME_DEFAULT_ANGRYCITIZEN
Definition game.h:398
#define GAME_DEFAULT_BARBARIANRATE
Definition game.h:666
#define GAME_DEFAULT_HAPPYBORDERS
Definition game.h:464
#define GAME_DEFAULT_END_TURN
Definition game.h:400
#define GAME_DEFAULT_DIPLGOLDCOST
Definition game.h:434
#define GAME_DEFAULT_END_SPACESHIP
Definition game.h:590
#define GAME_DEFAULT_EVENT_CACHE_MAX_SIZE
Definition game.h:717
#define GAME_DEFAULT_SAVE_NAME
Definition game.h:684
#define GAME_DEFAULT_MGR_NATIONCHANCE
Definition game.h:540
#define GAME_DEFAULT_FOGOFWAR
Definition game.h:446
#define GAME_DEFAULT_DIPLBULBCOST
Definition game.h:430
#define GAME_DEFAULT_RESTRICTINFRA
Definition game.h:500
#define GAME_DEFAULT_CIVILWARSIZE
Definition game.h:496
void governments_free(void)
Definition government.c:547
#define G_LAST
Definition government.h:50
struct city * owner
Definition citydlg.c:226
void idex_free(struct world *iworld)
Definition idex.c:54
struct city * idex_lookup_city(const struct world *iworld, int id)
Definition idex.c:133
void idex_unregister_city(struct world *iworld, struct city *pcity)
Definition idex.c:97
void idex_init(struct world *iworld)
Definition idex.c:45
void idex_unregister_unit(struct world *iworld, struct unit *punit)
Definition idex.c:115
struct unit * idex_lookup_unit(const struct world *iworld, int id)
Definition idex.c:146
void improvements_init(void)
Definition improvement.c:48
void user_impr_flags_init(void)
Impr_type_id improvement_index(const struct impr_type *pimprove)
bool is_wonder(const struct impr_type *pimprove)
bool is_great_wonder(const struct impr_type *pimprove)
void impr_flags_free(void)
void improvements_free(void)
Definition improvement.c:82
#define WONDER_NOT_OWNED
#define B_LAST
Definition improvement.h:42
const char * name
Definition inputfile.c:127
#define fc_assert_msg(condition, message,...)
Definition log.h:182
#define fc_assert_ret_val(condition, val)
Definition log.h:195
#define log_debug(message,...)
Definition log.h:116
#define log_error(message,...)
Definition log.h:104
void main_map_free(void)
Definition map.c:599
int map_num_tiles(void)
Definition map.c:1152
void map_init(struct civ_map *imap, bool server_side)
Definition map.c:156
#define FC_FREE(ptr)
Definition mem.h:41
void multipliers_free(void)
Definition multipliers.c:43
void multipliers_init(void)
Definition multipliers.c:28
void nations_free(void)
Definition nation.c:660
const char * nation_rule_name(const struct nation_type *pnation)
Definition nation.c:138
struct nation_type * nation_of_unit(const struct unit *punit)
Definition nation.c:480
struct nation_type * nation_of_player(const struct player *pplayer)
Definition nation.c:458
struct nation_type * nation_of_city(const struct city *pcity)
Definition nation.c:470
void nation_sets_groups_free(void)
Definition nation.c:1217
void nation_sets_groups_init(void)
Definition nation.c:1209
int player_number(const struct player *pplayer)
Definition player.c:839
void player_slots_free(void)
Definition player.c:386
void player_ruleset_close(struct player *pplayer)
Definition player.c:747
void player_clear(struct player *pplayer, bool full)
Definition player.c:671
void player_slots_init(void)
Definition player.c:360
#define players_iterate_end
Definition player.h:542
#define players_iterate(_pplayer)
Definition player.h:537
void secfile_destroy(struct section_file *secfile)
void universal_found_functions_init(void)
void researches_init(void)
Definition research.c:64
void researches_free(void)
Definition research.c:100
void rgbcolor_destroy(struct rgbcolor *prgbcolor)
Definition rgbcolor.c:74
int fc_vsnprintcf(char *buf, size_t buf_len, const char *format, const struct cf_sequence *sequences, size_t sequences_num)
Definition shared.c:2205
const char * big_int_to_text(unsigned int mantissa, unsigned int exponent)
Definition shared.c:162
static struct cf_sequence cf_end(void)
Definition shared.h:433
static void cf_int_seq(char letter, int value, struct cf_sequence *out)
Definition shared.h:367
static struct cf_sequence cf_str_seq(char letter, const char *value)
Definition shared.h:419
void specialists_free(void)
Definition specialist.c:53
void specialists_init(void)
Definition specialist.c:36
Definition city.h:318
int diplgoldcost
Definition game.h:147
int contactturns
Definition game.h:144
enum city_names_mode allowed_city_names
Definition game.h:134
int unitwaittime
Definition game.h:205
bool multiresearch
Definition game.h:170
int incite_gold_capt_chance
Definition game.h:149
char * nationlist
Definition game.h:289
size_t as_count
Definition game.h:300
struct civ_game::@32::@36::@42 ruledit
int mgr_worldchance
Definition game.h:169
struct rgbcolor_list * plr_colors
Definition game.h:252
int kick_time
Definition game.h:160
const char ** allowed_govs
Definition game.h:292
bool chat
Definition game.h:260
void(* unit_deallocate)(int unit_id)
Definition game.h:309
enum barbarians_rate barbarianrate
Definition game.h:140
bool last_updated_year
Definition game.h:243
int dispersion
Definition game.h:150
int max_size
Definition game.h:259
int world_peace_start
Definition game.h:245
int save_compress_level
Definition game.h:188
struct rgbcolor * plr_bg_color
Definition game.h:103
int tcptimeout
Definition game.h:202
char start_units[MAX_LEN_STARTUNIT]
Definition game.h:196
int save_nturns
Definition game.h:190
bool debug[DEBUG_LAST]
Definition game.h:209
struct packet_scenario_description scenario_desc
Definition game.h:88
char * description_file
Definition game.h:288
int mgr_nationchance
Definition game.h:167
char connectmsg[MAX_LEN_MSG]
Definition game.h:226
int spaceship_travel_pct
Definition game.h:186
bool save_private_map
Definition game.h:269
int techlost_recv
Definition game.h:201
struct packet_ruleset_control control
Definition game.h:83
char * ruleset_summary
Definition game.h:84
bool mgr_foodneeded
Definition game.h:166
int diplchance
Definition game.h:145
int netwait
Definition game.h:175
struct player * random_move_time
Definition game.h:283
char ** nc_agovs
Definition game.h:293
bool fogofwar_old
Definition game.h:241
int incite_gold_loss_chance
Definition game.h:148
int end_turn
Definition game.h:151
enum plrcolor_mode plrcolormode
Definition game.h:135
int onsetbarbarian
Definition game.h:178
char demography[MAX_LEN_DEMOGRAPHY]
Definition game.h:247
struct civ_game::@32::@36::@40 meta_info
struct civ_game::@34 callbacks
struct packet_game_info info
Definition game.h:89
int mgr_turninterval
Definition game.h:168
char user_message[256]
Definition game.h:273
int min_players
Definition game.h:173
int timeoutcounter
Definition game.h:214
bool endspaceship
Definition game.h:152
time_t last_ping
Definition game.h:217
enum scorelog_level scoreloglevel
Definition game.h:230
char rulesetdir[MAX_LEN_NAME]
Definition game.h:246
int start_year
Definition game.h:198
int lua_timeout
Definition game.h:105
bool migration
Definition game.h:171
int additional_phase_seconds
Definition game.h:219
struct section_file * luadata
Definition game.h:254
int diplbulbcost
Definition game.h:146
int scoreturn
Definition game.h:232
randseed seed
Definition game.h:234
bool natural_city_names
Definition game.h:174
int dbid
Definition game.h:255
char ** embedded_nations
Definition game.h:290
int maxconnectionsperhost
Definition game.h:162
struct packet_scenario_info scenario
Definition game.h:87
int timeoutint
Definition game.h:210
int pingtimeout
Definition game.h:180
char ** nc_astyles
Definition game.h:299
int occupychance
Definition game.h:177
int killunhomed
Definition game.h:161
int nuclear_winter_percent
Definition game.h:239
int conquercost
Definition game.h:143
unsigned revealmap
Definition game.h:184
int pingtime
Definition game.h:179
const char ** allowed_terrains
Definition game.h:295
char * ruleset_description
Definition game.h:85
int civilwarsize
Definition game.h:142
bool save_known
Definition game.h:266
size_t ag_count
Definition game.h:294
bool savepalace
Definition game.h:194
int freecost
Definition game.h:155
const char ** allowed_styles
Definition game.h:298
int aqueductloss
Definition game.h:136
char save_name[MAX_LEN_NAME]
Definition game.h:227
enum fz_method save_compress_type
Definition game.h:189
enum trait_dist_mode trait_dist
Definition game.h:172
bool foggedborders
Definition game.h:154
char ** nc_aterrs
Definition game.h:296
size_t embedded_nations_count
Definition game.h:291
struct civ_game::@32::@36::@39 save_options
char * ruleset_capabilities
Definition game.h:86
int timeoutincmult
Definition game.h:212
bool homecaughtunits
Definition game.h:195
struct civ_game::@32::@36::@38 event_cache
struct civ_game::@32::@36 server
size_t at_count
Definition game.h:297
int timeoutinc
Definition game.h:211
char allow_take[MAX_LEN_ALLOW_TAKE]
Definition game.h:248
bool autoattack
Definition game.h:138
int phase_mode_stored
Definition game.h:223
int max_players
Definition game.h:163
int revolution_length
Definition game.h:185
int turns
Definition game.h:258
bool save_starts
Definition game.h:268
bool auto_ai_toggle
Definition game.h:137
struct veteran_system * veteran
Definition game.h:101
int mgr_distance
Definition game.h:165
int global_warming_percent
Definition game.h:237
struct packet_calendar_info calendar
Definition game.h:90
struct government * government_during_revolution
Definition game.h:94
int timeoutintinc
Definition game.h:213
int techlost_donor
Definition game.h:200
int timeoutaddenemymove
Definition game.h:215
bool scorelog
Definition game.h:229
int techpenalty
Definition game.h:203
int razechance
Definition game.h:183
bool turnblock
Definition game.h:204
char calendar_fragment_name[MAX_CALENDAR_FRAGMENTS][MAX_LEN_NAME]
char negative_year_label[MAX_LEN_NAME]
char positive_year_label[MAX_LEN_NAME]
enum borders_mode borders
enum happyborders_type happyborders
bool global_advances[A_LAST]
Government_type_id government_during_revolution_id
int great_wonder_owners[B_LAST]
enum diplomacy_mode diplomacy
enum trade_revenue_style trade_revenue_style
enum airlifting_style airlifting_style
enum ai_level skill_level
enum revolen_type revolentype
enum phase_mode_type phase_mode
enum caravan_bonus_style caravan_bonus_style
bv_actions diplchance_initial_odds
enum victory_condition_type victory_conditions
Government_type_id default_government_id
char preferred_musicset[MAX_LEN_NAME]
char preferred_tileset[MAX_LEN_NAME]
char preferred_soundset[MAX_LEN_NAME]
char description[MAX_LEN_CONTENT]
char authors[MAX_LEN_PACKET/3]
struct city_list * cities
Definition player.h:281
struct team * team
Definition player.h:261
struct unit_list * units
Definition player.h:282
Definition tile.h:50
Definition unit.h:140
int id
Definition unit.h:147
struct tile * tile
Definition unit.h:142
int homecity
Definition unit.h:148
char * name
Definition game.h:74
char * helptxt
Definition game.h:75
struct civ_map map
void styles_free(void)
Definition style.c:51
void music_styles_free(void)
Definition style.c:148
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:960
bool fc_isalnum(char c)
Definition support.c:1196
#define sz_strlcpy(dest, src)
Definition support.h:195
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
void team_slots_free(void)
Definition team.c:85
int team_number(const struct team *pteam)
Definition team.c:391
void team_slots_init(void)
Definition team.c:53
void tech_classes_init(void)
Definition tech.c:317
void techs_init(void)
Definition tech.c:469
void techs_free(void)
Definition tech.c:520
void user_tech_flags_init(void)
Definition tech.c:380
void user_tech_flags_free(void)
Definition tech.c:392
#define A_LAST
Definition tech.h:45
void user_terrain_flags_init(void)
Definition terrain.c:768
void terrains_free(void)
Definition terrain.c:65
void terrains_init(void)
Definition terrain.c:42
void user_terrain_flags_free(void)
Definition terrain.c:780
void tile_set_worked(struct tile *ptile, struct city *pcity)
Definition tile.c:107
#define tile_worked(_tile)
Definition tile.h:119
#define TILE_XY(ptile)
Definition tile.h:43
void tiledefs_init(void)
Definition tiledef.c:28
void tiledefs_free(void)
Definition tiledef.c:41
void trade_route_types_init(void)
void goods_init(void)
void goods_free(void)
void unit_virtual_destroy(struct unit *punit)
Definition unit.c:1793
#define unit_tile(_pu)
Definition unit.h:407
#define unit_owner(_pu)
Definition unit.h:406
void unit_types_init(void)
Definition unittype.c:2374
void user_unit_type_flags_init(void)
Definition unittype.c:1890
void unit_class_flags_free(void)
Definition unittype.c:2439
const char * unit_rule_name(const struct unit *punit)
Definition unittype.c:1613
void unit_types_free(void)
Definition unittype.c:2413
void veteran_system_destroy(struct veteran_system *vsystem)
Definition unittype.c:2704
void unit_classes_free(void)
Definition unittype.c:2560
void unit_type_flags_free(void)
Definition unittype.c:2427
void user_unit_class_flags_init(void)
Definition unittype.c:1826
void unit_classes_init(void)
Definition unittype.c:2538
void role_unit_precalcs_free(void)
Definition unittype.c:2186