Freeciv-3.3
Loading...
Searching...
No Matches
game.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__GAME_H
14#define FC__GAME_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20#include <time.h> /* time_t */
21
22#ifdef FREECIV_HAVE_SYS_TIME_H
23#include <sys/time.h>
24#endif
25
26/* utility */
27#include "randseed.h"
28#include "shared.h"
29#include "timing.h"
30
31/* common */
32#include "connection.h" /* struct conn_list */
33#include "fc_types.h"
34#include "packets.h"
35#include "traits.h"
36
37struct world;
38
43
50
58
66
71
73{
74 char *name;
75 char *helptxt;
76};
77
78/* The number of turns that the first user needs to be attached to a
79 * player for that user to be ranked as that player */
80#define TURNS_NEEDED_TO_RANK 10
81
82struct civ_game {
92
93 struct government *default_government; /* May be overridden by nation */
95
96 struct conn_list *all_connections; /* Including not yet established */
97 struct conn_list *est_connections; /* All established client conns */
98 struct conn_list *glob_observers; /* Global observers */
99 struct conn_list *web_client_connections; /* Connections from web client */
100
101 struct veteran_system *veteran; /* Veteran system */
102
104
106
107 struct {
108 /* Items given to all players at game start.
109 * Client gets this info for help purposes only. */
110 int global_init_techs[MAX_NUM_TECH_LIST];
111 int global_init_buildings[MAX_NUM_BUILDING_LIST];
113
114 union {
115 struct {
116 /* Only used at the client (./client/). */
117
120
123
124 struct {
125 /* Only used in the server (./ai/ and ./server/). */
126
127 /* Defined in the ruleset. */
128
129 /* Game settings & other data. */
130 struct {
133
161 int killunhomed; /* Slowly killing unhomed units */
184 unsigned revealmap;
192 unsigned autosaves; /* FIXME: char would be enough, but current settings.c code wants to
193 write sizeof(unsigned) bytes */
205 int unitwaittime; /* Minimal time between two movements of a unit */
208
210 int timeoutint; /* Increase timeout every N turns... */
211 int timeoutinc; /* ... by this amount ... */
212 int timeoutincmult; /* ... and multiply timeoutinc by this amount ... */
213 int timeoutintinc; /* ... and increase timeoutint by this amount */
214 int timeoutcounter; /* timeoutcounter - timeoutint = turns to next inc. */
215 int timeoutaddenemymove; /* Minimum timeout after an enemy move is seen */
216
218 struct timer *phase_timer; /* Time since seconds_to_phase_done was set. */
220 /* The game.info.phase_mode value indicates the phase mode currently in
221 * use. The "stored" value is a value the player can change; it won't
222 * take effect until the next turn. */
232 int scoreturn; /* Next make_history_report() */
235
240
241 bool fogofwar_old; /* As the fog_of_war bit get changed by setting
242 * the server we need to remember the old setting */
243 bool last_updated_year; /* last_updated is still counted as year in this
244 * game. */
249
250 bool settings_gamestart_valid; /* Valid settings from the game start. */
251
253
255 int dbid;
256
257 struct {
258 int turns;
260 bool chat;
261 bool info;
263
264 /* Used by the map editor to control game_save. */
265 struct {
266 bool save_known; /* Loading will just reveal the squares around
267 * cities and units */
268 bool save_starts; /* Start positions will be auto generated */
269 bool save_private_map; /* FoW map; will be created if not saved */
271
272 struct {
273 char user_message[256];
274 char type[20];
276
277 struct {
280
282
284
286
287 struct {
292 const char **allowed_govs;
293 char **nc_agovs;
294 size_t ag_count;
295 const char **allowed_terrains;
296 char **nc_aterrs;
297 size_t at_count;
298 const char **allowed_styles;
300 size_t as_count;
305 };
306
307 struct {
308 /* Function to be called in game_remove_unit when a unit is deleted. */
309 void (*unit_deallocate)(int unit_id);
311};
312
313extern struct civ_game game;
314
315#ifdef FREECIV_WEB
316/**********************************************************************/
319static inline bool any_web_conns(void)
320{
322}
323#else /* FREECIV_WEB */
324#define any_web_conns() (FALSE)
325#endif /* FREECIV_WEB */
326
328void game_map_init(void);
329void game_free(void);
330void game_reset(void);
331
332void game_ruleset_init(void);
333void game_ruleset_free(void);
334
335int civ_population(const struct player *pplayer);
336struct city *game_city_by_name(const char *name);
337struct city *game_city_by_number(int id);
338
339struct unit *game_unit_by_number(int id);
340
341void game_remove_unit(struct world *gworld, struct unit *punit);
342void game_remove_city(struct world *gworld, struct city *pcity);
343void initialize_globals(void);
344
345bool is_player_phase(const struct player *pplayer, int phase);
346
347const char *population_to_text(int thousand_citizen);
348
349int generate_save_name(const char *format, char *buf, int buflen,
350 const char *reason);
351
352void user_flag_init(struct user_flag *flag);
353void user_flag_free(struct user_flag *flag);
354
355int current_turn_timeout(void);
356
357extern bool _ruleset_compat_mode;
358
359/**********************************************************************/
362static inline void set_ruleset_compat_mode(bool active)
363{
364 _ruleset_compat_mode = active;
365}
366
367/**********************************************************************/
370static inline bool is_ruleset_compat_mode(void)
371{
373}
374
375#define GAME_DEFAULT_SEED 0
376#define GAME_MIN_SEED 0
377#define GAME_MAX_SEED (MAX_UINT32 >> 1)
378
379#define GAME_DEFAULT_GOLD 50
380#define GAME_MIN_GOLD 0
381#define GAME_MAX_GOLD 50000
382
383#define GAME_DEFAULT_INFRA 0
384#define GAME_MIN_INFRA 0
385#define GAME_MAX_INFRA 50000
386
387#define GAME_DEFAULT_START_UNITS "ccwwx"
388#define GAME_DEFAULT_START_CITY FALSE
389
390#define GAME_DEFAULT_DISPERSION 0
391#define GAME_MIN_DISPERSION 0
392#define GAME_MAX_DISPERSION 10
393
394#define GAME_DEFAULT_TECHLEVEL 0
395#define GAME_MIN_TECHLEVEL 0
396#define GAME_MAX_TECHLEVEL 100
397
398#define GAME_DEFAULT_ANGRYCITIZEN TRUE
399
400#define GAME_DEFAULT_END_TURN 5000
401#define GAME_MIN_END_TURN 1
402#define GAME_MAX_END_TURN 32767
403
404#define GAME_DEFAULT_MIN_PLAYERS 1
405#define GAME_MIN_MIN_PLAYERS 0
406#define GAME_MAX_MIN_PLAYERS MAX_NUM_PLAYERS
407
408#define GAME_DEFAULT_MAX_PLAYERS MAX_NUM_PLAYERS
409#define GAME_MIN_MAX_PLAYERS 1
410#define GAME_MAX_MAX_PLAYERS MAX_NUM_PLAYERS
411
412#define GAME_DEFAULT_AIFILL 5
413#define GAME_MIN_AIFILL 0
414#define GAME_MAX_AIFILL GAME_MAX_MAX_PLAYERS
415
416#define GAME_DEFAULT_NATIONSET ""
417
418#define GAME_DEFAULT_FOODBOX 100
419#define GAME_MIN_FOODBOX 1
420#define GAME_MAX_FOODBOX 10000
421
422#define GAME_DEFAULT_SHIELDBOX 100
423#define GAME_MIN_SHIELDBOX 1
424#define GAME_MAX_SHIELDBOX 10000
425
426#define GAME_DEFAULT_SCIENCEBOX 100
427#define GAME_MIN_SCIENCEBOX 1
428#define GAME_MAX_SCIENCEBOX 10000
429
430#define GAME_DEFAULT_DIPLBULBCOST 0
431#define GAME_MIN_DIPLBULBCOST 0
432#define GAME_MAX_DIPLBULBCOST 100
433
434#define GAME_DEFAULT_DIPLGOLDCOST 0
435#define GAME_MIN_DIPLGOLDCOST 0
436#define GAME_MAX_DIPLGOLDCOST 100
437
438#define GAME_DEFAULT_INCITE_GOLD_LOSS_CHANCE 0
439#define GAME_MIN_INCITE_GOLD_LOSS_CHANCE 0
440#define GAME_MAX_INCITE_GOLD_LOSS_CHANCE 100
441
442#define GAME_DEFAULT_INCITE_GOLD_CAPT_CHANCE 0
443#define GAME_MIN_INCITE_GOLD_CAPT_CHANCE 0
444#define GAME_MAX_INCITE_GOLD_CAPT_CHANCE 100
445
446#define GAME_DEFAULT_FOGOFWAR TRUE
447
448#define GAME_DEFAULT_FOGGEDBORDERS FALSE
449
450#define GAME_DEFAULT_GLOBAL_WARMING TRUE
451
452#define GAME_DEFAULT_GLOBAL_WARMING_PERCENT 100
453#define GAME_MIN_GLOBAL_WARMING_PERCENT 1
454#define GAME_MAX_GLOBAL_WARMING_PERCENT 10000
455
456#define GAME_DEFAULT_NUCLEAR_WINTER TRUE
457
458#define GAME_DEFAULT_NUCLEAR_WINTER_PERCENT 100
459#define GAME_MIN_NUCLEAR_WINTER_PERCENT 1
460#define GAME_MAX_NUCLEAR_WINTER_PERCENT 10000
461
462#define GAME_DEFAULT_BORDERS BORDERS_ENABLED
463
464#define GAME_DEFAULT_HAPPYBORDERS HB_NATIONAL
465
466#define GAME_DEFAULT_DIPLOMACY DIPLO_FOR_ALL
467
468#define GAME_DEFAULT_DIPLCHANCE 80
469#define GAME_MIN_DIPLCHANCE 40
470#define GAME_MAX_DIPLCHANCE 100
471
472#define GAME_DEFAULT_FREECOST 0
473#define GAME_MIN_FREECOST 0
474#define GAME_MAX_FREECOST 100
475
476#define GAME_DEFAULT_CONQUERCOST 0
477#define GAME_MIN_CONQUERCOST 0
478#define GAME_MAX_CONQUERCOST 100
479
480#define GAME_DEFAULT_TECHLOSSFG -1
481#define GAME_MIN_TECHLOSSFG -1
482#define GAME_MAX_TECHLOSSFG 200
483
484#define GAME_DEFAULT_TECHLOSSREST 50
485#define GAME_MIN_TECHLOSSREST -1
486#define GAME_MAX_TECHLOSSREST 100
487
488#define GAME_DEFAULT_TECHLEAK 100
489#define GAME_MIN_TECHLEAK 0
490#define GAME_MAX_TECHLEAK 300
491
492#define GAME_DEFAULT_CITYMINDIST 2
493#define GAME_MIN_CITYMINDIST 1
494#define GAME_MAX_CITYMINDIST 11
495
496#define GAME_DEFAULT_CIVILWARSIZE 10
497#define GAME_MIN_CIVILWARSIZE 2 /* can't split an empire of 1 city */
498#define GAME_MAX_CIVILWARSIZE 1000
499
500#define GAME_DEFAULT_RESTRICTINFRA FALSE
501#define GAME_DEFAULT_UNRPROTECTS TRUE
502
503#define GAME_DEFAULT_CONTACTTURNS 20
504#define GAME_MIN_CONTACTTURNS 0
505#define GAME_MAX_CONTACTTURNS 100
506
507#define GAME_DEFAULT_CELEBRATESIZE 3
508
509#define GAME_DEFAULT_RAPTUREDELAY 1
510#define GAME_MIN_RAPTUREDELAY 1
511#define GAME_MAX_RAPTUREDELAY 99 /* 99 practicaly disables rapturing */
512
513#define GAME_DEFAULT_DISASTERS 10
514#define GAME_MIN_DISASTERS 0
515#define GAME_MAX_DISASTERS 1000
516
517#define GAME_DEFAULT_TRAIT_DIST_MODE TDM_FIXED
518
519#define GAME_DEFAULT_SAVEPALACE TRUE
520
521#define GAME_DEFAULT_HOMECAUGHTUNITS TRUE
522
523#define GAME_DEFAULT_NATURALCITYNAMES TRUE
524
525#define GAME_DEFAULT_MIGRATION FALSE
526
527#define GAME_DEFAULT_MGR_TURNINTERVAL 5
528#define GAME_MIN_MGR_TURNINTERVAL 1
529#define GAME_MAX_MGR_TURNINTERVAL 100
530
531#define GAME_DEFAULT_MGR_FOODNEEDED TRUE
532
533/* Definition of the migration distance in relation to the current city
534 * radius; 0 means that migration is possible if the second city is within
535 * the city radius */
536#define GAME_DEFAULT_MGR_DISTANCE 0
537#define GAME_MIN_MGR_DISTANCE (0 - CITY_MAP_MAX_RADIUS)
538#define GAME_MAX_MGR_DISTANCE (1 + CITY_MAP_MAX_RADIUS)
539
540#define GAME_DEFAULT_MGR_NATIONCHANCE 50
541#define GAME_MIN_MGR_NATIONCHANCE 0
542#define GAME_MAX_MGR_NATIONCHANCE 100
543
544#define GAME_DEFAULT_MGR_WORLDCHANCE 10
545#define GAME_MIN_MGR_WORLDCHANCE 0
546#define GAME_MAX_MGR_WORLDCHANCE 100
547
548#define GAME_DEFAULT_AQUEDUCTLOSS 0
549#define GAME_MIN_AQUEDUCTLOSS 0
550#define GAME_MAX_AQUEDUCTLOSS 100
551
552#define GAME_DEFAULT_KILLSTACK TRUE
553#define GAME_DEFAULT_KILLCITIZEN TRUE
554
555#define GAME_DEFAULT_KILLUNHOMED 0
556#define GAME_MIN_KILLUNHOMED 0
557#define GAME_MAX_KILLUNHOMED 100
558
559#define GAME_DEFAULT_TECHPENALTY 100
560#define GAME_MIN_TECHPENALTY 0
561#define GAME_MAX_TECHPENALTY 100
562
563#define GAME_DEFAULT_TECHLOST_RECV 0
564#define GAME_MIN_TECHLOST_RECV 0
565#define GAME_MAX_TECHLOST_RECV 100
566
567#define GAME_DEFAULT_TECHLOST_DONOR 0
568#define GAME_MIN_TECHLOST_DONOR 0
569#define GAME_MAX_TECHLOST_DONOR 100
570
571#define GAME_DEFAULT_TEAM_POOLED_RESEARCH TRUE
572#define GAME_DEFAULT_MULTIRESEARCH FALSE
573
574#define GAME_DEFAULT_RAZECHANCE 20
575#define GAME_MIN_RAZECHANCE 0
576#define GAME_MAX_RAZECHANCE 100
577
578#define GAME_DEFAULT_REVEALMAP REVEAL_MAP_NONE
579
580#define GAME_DEFAULT_SCORELOG FALSE
581#define GAME_DEFAULT_SCORELOGLEVEL SL_ALL
582#define GAME_DEFAULT_SCOREFILE "freeciv-score.log"
583
584/* Turns between reports is random between SCORETURN and (2 x SCORETURN).
585 * First report is shown at SCORETURN. As report is generated in the end of the turn,
586 * first report is already generated at (SCORETURN - 1) */
587#define GAME_DEFAULT_SCORETURN 20
588
589#define GAME_DEFAULT_VICTORY_CONDITIONS (1 << VC_SPACERACE | 1 << VC_ALLIED)
590#define GAME_DEFAULT_END_SPACESHIP TRUE
591
592#define GAME_DEFAULT_SPACESHIP_TRAVEL_PCT 100
593#define GAME_MIN_SPACESHIP_TRAVEL_PCT 50
594#define GAME_MAX_SPACESHIP_TRAVEL_PCT 1000
595
596#define GAME_DEFAULT_TURNBLOCK TRUE
597
598#define GAME_DEFAULT_AUTO_AI_TOGGLE FALSE
599
600#define GAME_DEFAULT_TIMEOUT 0
601#define GAME_DEFAULT_FIRST_TIMEOUT -1
602#define GAME_DEFAULT_TIMEOUTINT 0
603#define GAME_DEFAULT_TIMEOUTINTINC 0
604#define GAME_DEFAULT_TIMEOUTINC 0
605#define GAME_DEFAULT_TIMEOUTINCMULT 1
606#define GAME_DEFAULT_TIMEOUTADDEMOVE 0
607#define GAME_DEFAULT_TIMEOUTCOUNTER 1
608
609#define GAME_DEFAULT_MAXCONNECTIONSPERHOST 4
610#define GAME_MIN_MAXCONNECTIONSPERHOST 0
611#define GAME_MAX_MAXCONNECTIONSPERHOST MAX_NUM_CONNECTIONS
612
613#define GAME_MIN_TIMEOUT -1
614#define GAME_MAX_TIMEOUT 8639999
615#define GAME_MIN_FIRST_TIMEOUT -1
616#define GAME_MAX_FIRST_TIMEOUT GAME_MAX_TIMEOUT
617
618#define GAME_MIN_UNITWAITTIME 0
619#define GAME_MAX_UNITWAITTIME GAME_MAX_TIMEOUT
620#define GAME_DEFAULT_UNITWAITTIME 0
621
622#define GAME_DEFAULT_PHASE_MODE 0
623
624#define GAME_DEFAULT_TCPTIMEOUT 10
625#define GAME_MIN_TCPTIMEOUT 0
626#define GAME_MAX_TCPTIMEOUT 120
627
628#define GAME_DEFAULT_NETWAIT 4
629#define GAME_MIN_NETWAIT 0
630#define GAME_MAX_NETWAIT 20
631
632#define GAME_DEFAULT_PINGTIME 20
633#define GAME_MIN_PINGTIME 1
634#define GAME_MAX_PINGTIME 1800
635
636#define GAME_DEFAULT_PINGTIMEOUT 60
637#define GAME_MIN_PINGTIMEOUT 60
638#define GAME_MAX_PINGTIMEOUT 1800
639
640#define GAME_DEFAULT_IPHIDE FALSE
641
642#define GAME_DEFAULT_NOTRADESIZE 0
643#define GAME_MIN_NOTRADESIZE 0
644#define GAME_MAX_NOTRADESIZE 49
645
646#define GAME_DEFAULT_TRADEWORLDRELPCT 50
647#define GAME_MIN_TRADEWORLDRELPCT 0
648#define GAME_MAX_TRADEWORLDRELPCT 100
649
650#define GAME_DEFAULT_FULLTRADESIZE 1
651#define GAME_MIN_FULLTRADESIZE 1
652#define GAME_MAX_FULLTRADESIZE 50
653
654#define GAME_DEFAULT_TRADING_TECH TRUE
655#define GAME_DEFAULT_TRADING_GOLD TRUE
656#define GAME_DEFAULT_TRADING_CITY TRUE
657
658#define GAME_DEFAULT_CARAVAN_BONUS_STYLE CBS_CLASSIC
659
660#define GAME_DEFAULT_TRADEMINDIST 9
661#define GAME_MIN_TRADEMINDIST 1
662#define GAME_MAX_TRADEMINDIST 999
663
664#define GAME_DEFAULT_TRADE_REVENUE_STYLE TRS_CLASSIC
665
666#define GAME_DEFAULT_BARBARIANRATE BARBS_NORMAL
667
668#define GAME_DEFAULT_ONSETBARBARIAN 60
669#define GAME_MIN_ONSETBARBARIAN 1
670#define GAME_MAX_ONSETBARBARIAN GAME_MAX_END_TURN
671
672#define GAME_DEFAULT_OCCUPYCHANCE 0
673#define GAME_MIN_OCCUPYCHANCE 0
674#define GAME_MAX_OCCUPYCHANCE 100
675
676#define GAME_DEFAULT_AUTOATTACK FALSE
677
678#ifdef FREECIV_WEB
679#define GAME_DEFAULT_RULESETDIR "classic"
680#else /* FREECIV_WEB */
681#define GAME_DEFAULT_RULESETDIR "civ2civ3"
682#endif /* FREECIV_WEB */
683
684#define GAME_DEFAULT_SAVE_NAME "freeciv"
685#define GAME_DEFAULT_SAVETURNS 1
686#define GAME_MIN_SAVETURNS 1
687#define GAME_MAX_SAVETURNS 200
688#define GAME_DEFAULT_SAVEFREQUENCY 15
689#define GAME_MIN_SAVEFREQUENCY 2
690#define GAME_MAX_SAVEFREQUENCY 1440
691
692#ifdef FREECIV_WEB
693#define GAME_DEFAULT_AUTOSAVES 0
694#else /* FREECIV_WEB */
695#define GAME_DEFAULT_AUTOSAVES (1 << AS_TURN | 1 << AS_GAME_OVER | 1 << AS_QUITIDLE | 1 << AS_INTERRUPT)
696#endif /* FREECIV_WEB */
697
698#define GAME_DEFAULT_THREADED_SAVE FALSE
699
700#define GAME_DEFAULT_USER_META_MESSAGE ""
701
702#define GAME_DEFAULT_SKILL_LEVEL AI_LEVEL_EASY
703#define GAME_HARDCODED_DEFAULT_SKILL_LEVEL 3 /* that was 'easy' in old saves */
704#define GAME_OLD_DEFAULT_SKILL_LEVEL 5 /* normal; for oldest save games */
705
706#define GAME_DEFAULT_TOP_CITIES_COUNT 5
707#define GAME_MIN_TOP_CITIES_COUNT 0
708#define GAME_MAX_TOP_CITIES_COUNT 40
709
710#define GAME_DEFAULT_DEMOGRAPHY "NASRLPEMOCqrb"
711#define GAME_DEFAULT_ALLOW_TAKE "HAhadOo"
712
713#define GAME_DEFAULT_EVENT_CACHE_TURNS 1
714#define GAME_MIN_EVENT_CACHE_TURNS 0
715#define GAME_MAX_EVENT_CACHE_TURNS (GAME_MAX_END_TURN + 1)
716
717#define GAME_DEFAULT_EVENT_CACHE_MAX_SIZE 256
718#define GAME_MIN_EVENT_CACHE_MAX_SIZE 10
719#define GAME_MAX_EVENT_CACHE_MAX_SIZE 20000
720
721#define GAME_DEFAULT_EVENT_CACHE_CHAT TRUE
722
723#define GAME_DEFAULT_EVENT_CACHE_INFO FALSE
724
725#define GAME_DEFAULT_COMPRESS_LEVEL 6 /* if we have compression */
726#define GAME_MIN_COMPRESS_LEVEL 1
727#define GAME_MAX_COMPRESS_LEVEL 9
728
729#if defined(FREECIV_HAVE_LIBZSTD)
730# define GAME_DEFAULT_COMPRESS_TYPE FZ_ZSTD
731#elif defined(FREECIV_HAVE_LIBLZMA)
732# define GAME_DEFAULT_COMPRESS_TYPE FZ_XZ
733#elif defined(FREECIV_HAVE_LIBZ)
734# define GAME_DEFAULT_COMPRESS_TYPE FZ_ZLIB
735#else
736# define GAME_DEFAULT_COMPRESS_TYPE FZ_PLAIN
737#endif
738
739#define GAME_DEFAULT_ALLOWED_CITY_NAMES CNM_PLAYER_UNIQUE
740
741#define GAME_DEFAULT_PLRCOLORMODE PLRCOL_PLR_ORDER
742
743#define GAME_DEFAULT_REVOLENTYPE REVOLEN_RANDOM
744#define GAME_DEFAULT_REVOLUTION_LENGTH 5
745#define GAME_MIN_REVOLUTION_LENGTH 1
746#define GAME_MAX_REVOLUTION_LENGTH 20
747
748#define GAME_DEFAULT_START_YEAR -4000
749
750#define GAME_DEFAULT_AIRLIFTINGSTYLE AIRLIFTING_CLASSICAL
751#define GAME_DEFAULT_PERSISTENTREADY PERSISTENTR_DISABLED
752
753#define GAME_MAX_READ_RECURSION 10 /* Max recursion for the read command */
754
755#define GAME_DEFAULT_KICK_TIME 1800 /* 1800 seconds = 30 minutes. */
756#define GAME_MIN_KICK_TIME 0 /* 0 = disabling. */
757#define GAME_MAX_KICK_TIME 86400 /* 86400 seconds = 24 hours. */
758
759#define GAME_DEFAULT_LUA_TIMEOUT 5
760#define GAME_MIN_LUA_TIMEOUT 5
761#define GAME_MAX_LUA_TIMEOUT 30
762
763/* Max distance from the capital used to calculate the bribe cost. */
764#define GAME_UNIT_BRIBE_DIST_MAX 32
765
766/* Max number of recursive transports. */
767#define GAME_TRANSPORT_MAX_RECURSIVE 5
768
769/* Ruleset settings */
770
771#define RS_MAX_VALUE 1000000
772
773/* TRANS: year label (Anno Domini) */
774#define RS_DEFAULT_POS_YEAR_LABEL N_("AD")
775/* TRANS: year label (Before Christ) */
776#define RS_DEFAULT_NEG_YEAR_LABEL N_("BC")
777
778#define RS_DEFAULT_ILLNESS_ON FALSE
779
780#define RS_DEFAULT_ILLNESS_BASE_FACTOR 25
781#define RS_MIN_ILLNESS_BASE_FACTOR 0
782#define RS_MAX_ILLNESS_BASE_FACTOR RS_MAX_VALUE
783
784#define RS_DEFAULT_ILLNESS_MIN_SIZE 3
785#define RS_MIN_ILLNESS_MIN_SIZE 1
786#define RS_MAX_ILLNESS_MIN_SIZE 100
787
788#define RS_DEFAULT_ILLNESS_TRADE_INFECTION_PCT 50
789#define RS_MIN_ILLNESS_TRADE_INFECTION_PCT 0
790#define RS_MAX_ILLNESS_TRADE_INFECTION_PCT 500
791
792#define RS_DEFAULT_ILLNESS_POLLUTION_PCT 50
793#define RS_MIN_ILLNESS_POLLUTION_PCT 0
794#define RS_MAX_ILLNESS_POLLUTION_PCT 500
795
796#define RS_DEFAULT_CALENDAR_SKIP_0 TRUE
797
798#define RS_DEFAULT_BORDER_RADIUS_SQ_CITY 17 /* city radius 4 */
799#define RS_MIN_BORDER_RADIUS_SQ_CITY 0
800#define RS_MAX_BORDER_RADIUS_SQ_CITY 401 /* city radius 20 */
801
802#define RS_DEFAULT_BORDER_SIZE_EFFECT 1
803#define RS_MIN_BORDER_SIZE_EFFECT 0
804#define RS_MAX_BORDER_SIZE_EFFECT 100
805
806#define RS_DEFAULT_BORDER_RADIUS_SQ_CITY_PERMANENT 0
807#define RS_MIN_BORDER_RADIUS_SQ_CITY_PERMANENT (-CITY_MAP_MAX_RADIUS_SQ)
808#define RS_MAX_BORDER_RADIUS_SQ_CITY_PERMANENT 401 /* city radius 20 */
809
810#define RS_DEFAULT_INCITE_BASE_COST 1000
811#define RS_MIN_INCITE_BASE_COST 0
812#define RS_MAX_INCITE_BASE_COST RS_MAX_VALUE
813
814#define RS_DEFAULT_INCITE_IMPROVEMENT_FCT 1
815#define RS_MIN_INCITE_IMPROVEMENT_FCT 0
816#define RS_MAX_INCITE_IMPROVEMENT_FCT RS_MAX_VALUE
817
818#define RS_DEFAULT_INCITE_UNIT_FCT 2
819#define RS_MIN_INCITE_UNIT_FCT 0
820#define RS_MAX_INCITE_UNIT_FCT RS_MAX_VALUE
821
822#define RS_DEFAULT_INCITE_TOTAL_FCT 100
823#define RS_MIN_INCITE_TOTAL_FCT 0
824#define RS_MAX_INCITE_TOTAL_FCT RS_MAX_VALUE
825
826#define RS_DEFAULT_GRANARY_FOOD_INI 20
827
828#define RS_DEFAULT_GRANARY_FOOD_INC 10
829#define RS_MIN_GRANARY_FOOD_INC 0
830#define RS_MAX_GRANARY_FOOD_INC RS_MAX_VALUE
831
832#define RS_DEFAULT_CITY_CENTER_OUTPUT 0
833#define RS_MIN_CITY_CENTER_OUTPUT 0
834#define RS_MAX_CITY_CENTER_OUTPUT RS_MAX_VALUE
835
836#define RS_DEFAULT_CITIES_MIN_DIST 2
837#define RS_MIN_CITIES_MIN_DIST 1
838#define RS_MAX_CITIES_MIN_DIST RS_MAX_VALUE
839
840/* the constants CITY_MAP_*_RADIUS are defined in city.c */
841#define RS_DEFAULT_CITY_RADIUS_SQ CITY_MAP_DEFAULT_RADIUS_SQ
842#define RS_MIN_CITY_RADIUS_SQ CITY_MAP_MIN_RADIUS_SQ
843#define RS_MAX_CITY_RADIUS_SQ CITY_MAP_MAX_RADIUS_SQ
844
845#define RS_DEFAULT_VIS_RADIUS_SQ 5 /* city radius 2 */
846#define RS_MIN_VIS_RADIUS_SQ 0
847#define RS_MAX_VIS_RADIUS_SQ 401 /* city radius 20 */
848
849#define RS_DEFAULT_BASE_POLLUTION -20
850/* no min / max values as it can be set to high negative values to
851 * deactiveate pollution and high positive values to create much
852 * pollution */
853
854#define RS_DEFAULT_HAPPY_COST 2
855#define RS_MIN_HAPPY_COST 0
856#define RS_MAX_HAPPY_COST 10000
857
858#define RS_DEFAULT_FOOD_COST 2
859#define RS_MIN_FOOD_COST 0
860#define RS_MAX_FOOD_COST 10000
861
862#define RS_DEFAULT_TIRED_ATTACK FALSE
863#define RS_DEFAULT_NUKE_POP_LOSS_PCT 49
864#define RS_MIN_NUKE_POP_LOSS_PCT 0
865#define RS_MAX_NUKE_POP_LOSS_PCT 100
866#define RS_DEFAULT_NUKE_DEFENDER_SURVIVAL_CHANCE_PCT 0
867#define RS_MIN_NUKE_DEFENDER_SURVIVAL_CHANCE_PCT 0
868#define RS_MAX_NUKE_DEFENDER_SURVIVAL_CHANCE_PCT 100
869
870#define RS_DEFAULT_BASE_BRIBE_COST 750
871#define RS_MIN_BASE_BRIBE_COST 0
872#define RS_MAX_BASE_BRIBE_COST RS_MAX_VALUE
873
874#define RS_DEFAULT_RANSOM_GOLD 100
875#define RS_MIN_RANSOM_GOLD 0
876#define RS_MAX_RANSOM_GOLD RS_MAX_VALUE
877
878#define RS_DEFAULT_PILLAGE_SELECT TRUE
879
880#define RS_DEFAULT_UPGRADE_VETERAN_LOSS 0
881#define RS_MIN_UPGRADE_VETERAN_LOSS 0
882#define RS_MAX_UPGRADE_VETERAN_LOSS MAX_VET_LEVELS
883
884#define RS_DEFAULT_TECH_UPKEEP_DIVIDER 100
885#define RS_MIN_TECH_UPKEEP_DIVIDER 1
886#define RS_MAX_TECH_UPKEEP_DIVIDER 100000
887
888#define RS_DEFAULT_POISON_EMPTIES_FOOD_STOCK FALSE
889#define RS_DEFAULT_STEAL_MAP_REVEALS_CITIES TRUE
890#define RS_DEFAULT_ACTION_ACTOR_CONSUMING_ALWAYS FALSE
891#define RS_DEFAULT_USER_ACTION_TARGET_KIND ATK_UNIT
892#define RS_DEFAULT_ACTION_MIN_RANGE 0
893#define RS_DEFAULT_ACTION_MAX_RANGE 1
894/* Can't move less than one step, or it's not move at all */
895#define RS_DEFAULT_MOVE_MIN_RANGE 1
896#define RS_DEFAULT_EXPLODE_NUCLEAR_MAX_RANGE 0
897
898#define RS_ACTION_NO_MAX_DISTANCE "unlimited"
899
900#ifdef __cplusplus
901}
902#endif /* __cplusplus */
903
904#endif /* FC__GAME_H */
char * incite_cost
Definition comments.c:76
#define MAX_LEN_MSG
Definition conn_types.h:37
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
trait_dist_mode
Definition fc_types.h:751
#define MAX_NUM_BUILDING_LIST
Definition fc_types.h:46
#define MAX_LEN_ALLOW_TAKE
Definition fc_types.h:70
#define MAX_LEN_STARTUNIT
Definition fc_types.h:73
#define MAX_LEN_NAME
Definition fc_types.h:66
#define MAX_LEN_DEMOGRAPHY
Definition fc_types.h:69
#define MAX_NUM_TECH_LIST
Definition fc_types.h:44
const char * population_to_text(int thousand_citizen)
Definition game.c:739
void game_reset(void)
Definition game.c:493
barbarians_rate
Definition game.h:51
@ BARBS_HUTS_ONLY
Definition game.h:53
@ BARBS_FREQUENT
Definition game.h:55
@ BARBS_NORMAL
Definition game.h:54
@ BARBS_DISABLED
Definition game.h:52
@ BARBS_HORDES
Definition game.h:56
void user_flag_init(struct user_flag *flag)
Definition game.c:829
static bool is_ruleset_compat_mode(void)
Definition game.h:370
void user_flag_free(struct user_flag *flag)
Definition game.c:838
struct civ_game game
Definition game.c:61
void game_ruleset_init(void)
Definition game.c:517
bool is_player_phase(const struct player *pplayer, int phase)
Definition game.c:712
debug_globals
Definition game.h:39
@ DEBUG_LAST
Definition game.h:41
@ DEBUG_FERRIES
Definition game.h:40
scorelog_level
Definition game.h:67
@ SL_HUMANS
Definition game.h:69
@ SL_ALL
Definition game.h:68
int current_turn_timeout(void)
Definition game.c:853
struct city * game_city_by_name(const char *name)
Definition game.c:87
void game_ruleset_free(void)
Definition game.c:566
void game_init(bool keep_ruleset_value)
Definition game.c:445
bool _ruleset_compat_mode
Definition game.c:66
void game_remove_unit(struct world *gworld, struct unit *punit)
Definition game.c:123
struct unit * game_unit_by_number(int id)
Definition game.c:115
int civ_population(const struct player *pplayer)
Definition game.c:73
void game_remove_city(struct world *gworld, struct city *pcity)
Definition game.c:184
#define any_web_conns()
Definition game.h:324
void game_free(void)
Definition game.c:476
autosave_type
Definition game.h:59
@ AS_INTERRUPT
Definition game.h:63
@ AS_GAME_OVER
Definition game.h:61
@ AS_QUITIDLE
Definition game.h:62
@ AS_TIMER
Definition game.h:64
@ AS_TURN
Definition game.h:60
city_names_mode
Definition game.h:44
@ CNM_PLAYER_UNIQUE
Definition game.h:46
@ CNM_GLOBAL_UNIQUE
Definition game.h:47
@ CNM_NO_RESTRICTIONS
Definition game.h:45
@ CNM_NO_STEALING
Definition game.h:48
void game_map_init(void)
Definition game.c:463
void initialize_globals(void)
Definition game.c:688
int generate_save_name(const char *format, char *buf, int buflen, const char *reason)
Definition game.c:796
static void set_ruleset_compat_mode(bool active)
Definition game.h:362
struct city * game_city_by_number(int id)
Definition game.c:106
const char * name
Definition inputfile.c:127
fz_method
Definition ioz.h:37
plrcolor_mode
Definition player.h:52
unsigned int randseed
Definition randseed.h:23
#define MAX_LEN_PATH
Definition shared.h:32
Definition city.h:317
int diplgoldcost
Definition game.h:147
int contactturns
Definition game.h:144
int num_phases
Definition game.h:176
enum city_names_mode allowed_city_names
Definition game.h:134
struct civ_game::@32::@35 client
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
char scorefile[MAX_LEN_PATH]
Definition game.h:231
int named_teams
Definition game.h:301
size_t as_count
Definition game.h:300
char type[20]
Definition game.h:274
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 upgrade_veteran_loss
Definition game.h:206
int dispersion
Definition game.h:150
bool fog_of_war
Definition game.h:121
bool threaded_save
Definition game.h:187
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
struct civ_game::@32::@36::@41 mutexes
int incite_total_factor
Definition game.h:157
int init_vis_radius_sq
Definition game.h:159
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
float turn_change_time
Definition game.h:225
bool vision_reveal_tiles
Definition game.h:207
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
bool fixedlength
Definition game.h:153
int spaceship_travel_pct
Definition game.h:186
struct conn_list * glob_observers
Definition game.h:98
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
bool nuclear_winter
Definition game.h:238
bool settings_gamestart_valid
Definition game.h:250
fc_mutex city_list
Definition game.h:278
enum plrcolor_mode plrcolormode
Definition game.h:135
int onsetbarbarian
Definition game.h:178
int base_incite_cost
Definition game.h:141
bool civil_war_enabled
Definition game.h:131
char demography[MAX_LEN_DEMOGRAPHY]
Definition game.h:247
struct conn_list * est_connections
Definition game.h:97
struct civ_game::@32::@36::@40 meta_info
struct civ_game::@34 callbacks
struct packet_game_info info
Definition game.h:89
int autoupgrade_veteran_loss
Definition game.h:139
int mgr_turninterval
Definition game.h:168
char user_message[256]
Definition game.h:273
int min_players
Definition game.h:173
unsigned autosaves
Definition game.h:192
int timeoutcounter
Definition game.h:214
struct timer * save_timer
Definition game.h:224
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
bool ruleset_ready
Definition game.h:119
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
int incite_improvement_factor
Definition game.h:156
struct section_file * luadata
Definition game.h:254
bool ip_hide
Definition game.h:181
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
struct trait_limits default_traits[TRAIT_COUNT]
Definition game.h:281
int timeoutint
Definition game.h:210
int pingtimeout
Definition game.h:180
char ** nc_astyles
Definition game.h:299
struct conn_list * web_client_connections
Definition game.h:99
int occupychance
Definition game.h:177
randseed seed_setting
Definition game.h:233
struct timer * phase_timer
Definition game.h:218
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
char orig_game_version[MAX_LEN_NAME]
Definition game.h:228
int pingtime
Definition game.h:179
int techloss_restore
Definition game.h:199
const char ** allowed_terrains
Definition game.h:295
char default_ai_type_name[256]
Definition game.h:285
char * ruleset_description
Definition game.h:85
int civilwarsize
Definition game.h:142
struct conn_list * all_connections
Definition game.h:96
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
char nationset[MAX_LEN_NAME]
Definition game.h:164
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
bool std_tileset_compat
Definition game.h:302
struct civ_game::@31 rgame
char ** nc_aterrs
Definition game.h:296
size_t embedded_nations_count
Definition game.h:291
bool ruleset_init
Definition game.h:118
int incite_unit_factor
Definition game.h:158
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
bool global_warming
Definition game.h:236
int ransom_gold
Definition game.h:182
struct civ_game::@32::@36::@38 event_cache
struct civ_game::@32::@36 server
struct packet_timeout_info tinfo
Definition game.h:91
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
bool start_city
Definition game.h:197
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
int save_frequency
Definition game.h:191
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 * default_government
Definition game.h:93
struct civ_game::@32::@36::@37 deprecated
struct government * government_during_revolution
Definition game.h:94
int timeoutintinc
Definition game.h:213
bool info
Definition game.h:261
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
Definition timing.c:81
Definition unit.h:140
char * name
Definition game.h:74
char * helptxt
Definition game.h:75