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