Freeciv-3.2
Loading...
Searching...
No Matches
settings.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996-2004 - The Freeciv Project
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 "astring.h"
20#include "fcintl.h"
21#include "game.h"
22#include "ioz.h"
23#include "log.h"
24#include "registry.h"
25#include "shared.h"
26#include "string_vector.h"
27
28/* common */
29#include "map.h"
30
31/* server */
32#include "aiiface.h"
33#include "gamehand.h"
34#include "maphand.h"
35#include "meta.h"
36#include "nation.h"
37#include "notify.h"
38#include "plrhand.h"
39#include "report.h"
40#include "rscompat.h"
41#include "rssanity.h"
42#include "setcompat.h"
43#include "srv_main.h"
44#include "stdinhand.h"
45
46#include "settings.h"
47
48/* The following classes determine what can be changed when.
49 * Actually, some of them have the same "changeability", but
50 * different types are separated here in case they have
51 * other uses.
52 * Also, SSET_GAME_INIT/SSET_RULES separate the two sections
53 * of server settings sent to the client.
54 * See the settings[] array and setting_is_changeable() for what
55 * these correspond to and explanations.
56 */
69
70typedef bool (*bool_validate_func_t) (bool value, struct connection *pconn,
71 char *reject_msg,
72 size_t reject_msg_len);
73typedef bool (*int_validate_func_t) (int value, struct connection *pconn,
74 char *reject_msg,
75 size_t reject_msg_len);
76typedef bool (*string_validate_func_t) (const char * value,
77 struct connection *pconn,
78 char *reject_msg,
79 size_t reject_msg_len);
80typedef bool (*enum_validate_func_t) (int value, struct connection *pconn,
81 char *reject_msg,
82 size_t reject_msg_len);
83typedef bool (*bitwise_validate_func_t) (unsigned value,
84 struct connection *pconn,
85 char *reject_msg,
86 size_t reject_msg_len);
87
88typedef void (*action_callback_func_t) (const struct setting *pset);
89typedef const char *(*help_callback_func_t) (const struct setting *pset);
90typedef const struct sset_val_name * (*val_name_func_t) (int value);
91
92struct setting {
93 const char *name;
95
96 /* What access level viewing and setting the setting requires. */
99
100 /*
101 * Should be less than 42 chars (?), or shorter if the values may
102 * have more than about 4 digits. Don't put "." on the end.
103 */
104 const char *short_help;
105
106 /*
107 * May be empty string, if short_help is sufficient. Need not
108 * include embedded newlines (but may, for formatting); lines will
109 * be wrapped (and indented) automatically. Should have punctuation
110 * etc, and should end with a "."
111 */
112 const char *extra_help;
113
114 /* help function */
116
120
121 /*
122 * About the *_validate functions: If the function is non-NULL, it
123 * is called with the new value, and returns whether the change is
124 * legal. The char * is an error message in the case of reject.
125 */
126
127 union {
128 /*** bool part ***/
129 struct {
130 bool *const pvalue;
131 const bool default_value;
136 /*** int part ***/
137 struct {
138 int *const pvalue;
139 const int default_value;
140 const int min_value;
141 const int max_value;
145 /*** string part ***/
146 struct {
147 char *const value;
148 const char *const default_value;
149 const size_t value_size;
153 /*** enumerator part ***/
154 struct {
155 void *const pvalue;
156 const int store_size;
157 const int default_value;
159 const val_name_func_t name;
160 int game_value;
162 /*** bitwise part ***/
163 struct {
164 unsigned *const pvalue;
165 const unsigned default_value;
167 const val_name_func_t name;
168 unsigned game_value;
170 };
171
172 /* action function */
174
175 /* Lock for game settings */
177
178 /* Remember if there's also ruleset lock. */
179 bool rslock;
180
182
183 /* It's not "default", even if value is the same as default */
186};
187
188static struct {
189 bool init;
191} setting_sorted = { .init = FALSE };
192
193static void setting_ruleset_setdef(struct setting *pset);
194static bool setting_ruleset_one(struct section_file *file,
195 const char *name, const char *path,
196 bool compat);
197static void setting_game_set(struct setting *pset, bool init);
198static void setting_game_free(struct setting *pset);
199static void setting_game_restore(struct setting *pset);
200
201static void settings_list_init(void);
202static void settings_list_free(void);
203int settings_list_cmp(const struct setting *const *pset1,
204 const struct setting *const *pset2);
205
206#define settings_snprintf(_buf, _buf_len, format, ...) \
207 if (_buf != NULL) { \
208 fc_snprintf(_buf, _buf_len, format, ## __VA_ARGS__); \
209 }
210
211static bool set_enum_value(struct setting *pset, int val);
212
213/****************************************************************************
214 Enumerator name accessors.
215
216 Important note about compatibility:
217 1) you cannot modify the support name of an existant value. However, in a
218 development, you can modify it if it wasn't included in any stable
219 branch before.
220 2) Take care of modifiying the pretty name of an existant value: make sure
221 to modify the help texts which are using it.
222****************************************************************************/
223
224#define NAME_CASE(_val, _support, _pretty) \
225 case _val: \
226 { \
227 static const struct sset_val_name name = { _support, _pretty }; \
228 return &name; \
229 }
230
231/************************************************************************/
235{
236 switch (caravanbonus) {
237 /* TRANS: Description of caravan bonus style setting value. */
238 NAME_CASE(CBS_CLASSIC, "CLASSIC", N_("Classic Freeciv"));
239 NAME_CASE(CBS_LOGARITHMIC, "LOGARITHMIC", N_("Log^2 N style"));
240 }
241
242 return NULL;
243}
244
245/************************************************************************/
249static const struct sset_val_name *mapsize_name(int mapsize)
250{
251 switch (mapsize) {
252 NAME_CASE(MAPSIZE_FULLSIZE, "FULLSIZE", N_("Number of tiles"));
253 NAME_CASE(MAPSIZE_PLAYER, "PLAYER", N_("Tiles per player"));
254 NAME_CASE(MAPSIZE_XYSIZE, "XYSIZE", N_("Width and height"));
255 }
256 return NULL;
257}
258
259/************************************************************************/
262static const struct sset_val_name *topology_name(int topology_bit)
263{
264 switch (1 << topology_bit) {
265 NAME_CASE(TF_ISO, "ISO", N_("Isometric"));
266 NAME_CASE(TF_HEX, "HEX", N_("Hexagonal"));
267 }
268
269 return NULL;
270}
271
272/************************************************************************/
275static const struct sset_val_name *wrap_name(int wrap_bit)
276{
277 switch (1 << wrap_bit) {
278 NAME_CASE(WRAP_X, "WRAPX", N_("Wrap East-West"));
279 NAME_CASE(WRAP_Y, "WRAPY", N_("Wrap North-South"));
280 }
281
282 return NULL;
283}
284
285/************************************************************************/
289{
290 switch (revenue_style) {
291 /* TRANS: Description of trade revenue style setting value. */
292 NAME_CASE(TRS_CLASSIC, "CLASSIC", N_("Classic Freeciv"));
293 NAME_CASE(TRS_SIMPLE, "SIMPLE", N_("Proportional to tile trade"));
294 }
295
296 return NULL;
297}
298
299/************************************************************************/
302static const struct sset_val_name *generator_name(int generator)
303{
304 switch (generator) {
305 NAME_CASE(MAPGEN_SCENARIO, "SCENARIO", N_("Scenario map"));
306 NAME_CASE(MAPGEN_RANDOM, "RANDOM", N_("Fully random height"));
307 NAME_CASE(MAPGEN_FRACTAL, "FRACTAL", N_("Pseudo-fractal height"));
308 NAME_CASE(MAPGEN_ISLAND, "ISLAND", N_("Island-based"));
309 NAME_CASE(MAPGEN_FAIR, "FAIR", N_("Fair islands"));
310 NAME_CASE(MAPGEN_FRACTURE, "FRACTURE", N_("Fracture map"));
311 }
312 return NULL;
313}
314
315/************************************************************************/
318static const struct sset_val_name *startpos_name(int startpos)
319{
320 switch (startpos) {
322 N_("Generator's choice"));
324 N_("One player per continent"));
326 N_("Two or three players per continent"));
328 N_("All players on a single continent"));
330 N_("Depending on size of continents"));
331 }
332 return NULL;
333}
334
335/************************************************************************/
338static const struct sset_val_name *teamplacement_name(int team_placement)
339{
340 switch (team_placement) {
342 N_("Disabled"));
344 N_("As close as possible"));
346 N_("On the same continent"));
348 N_("Horizontal placement"));
350 N_("Vertical placement"));
351 }
352 return NULL;
353}
354
355/************************************************************************/
358static const struct sset_val_name *persistentready_name(int persistent_ready)
359{
360 switch (persistent_ready) {
362 N_("Disabled"));
363 NAME_CASE(PERSISTENTR_CONNECTED, "CONNECTED",
364 N_("As long as connected"));
365 }
366
367 return NULL;
368}
369
370/************************************************************************/
374{
375 switch (condition_bit) {
376 NAME_CASE(VC_SPACERACE, "SPACERACE", N_("Spacerace"));
377 NAME_CASE(VC_ALLIED, "ALLIED", N_("Allied victory"));
378 NAME_CASE(VC_CULTURE, "CULTURE", N_("Culture victory"));
379 };
380
381 return NULL;
382}
383
384/************************************************************************/
388{
389 switch (autosaves_bit) {
390 NAME_CASE(AS_TURN, "TURN", N_("New turn"));
391 NAME_CASE(AS_GAME_OVER, "GAMEOVER", N_("Game over"));
392 NAME_CASE(AS_QUITIDLE, "QUITIDLE", N_("No player connections"));
393 NAME_CASE(AS_INTERRUPT, "INTERRUPT", N_("Server interrupted"));
394 NAME_CASE(AS_TIMER, "TIMER", N_("Timer"));
395 };
396
397 return NULL;
398}
399
400/************************************************************************/
403static const struct sset_val_name *borders_name(int borders)
404{
405 switch (borders) {
406 NAME_CASE(BORDERS_DISABLED, "DISABLED", N_("Disabled"));
407 NAME_CASE(BORDERS_ENABLED, "ENABLED", N_("Enabled"));
408 NAME_CASE(BORDERS_SEE_INSIDE, "SEE_INSIDE",
409 N_("See everything inside borders"));
410 NAME_CASE(BORDERS_EXPAND, "EXPAND",
411 N_("Borders expand to unknown, revealing tiles"));
412 }
413 return NULL;
414}
415
416/************************************************************************/
419static const struct sset_val_name *trait_dist_name(int trait_dist)
420{
421 switch (trait_dist) {
422 NAME_CASE(TDM_FIXED, "FIXED", N_("Fixed"));
423 NAME_CASE(TDM_EVEN, "EVEN", N_("Even"));
424 }
425 return NULL;
426}
427
428/************************************************************************/
431static const struct sset_val_name *plrcol_name(int plrcol)
432{
433 switch (plrcol) {
434 NAME_CASE(PLRCOL_PLR_ORDER, "PLR_ORDER", N_("Per-player, in order"));
435 NAME_CASE(PLRCOL_PLR_RANDOM, "PLR_RANDOM", N_("Per-player, random"));
436 NAME_CASE(PLRCOL_PLR_SET, "PLR_SET", N_("Set manually"));
437 NAME_CASE(PLRCOL_TEAM_ORDER, "TEAM_ORDER", N_("Per-team, in order"));
438 NAME_CASE(PLRCOL_NATION_ORDER, "NATION_ORDER", N_("Per-nation, in order"));
439 }
440 return NULL;
441}
442
443/************************************************************************/
446static const struct sset_val_name *happyborders_name(int happyborders)
447{
448 switch (happyborders) {
449 NAME_CASE(HB_DISABLED, "DISABLED", N_("Borders are not helping"));
450 NAME_CASE(HB_NATIONAL, "NATIONAL", N_("Happy within own borders"));
451 NAME_CASE(HB_ALLIANCE, "ALLIED", N_("Happy within allied borders"));
452 }
453 return NULL;
454}
455
456/************************************************************************/
459static const struct sset_val_name *diplomacy_name(int diplomacy)
460{
461 switch (diplomacy) {
462 NAME_CASE(DIPLO_FOR_ALL, "ALL", N_("Enabled for everyone"));
464 N_("Only allowed between human players"));
465 NAME_CASE(DIPLO_FOR_AIS, "AI", N_("Only allowed between AI players"));
466 NAME_CASE(DIPLO_NO_AIS, "NOAI", N_("Only allowed when human involved"));
467 NAME_CASE(DIPLO_NO_MIXED, "NOMIXED", N_("Only allowed between two humans, or two AI players"));
468 NAME_CASE(DIPLO_FOR_TEAMS, "TEAM", N_("Restricted to teams"));
469 NAME_CASE(DIPLO_DISABLED, "DISABLED", N_("Disabled for everyone"));
470 }
471 return NULL;
472}
473
474/************************************************************************/
477static const struct sset_val_name *citynames_name(int citynames)
478{
479 switch (citynames) {
480 NAME_CASE(CNM_NO_RESTRICTIONS, "NO_RESTRICTIONS", N_("No restrictions"));
481 NAME_CASE(CNM_PLAYER_UNIQUE, "PLAYER_UNIQUE", N_("Unique to a player"));
482 NAME_CASE(CNM_GLOBAL_UNIQUE, "GLOBAL_UNIQUE", N_("Globally unique"));
483 NAME_CASE(CNM_NO_STEALING, "NO_STEALING", N_("No city name stealing"));
484 }
485 return NULL;
486}
487
488/************************************************************************/
491static const struct sset_val_name *barbarians_name(int barbarians)
492{
493 switch (barbarians) {
494 NAME_CASE(BARBS_DISABLED, "DISABLED", N_("No barbarians"));
495 NAME_CASE(BARBS_HUTS_ONLY, "HUTS_ONLY", N_("Only in huts"));
496 NAME_CASE(BARBS_NORMAL, "NORMAL", N_("Normal rate of appearance"));
497 NAME_CASE(BARBS_FREQUENT, "FREQUENT", N_("Frequent barbarian uprising"));
498 NAME_CASE(BARBS_HORDES, "HORDES", N_("Raging hordes"));
499 }
500 return NULL;
501}
502
503/************************************************************************/
506static const struct sset_val_name *revolentype_name(int revolentype)
507{
508 switch (revolentype) {
509 NAME_CASE(REVOLEN_FIXED, "FIXED", N_("Fixed to 'revolen' turns"));
510 NAME_CASE(REVOLEN_RANDOM, "RANDOM", N_("Randomly 1-'revolen' turns"));
511 NAME_CASE(REVOLEN_QUICKENING, "QUICKENING", N_("First time 'revolen', then always quicker"));
512 NAME_CASE(REVOLEN_RANDQUICK, "RANDQUICK", N_("Random, max always quicker"));
513 }
514 return NULL;
515}
516
517/************************************************************************/
520static const struct sset_val_name *revealmap_name(int bit)
521{
522 switch (1 << bit) {
523 NAME_CASE(REVEAL_MAP_START, "START", N_("Reveal map at game start"));
524 NAME_CASE(REVEAL_MAP_DEAD, "DEAD", N_("Unfog map for dead players"));
525 }
526 return NULL;
527}
528
529/************************************************************************/
532static const struct sset_val_name *airliftingstyle_name(int bit)
533{
534 switch (1 << bit) {
535 NAME_CASE(AIRLIFTING_ALLIED_SRC, "FROM_ALLIES",
536 N_("Allows units to be airlifted from allied cities"));
538 N_("Allows units to be airlifted to allied cities"));
539 NAME_CASE(AIRLIFTING_UNLIMITED_SRC, "SRC_UNLIMITED",
540 N_("Unlimited units from source city"));
541 NAME_CASE(AIRLIFTING_UNLIMITED_DEST, "DEST_UNLIMITED",
542 N_("Unlimited units to destination city"));
543 }
544 return NULL;
545}
546
547/************************************************************************/
550static const struct sset_val_name *phasemode_name(int phasemode)
551{
552 switch (phasemode) {
553 NAME_CASE(PMT_CONCURRENT, "ALL", N_("All players move concurrently"));
555 "PLAYER", N_("All players alternate movement"));
556 NAME_CASE(PMT_TEAMS_ALTERNATE, "TEAM", N_("Team alternate movement"));
557 }
558 return NULL;
559}
560
561/************************************************************************/
564static const struct sset_val_name *
566{
567 switch (sl_level) {
568 NAME_CASE(SL_ALL, "ALL", N_("All players"));
569 NAME_CASE(SL_HUMANS, "HUMANS", N_("Human players only"));
570 }
571 return NULL;
572}
573
574/************************************************************************/
577static const struct sset_val_name *
579{
580 switch (compresstype) {
581 NAME_CASE(FZ_PLAIN, "PLAIN", N_("No compression"));
582#ifdef FREECIV_HAVE_LIBZ
583 NAME_CASE(FZ_ZLIB, "LIBZ", N_("Using zlib (gzip format)"));
584#endif
585#ifdef FREECIV_HAVE_LIBBZ2
586 case FZ_BZIP2:
587 break;
588#endif
589#ifdef FREECIV_HAVE_LIBLZMA
590 NAME_CASE(FZ_XZ, "XZ", N_("Using xz"));
591#endif
592#ifdef FREECIV_HAVE_LIBZSTD
593 NAME_CASE(FZ_ZSTD, "ZSTD", N_("Using zstd"));
594#endif
595 }
596
597 return NULL;
598}
599
600/************************************************************************/
603static const struct sset_val_name *
604ailevel_name(enum ai_level lvl)
605{
606 const char *lvlname;
607
608 if (lvl >= AI_LEVEL_AWAY) {
609 return NULL;
610 }
611
613
614 if (lvlname != NULL) {
615 static struct sset_val_name name[AI_LEVEL_COUNT];
616
619
620 return &name[lvl];
621 }
622
623 return NULL;
624}
625
626/************************************************************************/
629static const struct sset_val_name *bool_name(int enable)
630{
631 switch (enable) {
632 NAME_CASE(FALSE, "DISABLED", N_("disabled"));
633 NAME_CASE(TRUE, "ENABLED", N_("enabled"));
634 }
635 return NULL;
636}
637
638#undef NAME_CASE
639
640/****************************************************************************
641 Help callback functions.
642****************************************************************************/
643
644/************************************************************************/
647static const char *phasemode_help(const struct setting *pset)
648{
649 static char pmhelp[512];
650
651 /* Translated here */
652 fc_snprintf(pmhelp, sizeof(pmhelp),
653 _("This setting controls whether players may make "
654 "moves at the same time during a turn. Change "
655 "in setting takes effect next turn. Currently, at least "
656 "to the end of this turn, mode is \"%s\"."),
658
659 return pmhelp;
660}
661
662/************************************************************************/
665static const char *huts_help(const struct setting *pset)
666{
667 if (wld.map.server.huts_absolute >= 0) {
668 static char hutshelp[512];
669
670 /* Translated here */
672 _("%s\n"
673 "Currently this setting is being overridden by an "
674 "old scenario or savegame, which has set the absolute "
675 "number of huts to %d. Explicitly set this setting "
676 "again to make it take effect instead."),
677 _(pset->extra_help), wld.map.server.huts_absolute);
678
679 return hutshelp;
680 }
681
682 return pset->extra_help;
683}
684
685/****************************************************************************
686 Action callback functions.
687****************************************************************************/
688
689/************************************************************************/
692static void scorelog_action(const struct setting *pset)
693{
694 if (*pset->boolean.pvalue) {
696 } else {
698 }
699}
700
701/************************************************************************/
704static void aifill_action(const struct setting *pset)
705{
706 const char *msg = aifill(*pset->integer.pvalue);
707 if (msg) {
708 log_normal(_("Warning: aifill not met: %s."), msg);
710 _("Warning: aifill not met: %s."), msg);
711 }
712}
713
714/************************************************************************/
717static void nationset_action(const struct setting *pset)
718{
719 /* If any player's existing selection is invalid, abort it */
720 players_iterate(pplayer) {
721 if (pplayer->nation != NULL) {
722 if (!nation_is_in_current_set(pplayer->nation)) {
725 }
726 }
730
731 /* There might now be too many players for the available nations.
732 * Rather than getting rid of some players arbitrarily, we let the
733 * situation persist for all already-connected players; the server
734 * will simply refuse to start until someone reduces the number of
735 * players. This policy also avoids annoyance if nationset is
736 * accidentally and transiently set to an unintended value.
737 * (However, new connections will start out detached.) */
738 if (normal_player_count() > server.playable_nations) {
740 _("Warning: not enough nations in this nation set "
741 "for all current players."));
742 }
743
745}
746
747/************************************************************************/
750static void plrcol_action(const struct setting *pset)
751{
752 if (!game_was_started()) {
754 players_iterate(pplayer) {
757 }
758 /* Update clients with new color scheme. */
760 }
761}
762
763/************************************************************************/
766static void autotoggle_action(const struct setting *pset)
767{
768 if (*pset->boolean.pvalue) {
769 players_iterate(pplayer) {
770 if (is_human(pplayer) && !pplayer->is_connected) {
773 }
775 }
776}
777
778/************************************************************************/
782static void timeout_action(const struct setting *pset)
783{
784 if (S_S_RUNNING == server_state()) {
785 int timeout = *pset->integer.pvalue;
786
787 if (game.info.turn != 1 || game.info.first_timeout == -1) {
788 /* This may cause the current turn to end immediately. */
790 }
792 }
793}
794
795/************************************************************************/
799static void first_timeout_action(const struct setting *pset)
800{
801 if (S_S_RUNNING == server_state()) {
802 int timeout = *pset->integer.pvalue;
803
804 if (game.info.turn == 1) {
805 /* This may cause the current turn to end immediately. */
806 if (timeout != -1) {
808 } else {
810 }
811 }
813 }
814}
815
816/************************************************************************/
819static void huts_action(const struct setting *pset)
820{
822}
823
824/************************************************************************/
827static void topology_action(const struct setting *pset)
828{
829 struct packet_set_topology packet;
830
831 packet.topology_id = *pset->integer.pvalue;
832 packet.wrap_id = wld.map.wrap_id;
833
837}
838
839/************************************************************************/
842static void wrap_action(const struct setting *pset)
843{
844 struct packet_set_topology packet;
845
847 packet.wrap_id = *pset->integer.pvalue;
848
852}
853
854/************************************************************************/
858static void metamessage_action(const struct setting *pset)
859{
860 /* Set the metaserver message based on the new meta server user message.
861 * An empty user metaserver message results in an automatic meta message.
862 * A non empty user meta message results in the user meta message. */
863 set_user_meta_message_string(pset->string.value);
864
865 if (is_metaserver_open()) {
866 /* Update the meta server. */
868 }
869}
870
871/************************************************************************/
874static void aitype_action(const struct setting *pset)
875{
876 if (!set_default_ai_type_name(pset->string.value)) {
877 log_warn(_("Failed to update default AI type."));
878 }
879}
880
881/****************************************************************************
882 Validation callback functions.
883****************************************************************************/
884
885/************************************************************************/
888static bool savename_validate(const char *value, struct connection *caller,
889 char *reject_msg, size_t reject_msg_len)
890{
891 char buf[MAX_LEN_PATH];
892
893 generate_save_name(value, buf, sizeof(buf), NULL);
894
895 if (!is_safe_filename(buf)) {
897 _("Invalid save name definition: '%s' "
898 "(resolves to '%s')."), value, buf);
899 return FALSE;
900 }
901
902 return TRUE;
903}
904
905/************************************************************************/
909static bool generator_validate(int value, struct connection *caller,
910 char *reject_msg, size_t reject_msg_len)
911{
912 if (map_is_empty()) {
913 if (MAPGEN_SCENARIO == value
914 && (NULL != caller || !game.scenario.is_scenario)) {
916 _("You cannot disable the map generator."));
917 return FALSE;
918 }
919 return TRUE;
920 } else {
921 if (MAPGEN_SCENARIO != value) {
923 _("You cannot require a map generator "
924 "when a map is loaded."));
925 return FALSE;
926 }
927 }
928 return TRUE;
929}
930
931/************************************************************************/
934#ifndef FREECIV_WEB
935static bool scorefile_validate(const char *value, struct connection *caller,
936 char *reject_msg, size_t reject_msg_len)
937{
938 if (!is_safe_filename(value)) {
940 _("Invalid score name definition: '%s'."), value);
941 return FALSE;
942 }
943
944 return TRUE;
945}
946#endif /* !FREECIV_WEB */
947
948/************************************************************************/
952static bool demography_callback(const char *value,
953 struct connection *caller,
954 char *reject_msg,
955 size_t reject_msg_len)
956{
957 int error;
958
959 if (is_valid_demography(value, &error)) {
960 return TRUE;
961 } else {
963 _("Demography string validation failed at character: "
964 "'%c'. Try \"/help demography\"."), value[error]);
965 return FALSE;
966 }
967}
968
969/************************************************************************/
972static bool autosaves_callback(unsigned value, struct connection *caller,
973 char *reject_msg, size_t reject_msg_len)
974{
975 if (S_S_RUNNING == server_state()) {
976 if ((value & (1 << AS_TIMER))
977 && !(game.server.autosaves & (1 << AS_TIMER))) {
981 ? NULL : "save interval");
983 } else if (!(value & (1 << AS_TIMER))
984 && (game.server.autosaves & (1 << AS_TIMER))) {
988 }
989 }
990
991 return TRUE;
992}
993
994/************************************************************************/
998static bool allowtake_callback(const char *value,
999 struct connection *caller,
1000 char *reject_msg,
1001 size_t reject_msg_len)
1002{
1003 int len = strlen(value), i;
1005
1006 /* We check each character individually to see if it's valid. This
1007 * does not check for duplicate entries.
1008 *
1009 * We also track the state of the machine. havecharacter_state is
1010 * true if the preceeding character was a primary label, e.g.
1011 * NHhAadb. It is false if the preceeding character was a modifier
1012 * or if this is the first character. */
1013
1014 for (i = 0; i < len; i++) {
1015 /* Check to see if the character is a primary label. */
1016 if (strchr("HhAadbOo", value[i])) {
1018 continue;
1019 }
1020
1021 /* If we've already passed a primary label, check to see if the
1022 * character is a modifier. */
1023 if (havecharacter_state && strchr("1234", value[i])) {
1025 continue;
1026 }
1027
1028 /* Looks like the character was invalid. */
1030 _("Allowed take string validation failed at "
1031 "character: '%c'. Try \"/help allowtake\"."),
1032 value[i]);
1033 return FALSE;
1034 }
1035
1036 /* All characters were valid. */
1037 return TRUE;
1038}
1039
1040/************************************************************************/
1044static bool startunits_callback(const char *value,
1045 struct connection *caller,
1046 char *reject_msg,
1047 size_t reject_msg_len)
1048{
1049 int len = strlen(value), i;
1051 bool firstnative = FALSE;
1052
1053 if (len == 0) {
1054 return TRUE;
1055 }
1056
1057 /* We check each character individually to see if it's valid. */
1058 for (i = 0; i < len; i++) {
1059 if (strchr("cwxksfdDaA", value[i])) {
1060 continue;
1061 }
1062
1063 /* Looks like the character was invalid. */
1065 _("Starting units string validation failed at "
1066 "character '%c'. Try \"/help startunits\"."),
1067 value[i]);
1068 return FALSE;
1069 }
1070
1071 /* Check the first character to make sure it can use a startpos. */
1073 crole_to_role_id(value[0]), 0)));
1074 terrain_type_iterate(pterrain) {
1075 if (terrain_has_flag(pterrain, TER_STARTER)
1076 && BV_ISSET(pterrain->native_to, first_role)) {
1077 firstnative = TRUE;
1078 break;
1079 }
1081
1082 if (!firstnative) {
1083 /* Loading would cause an infinite loop hunting for a valid startpos. */
1085 _("The first starting unit must be native to at "
1086 "least one \"Starter\" terrain. "
1087 "Try \"/help startunits\"."));
1088 return FALSE;
1089 }
1090
1091 /* Everything seems fine. */
1092 return TRUE;
1093}
1094
1095/************************************************************************/
1098static bool endturn_callback(int value, struct connection *caller,
1099 char *reject_msg, size_t reject_msg_len)
1100{
1101 if (value < game.info.turn) {
1102 /* Tried to set endturn earlier than current turn */
1104 _("Cannot set endturn earlier than current turn."));
1105 return FALSE;
1106 }
1107 return TRUE;
1108}
1109
1110/************************************************************************/
1113static bool maxplayers_callback(int value, struct connection *caller,
1114 char *reject_msg, size_t reject_msg_len)
1115{
1116 if (value < player_count()) {
1118 _("Number of players (%d) is higher than requested "
1119 "value (%d). Keeping old value."), player_count(),
1120 value);
1121 return FALSE;
1122 }
1123 /* If any start positions are defined by a scenario, we can only
1124 * accommodate as many players as we have start positions. */
1126 && 0 < map_startpos_count() && value > map_startpos_count()) {
1128 _("Requested value (%d) is greater than number of "
1129 "available start positions (%d). Keeping old value."),
1130 value, map_startpos_count());
1131 return FALSE;
1132 }
1133
1134 return TRUE;
1135}
1136
1137/************************************************************************/
1140static bool nationset_callback(const char *value,
1141 struct connection *caller,
1142 char *reject_msg,
1143 size_t reject_msg_len)
1144{
1145 if (strlen(value) == 0) {
1146 return TRUE;
1147 } else if (nation_set_by_rule_name(value)) {
1148 return TRUE;
1149 } else {
1151 /* TRANS: do not translate 'list nationsets' */
1152 _("Unknown nation set \"%s\". See '%slist nationsets' "
1153 "for possible values."), value, caller ? "/" : "");
1154 return FALSE;
1155 }
1156}
1157
1158/************************************************************************/
1161static bool timeout_callback(int value, struct connection *caller,
1162 char *reject_msg, size_t reject_msg_len)
1163{
1164 /* Disallow low timeout values for non-hack connections. */
1165 if (caller && caller->access_level < ALLOW_HACK
1166 && value < 30 && value != 0) {
1168 _("You are not allowed to set timeout values less "
1169 "than 30 seconds."));
1170 return FALSE;
1171 }
1172
1173 if (value == -1 && game.server.unitwaittime != 0) {
1174 /* autogame only with 'unitwaittime' = 0 */
1176 /* TRANS: Do not translate setting names in ''. */
1177 _("For autogames ('timeout' = -1) 'unitwaittime' "
1178 "should be deactivated (= 0)."));
1179 return FALSE;
1180 }
1181
1182 if (value > 0 && value < game.server.unitwaittime * 3 / 2) {
1183 /* for normal games 'timeout' should be at least 3/2 times the value
1184 * of 'unitwaittime' */
1186 /* TRANS: Do not translate setting names in ''. */
1187 _("'timeout' can not be lower than 3/2 of the "
1188 "'unitwaittime' setting (= %d). Please change "
1189 "'unitwaittime' first."), game.server.unitwaittime);
1190 return FALSE;
1191 }
1192
1193 return TRUE;
1194}
1195
1196/************************************************************************/
1199static bool first_timeout_callback(int value, struct connection *caller,
1200 char *reject_msg, size_t reject_msg_len)
1201{
1202 /* Disallow low timeout values for non-hack connections. */
1203 if (caller && caller->access_level < ALLOW_HACK
1204 && value < 30 && value != 0) {
1206 _("You are not allowed to set timeout values less "
1207 "than 30 seconds."));
1208 return FALSE;
1209 }
1210
1211 return TRUE;
1212}
1213
1214/************************************************************************/
1217static bool unitwaittime_callback(int value, struct connection *caller,
1218 char *reject_msg, size_t reject_msg_len)
1219{
1220 if (game.info.timeout == -1 && value != 0) {
1222 /* TRANS: Do not translate setting names in ''. */
1223 _("For autogames ('timeout' = -1) 'unitwaittime' "
1224 "should be deactivated (= 0)."));
1225 return FALSE;
1226 }
1227
1228 if (game.info.timeout > 0 && value > game.info.timeout * 2 / 3) {
1230 /* TRANS: Do not translate setting names in ''. */
1231 _("'unitwaittime' has to be lower than 2/3 of the "
1232 "'timeout' setting (= %d). Please change 'timeout' "
1233 "first."), game.info.timeout);
1234 return FALSE;
1235 }
1236
1237 return TRUE;
1238}
1239
1240/************************************************************************/
1243static bool mapsize_callback(int value, struct connection *caller,
1244 char *reject_msg, size_t reject_msg_len)
1245{
1246 if (value == MAPSIZE_XYSIZE && MAP_IS_ISOMETRIC
1247 && wld.map.ysize % 2 != 0) {
1248 /* An isometric map needs a even ysize. It is calculated automatically
1249 * for all settings but mapsize=XYSIZE. */
1251 _("For an isometric or hexagonal map the ysize must be "
1252 "even."));
1253 return FALSE;
1254 }
1255
1256 return TRUE;
1257}
1258
1259/************************************************************************/
1262static bool xsize_callback(int value, struct connection *caller,
1263 char *reject_msg, size_t reject_msg_len)
1264{
1265 int size = value * wld.map.ysize;
1266
1267 if (size < MAP_MIN_SIZE * 1000) {
1269 _("The map size (%d * %d = %d) must be larger than "
1270 "%d tiles."), value, wld.map.ysize, size,
1271 MAP_MIN_SIZE * 1000);
1272 return FALSE;
1273 } else if (size > MAP_MAX_SIZE * 1000) {
1275 _("The map size (%d * %d = %d) must be lower than "
1276 "%d tiles."), value, wld.map.ysize, size,
1277 MAP_MAX_SIZE * 1000);
1278 return FALSE;
1279 }
1280
1281 return TRUE;
1282}
1283
1284/************************************************************************/
1287static bool ysize_callback(int value, struct connection *caller,
1288 char *reject_msg, size_t reject_msg_len)
1289{
1290 int size = wld.map.xsize * value;
1291
1292 if (size < MAP_MIN_SIZE * 1000) {
1294 _("The map size (%d * %d = %d) must be larger than "
1295 "%d tiles."), wld.map.xsize, value, size,
1296 MAP_MIN_SIZE * 1000);
1297 return FALSE;
1298 } else if (size > MAP_MAX_SIZE * 1000) {
1300 _("The map size (%d * %d = %d) must be lower than "
1301 "%d tiles."), wld.map.xsize, value, size,
1302 MAP_MAX_SIZE * 1000);
1303 return FALSE;
1305 && value % 2 != 0) {
1306 /* An isometric map needs a even ysize. It is calculated automatically
1307 * for all settings but mapsize=XYSIZE. */
1309 _("For an isometric or hexagonal map the ysize must be "
1310 "even."));
1311 return FALSE;
1312 }
1313
1314 return TRUE;
1315}
1316
1317/************************************************************************/
1320static bool topology_callback(unsigned value, struct connection *caller,
1321 char *reject_msg, size_t reject_msg_len)
1322{
1324 && ((value & (TF_ISO)) != 0 || (value & (TF_HEX)) != 0)
1325 && wld.map.ysize % 2 != 0) {
1326 /* An isometric map needs a even ysize. It is calculated automatically
1327 * for all settings but mapsize=XYSIZE. */
1329 _("For an isometric or hexagonal map the ysize must be "
1330 "even."));
1331 return FALSE;
1332 }
1333
1334#ifdef FREECIV_WEB
1335 /* Remember to update the help text too if Freeciv-web gets the ability
1336 * to display other map topologies. */
1337
1338 /* Are you removing this because Freeciv-web gained the ability to
1339 * display isometric maps? Why don't you remove the Freeciv-web
1340 * specific MAP_DEFAULT_TOPO too? */
1341 if ((value & (TF_ISO)) != 0
1342 || (value & (TF_HEX)) != 0) {
1343 /* The Freeciv-web client can't display these topologies yet. */
1345 _("Freeciv-web doesn't support this topology."));
1346 return FALSE;
1347 }
1348#endif /* FREECIV_WEB */
1349
1350 return TRUE;
1351}
1352
1353/************************************************************************/
1356static bool aitype_callback(const char *value, struct connection *caller,
1357 char *reject_msg, size_t reject_msg_len)
1358{
1359 if (ai_type_by_name(value) == NULL) {
1361 _("No such AI type loaded."));
1362
1363 return FALSE;
1364 }
1365
1366 return TRUE;
1367}
1368
1369/************************************************************************/
1372static bool wrap_callback(unsigned value, struct connection *caller,
1373 char *reject_msg, size_t reject_msg_len)
1374{
1375#ifdef FREECIV_WEB
1376 /* Remember to update the help text too if Freeciv-web gets the ability
1377 * to display other map wraps. */
1378 if ((value & (WRAP_Y)) != 0) {
1379 /* The Freeciv-web client can't display wraps mapped this way. */
1381 _("Freeciv-web doesn't support this map wrap."));
1382 return FALSE;
1383 }
1384#endif /* FREECIV_WEB */
1385
1386 return TRUE;
1387}
1388
1389/************************************************************************/
1392static bool plrcol_validate(int value, struct connection *caller,
1393 char *reject_msg, size_t reject_msg_len)
1394{
1395 enum plrcolor_mode mode = value;
1396 if (mode == PLRCOL_NATION_ORDER) {
1397 nations_iterate(pnation) {
1398 if (nation_color(pnation)) {
1399 /* At least one nation has a color. Allow this mode. */
1400 return TRUE;
1401 }
1404 _("No nations in the currently loaded ruleset have "
1405 "associated colors."));
1406 return FALSE;
1407 }
1408 return TRUE;
1409}
1410
1411#define GEN_BOOL(name, value, sclass, scateg, slevel, al_read, al_write, \
1412 short_help, extra_help, func_validate, func_action, \
1413 _default) \
1414 {name, sclass, al_read, al_write, short_help, extra_help, NULL, SST_BOOL, \
1415 scateg, slevel, \
1416 INIT_BRACE_BEGIN \
1417 .boolean = {&value, _default, func_validate, bool_name, \
1418 FALSE} INIT_BRACE_END , func_action, FALSE, .ruleset_settable = TRUE},
1419
1420#define GEN_INT(name, value, sclass, scateg, slevel, al_read, al_write, \
1421 short_help, extra_help, func_help, \
1422 func_validate, func_action, \
1423 _min, _max, _default) \
1424 {name, sclass, al_read, al_write, short_help, extra_help, func_help, \
1425 SST_INT, scateg, slevel, \
1426 INIT_BRACE_BEGIN \
1427 .integer = {(int *) &value, _default, _min, _max, func_validate, \
1428 0} INIT_BRACE_END, \
1429 func_action, FALSE, .ruleset_settable = TRUE},
1430
1431#define GEN_STRING(name, value, sclass, scateg, slevel, al_read, al_write, \
1432 short_help, extra_help, func_validate, func_action, \
1433 _default) \
1434 {name, sclass, al_read, al_write, short_help, extra_help, NULL, \
1435 SST_STRING, scateg, slevel, \
1436 INIT_BRACE_BEGIN \
1437 .string = {value, _default, sizeof(value), func_validate, ""} \
1438 INIT_BRACE_END, \
1439 func_action, FALSE, .ruleset_settable = TRUE},
1440
1441#define GEN_STRING_NRS(name, value, sclass, scateg, slevel, al_read, al_write, \
1442 short_help, extra_help, func_validate, func_action, \
1443 _default) \
1444 {name, sclass, al_read, al_write, short_help, extra_help, NULL, \
1445 SST_STRING, scateg, slevel, \
1446 INIT_BRACE_BEGIN \
1447 .string = {value, _default, sizeof(value), func_validate, ""} \
1448 INIT_BRACE_END, \
1449 func_action, FALSE, .ruleset_settable = FALSE},
1450
1451#define GEN_ENUM(name, value, sclass, scateg, slevel, al_read, al_write, \
1452 short_help, extra_help, func_help, func_validate, \
1453 func_action, func_name, _default) \
1454 { name, sclass, al_read, al_write, short_help, extra_help, func_help, \
1455 SST_ENUM, scateg, slevel, \
1456 INIT_BRACE_BEGIN \
1457 .enumerator = { &value, sizeof(value), _default, \
1458 func_validate, \
1459 (val_name_func_t) func_name, 0 } INIT_BRACE_END, \
1460 func_action, FALSE, .ruleset_settable = TRUE},
1461
1462#define GEN_BITWISE(name, value, sclass, scateg, slevel, al_read, al_write, \
1463 short_help, extra_help, func_validate, func_action, \
1464 func_name, _default) \
1465 { name, sclass, al_read, al_write, short_help, extra_help, NULL, \
1466 SST_BITWISE, scateg, slevel, \
1467 INIT_BRACE_BEGIN \
1468 .bitwise = { (unsigned *) (void *) &value, _default, func_validate, \
1469 func_name, 0 } INIT_BRACE_END, \
1470 func_action, FALSE, .ruleset_settable = TRUE},
1471
1472/* game settings */
1473static struct setting settings[] = {
1474
1475 /* These should be grouped by sclass */
1476
1477 /* Map size parameters: adjustable if we don't yet have a map */
1480 N_("Map size definition"),
1481 /* TRANS: The strings between double quotes are also translated
1482 * separately (they must match!). The strings between single
1483 * quotes are setting names and shouldn't be translated. The
1484 * strings between parentheses and in uppercase must stay as
1485 * untranslated. */
1486 N_("Chooses the method used to define the map size. Other options "
1487 "specify the parameters for each method.\n"
1488 "- \"Number of tiles\" (FULLSIZE): Map area (option 'size').\n"
1489 "- \"Tiles per player\" (PLAYER): Number of (land) tiles per "
1490 "player (option 'tilesperplayer').\n"
1491 "- \"Width and height\" (XYSIZE): Map width and height in "
1492 "tiles (options 'xsize' and 'ysize')."), NULL,
1494
1497 N_("Map area (in thousands of tiles)"),
1498 /* TRANS: The strings between double quotes are also translated
1499 * separately (they must match!). The strings between single
1500 * quotes are setting names and shouldn't be translated. The
1501 * strings between parentheses and in uppercase must stay as
1502 * untranslated. */
1503 N_("This value is used to determine the map area.\n"
1504 " size = 4 is a normal map of 4,000 tiles (default)\n"
1505 " size = 20 is a huge map of 20,000 tiles\n"
1506 "For this option to take effect, the \"Map size definition\" "
1507 "option ('mapsize') must be set to \"Number of tiles\" "
1508 "(FULLSIZE)."), NULL, NULL, NULL,
1510
1511 GEN_INT("tilesperplayer", wld.map.server.tilesperplayer, SSET_MAP_SIZE,
1513 N_("Number of (land) tiles per player"),
1514 /* TRANS: The strings between double quotes are also translated
1515 * separately (they must match!). The strings between single
1516 * quotes are setting names and shouldn't be translated. The
1517 * strings between parentheses and in uppercase must stay as
1518 * untranslated. */
1519 N_("This value is used to determine the map dimensions. It "
1520 "calculates the map size at game start based on the number "
1521 "of players and the value of the setting 'landmass'.\n"
1522 "For this option to take effect, the \"Map size definition\" "
1523 "option ('mapsize') must be set to \"Tiles per player\" "
1524 "(PLAYER)."),
1527
1528 GEN_INT("xsize", wld.map.xsize, SSET_MAP_SIZE,
1530 N_("Map width in tiles"),
1531 /* TRANS: The strings between double quotes are also translated
1532 * separately (they must match!). The strings between single
1533 * quotes are setting names and shouldn't be translated. The
1534 * strings between parentheses and in uppercase must stay as
1535 * untranslated. */
1536 N_("Defines the map width.\n"
1537 "For this option to take effect, the \"Map size definition\" "
1538 "option ('mapsize') must be set to \"Width and height\" "
1539 "(XYSIZE)."),
1542 GEN_INT("ysize", wld.map.ysize, SSET_MAP_SIZE,
1544 N_("Map height in tiles"),
1545 /* TRANS: The strings between double quotes are also translated
1546 * separately (they must match!). The strings between single
1547 * quotes are setting names and shouldn't be translated. The
1548 * strings between parentheses and in uppercase must stay as
1549 * untranslated. */
1550 N_("Defines the map height.\n"
1551 "For this option to take effect, the \"Map size definition\" "
1552 "option ('mapsize') must be set to \"Width and height\" "
1553 "(XYSIZE)."),
1556
1559 N_("Map topology"),
1561 /* TRANS: Freeciv-web version of the help text. */
1562 N_("Freeciv-web maps are always two-dimensional.\n"),
1563#else /* FREECIV_WEB */
1564 /* TRANS: do not edit the ugly ASCII art */
1565 N_("Freeciv maps are always two-dimensional. "
1566 "Individual tiles may "
1567 "be rectangular or hexagonal, with either an overhead "
1568 "(\"classic\") or isometric alignment.\n"
1569 "To play with a particular topology, clients will need a "
1570 "matching tileset.\n"
1571 "Overhead rectangular: Isometric rectangular:\n"
1572 " _________ /\\/\\/\\/\\/\\\n"
1573 " |_|_|_|_|_| /\\/\\/\\/\\/\\/\n"
1574 " |_|_|_|_|_| \\/\\/\\/\\/\\/\\\n"
1575 " |_|_|_|_|_| /\\/\\/\\/\\/\\/\n"
1576 " \\/\\/\\/\\/\\/\n"
1577 "Hex: Iso-hex:\n"
1578 " /\\/\\/\\/\\/\\/\\ _ _ _ _ _\n"
1579 " | | | | | | | / \\_/ \\_/ \\_/ \\_/ \\\n"
1580 " \\/\\/\\/\\/\\/\\/\\"
1581 " \\_/ \\_/ \\_/ \\_/ \\_/\n"
1582 " | | | | | | | / \\_/ \\_/ \\_/ \\_/ \\\n"
1583 " \\/\\/\\/\\/\\/\\/"
1584 " \\_/ \\_/ \\_/ \\_/ \\_/\n"),
1585#endif /* FREECIV_WEB */
1587
1590 N_("Map wrap"),
1592 /* TRANS: Freeciv-web version of the help text. */
1593 N_("Freeciv-web maps may wrap "
1594 "at the east-west directions to form a flat map or a "
1595 "cylinder.\n"),
1596#else /* FREECIV_WEB */
1597 /* TRANS: do not edit the ugly ASCII art */
1598 N_("Freeciv maps may wrap at "
1599 "the north-south and east-west directions to form a flat "
1600 "map, a cylinder, or a torus (donut)."),
1601#endif /* FREECIV_WEB */
1603
1604 GEN_ENUM("generator", wld.map.server.generator,
1606 N_("Method used to generate map"),
1607 /* TRANS: The strings between double quotes are also translated
1608 * separately (they must match!). The strings between single
1609 * quotes (except 'fair') are setting names and shouldn't be
1610 * translated. The strings between parentheses and in uppercase
1611 * must stay as untranslated. */
1612 N_("Specifies the algorithm used to generate the map. If the "
1613 "default value of the 'startpos' option is used, then the "
1614 "chosen generator chooses an appropriate 'startpos' setting; "
1615 "otherwise, the generated map tries to accommodate the "
1616 "chosen 'startpos' setting.\n"
1617 "- \"Scenario map\" (SCENARIO): indicates a pre-generated map. "
1618 "By default, if the scenario does not specify start positions, "
1619 "they will be allocated depending on the size of continents.\n"
1620 "- \"Fully random height\" (RANDOM): generates maps with a "
1621 "number of equally spaced, relatively small islands. By default, "
1622 "start positions are allocated depending on continent size.\n"
1623 "- \"Pseudo-fractal height\" (FRACTAL): generates Earthlike "
1624 "worlds with one or more large continents and a scattering of "
1625 "smaller islands. By default, players are all placed on a "
1626 "single continent.\n"
1627 "- \"Island-based\" (ISLAND): generates 'fair' maps with a "
1628 "number of similarly-sized and -shaped islands, each with "
1629 "approximately the same ratios of terrain types. By default, "
1630 "each player gets their own island.\n"
1631 "- \"Fair islands\" (FAIR): generates the exact copy of the "
1632 "same island for every player or every team.\n"
1633 "- \"Fracture map\" (FRACTURE): generates maps from a fracture "
1634 "pattern. Tends to place hills and mountains along the edges "
1635 "of the continents.\n"
1636 "If the requested generator is incompatible with other server "
1637 "settings, the server may fall back to another generator."),
1639
1640 GEN_ENUM("startpos", wld.map.server.startpos,
1642 N_("Method used to choose start positions"),
1643 /* TRANS: The strings between double quotes are also translated
1644 * separately (they must match!). The strings between single
1645 * quotes (except 'best') are setting names and shouldn't be
1646 * translated. The strings between parentheses and in uppercase
1647 * must stay as untranslated. */
1648 N_("The method used to choose where each player's initial units "
1649 "start on the map. (For scenarios which include pre-set "
1650 "start positions, this setting is ignored.)\n"
1651 "- \"Generator's choice\" (DEFAULT): the start position "
1652 "placement will depend on the map generator chosen. See the "
1653 "'generator' setting.\n"
1654 "- \"One player per continent\" (SINGLE): one player is "
1655 "placed on each of a set of continents of approximately "
1656 "equivalent value (if possible).\n"
1657 "- \"Two or three players per continent\" (2or3): similar "
1658 "to SINGLE except that two players will be placed on each "
1659 "continent, with three on the 'best' continent if there is an "
1660 "odd number of players.\n"
1661 "- \"All players on a single continent\" (ALL): all players "
1662 "will start on the 'best' available continent.\n"
1663 "- \"Depending on size of continents\" (VARIABLE): players "
1664 "will be placed on the 'best' available continents such that, "
1665 "as far as possible, the number of players on each continent "
1666 "is proportional to its value.\n"
1667 "If the server cannot satisfy the requested setting due to "
1668 "there being too many players for continents, it may fall "
1669 "back to one of the others. (However, map generators try to "
1670 "create the right number of continents for the choice of this "
1671 "'startpos' setting and the number of players, so this is "
1672 "unlikely to occur.)"),
1674
1675 GEN_ENUM("teamplacement", wld.map.server.team_placement,
1677 N_("Method used for placement of team mates"),
1678 /* TRANS: The strings between double quotes are also translated
1679 * separately (they must match!). The strings between single
1680 * quotes are setting names and shouldn't be translated. The
1681 * strings between parentheses and in uppercase must stay as
1682 * untranslated. */
1683 N_("After start positions have been generated thanks to the "
1684 "'startpos' setting, this setting controls how the start "
1685 "positions will be assigned to the different players of the "
1686 "same team.\n"
1687 "- \"Disabled\" (DISABLED): the start positions will be "
1688 "randomly assigned to players, regardless of teams.\n"
1689 "- \"As close as possible\" (CLOSEST): players will be "
1690 "placed as close as possible, regardless of continents.\n"
1691 "- \"On the same continent\" (CONTINENT): if possible, place "
1692 "all players of the same team onto the same "
1693 "island/continent.\n"
1694 "- \"Horizontal placement\" (HORIZONTAL): players of the same "
1695 "team will be placed horizontally.\n"
1696 "- \"Vertical placement\" (VERTICAL): players of the same "
1697 "team will be placed vertically."),
1699
1700 GEN_BOOL("tinyisles", wld.map.server.tinyisles,
1702 N_("Presence of 1x1 islands"),
1703 N_("This setting controls whether the map generator is allowed "
1704 "to make islands of one only tile size."), NULL, NULL,
1706
1707 GEN_BOOL("separatepoles", wld.map.server.separatepoles,
1710 N_("Whether the poles are separate continents"),
1711 N_("If this setting is disabled, the continents may attach to "
1713
1714 GEN_INT("flatpoles", wld.map.server.flatpoles,
1716 N_("How much the land at the poles is flattened"),
1717 /* TRANS: The strings in quotes shouldn't be translated. */
1718 N_("Controls how much the height of the poles is flattened "
1719 "during map generation, preventing a diversity of land "
1720 "terrain there. 0 is no flattening, 100 is maximum "
1721 "flattening. Only affects the 'RANDOM' and 'FRACTAL' "
1722 "map generators."), NULL,
1723 NULL, NULL,
1725
1726 GEN_INT("northlatitude", wld.map.north_latitude,
1729 N_("Northernmost latitude"),
1730 /* TRANS: The string between single quotes is a setting name
1731 * and should not be translated. */
1732 N_("Combined with 'southlatitude', controls what climatic "
1733 "zones exist on the map. Higher values are further north, "
1734 "lower values are further south.\n"
1735 "\n"
1736 "1000 and -1000 gives a full planetary map.\n"
1737 "1000 and 0 gives only a northern hemisphere.\n"
1738 " 500 and 500 gives a map with the same middle-latitude "
1739 "climate everywhere.\n"
1740 " 300 and -300 gives an equatorial map.\n"
1741 "\n"
1742 "In rulesets that support it, latitude may also have certain "
1743 "effects during gameplay."), NULL,
1744 NULL, NULL,
1747 GEN_INT("southlatitude", wld.map.south_latitude,
1750 N_("Southernmost latitude"),
1751 /* TRANS: The string between single quotes is a setting name
1752 * and should not be translated. */
1753 N_("Combined with 'northlatitude', controls what climatic "
1754 "zones exist on the map. Higher values are further north, "
1755 "lower values are further south.\n"
1756 "\n"
1757 "1000 and -1000 gives a full planetary map.\n"
1758 "1000 and 0 gives only a northern hemisphere.\n"
1759 " 500 and 500 gives a map with the same middle-latitude "
1760 "climate everywhere.\n"
1761 " 300 and -300 gives an equatorial map.\n"
1762 "\n"
1763 "In rulesets that support it, latitude may also have certain "
1764 "effects during gameplay."), NULL,
1765 NULL, NULL,
1768
1769 GEN_INT("temperature", wld.map.server.temperature,
1772 N_("Average temperature of the planet"),
1773 N_("Small values will give a cold map, while larger values will "
1774 "give a hotter map.\n"
1775 "\n"
1776 "100 means a very dry and hot planet with no polar arctic "
1777 "zones, only tropical and dry zones.\n"
1778 " 70 means a hot planet with little polar ice.\n"
1779 " 50 means a temperate planet with normal polar, cold, "
1780 "temperate, and tropical zones; a desert zone overlaps "
1781 "tropical and temperate zones.\n"
1782 " 30 means a cold planet with small tropical zones.\n"
1783 " 0 means a very cold planet with large polar zones and no "
1784 "tropics."),
1785 NULL, NULL, NULL,
1787
1788 GEN_INT("landmass", wld.map.server.landpercent,
1791 N_("Percentage of the map that is land"),
1792 N_("This setting gives the approximate percentage of the map "
1793 "that will be made into land."), NULL, NULL, NULL,
1795
1796 GEN_INT("steepness", wld.map.server.steepness,
1799 N_("Amount of hills/mountains"),
1800 N_("Small values give flat maps, while higher values give a "
1801 "steeper map with more hills and mountains."),
1802 NULL, NULL, NULL,
1804
1805 GEN_INT("wetness", wld.map.server.wetness,
1808 N_("Amount of water on landmasses"),
1809 N_("Small values mean lots of dry, desert-like land; "
1810 "higher values give a wetter map with more swamps, "
1811 "jungles, and rivers."), NULL, NULL, NULL,
1813
1814 GEN_BOOL("globalwarming", game.info.global_warming,
1816 N_("Global warming"),
1817 N_("If turned off, global warming will not occur "
1818 "as a result of pollution. This setting does not "
1819 "affect pollution."), NULL, NULL,
1821
1822 GEN_INT("globalwarming_percent", game.server.global_warming_percent,
1824 N_("Global warming percent"),
1825 N_("This is a multiplier for the rate of accumulation of global "
1826 "warming."), NULL, NULL, NULL,
1830
1831 GEN_BOOL("nuclearwinter", game.info.nuclear_winter,
1833 N_("Nuclear winter"),
1834 N_("If turned off, nuclear winter will not occur "
1835 "as a result of nuclear war."), NULL, NULL,
1837
1838 GEN_INT("nuclearwinter_percent", game.server.nuclear_winter_percent,
1840 N_("Nuclear winter percent"),
1841 N_("This is a multiplier for the rate of accumulation of nuclear "
1842 "winter."), NULL, NULL, NULL,
1846
1847 GEN_INT("mapseed", wld.map.server.seed_setting,
1851#else /* FREECIV_WEB */
1853#endif /* FREECIV_WEB */
1854 N_("Map generation random seed"),
1855 N_("The same seed will always produce the same map; "
1856 "for zero (the default) a seed will be generated randomly, "
1857 "based on gameseed. If also gameseed is zero, "
1858 "the map will be completely random."),
1859 NULL, NULL, NULL,
1861
1862 /* Map additional stuff: huts and specials. gameseed also goes here
1863 * because huts and specials are the first time the gameseed gets used (?)
1864 * These are done when the game starts, so these are historical and
1865 * fixed after the game has started.
1866 */
1867 GEN_INT("gameseed", game.server.seed_setting,
1871#else /* FREECIV_WEB */
1873#endif /* FREECIV_WEB */
1874 N_("Game random seed"),
1875 N_("For zero (the default) a seed will be chosen based "
1876 "on system entropy or, failing that, the current time."),
1877 NULL, NULL, NULL,
1879
1880 GEN_INT("specials", wld.map.server.riches,
1882 N_("Amount of \"special\" resource tiles"),
1883 N_("Special resources improve the basic terrain type they "
1884 "are on. The server variable's scale is parts per "
1885 "thousand."), NULL, NULL, NULL,
1887
1888 GEN_INT("huts", wld.map.server.huts,
1890 N_("Amount of huts (bonus extras)"),
1891 N_("Huts are tile extras that usually may be investigated by "
1892 "units. "
1893 "The server variable's scale is huts per thousand tiles."),
1896
1897 GEN_INT("animals", wld.map.server.animals,
1899 N_("Amount of animals"),
1900 N_("Number of animals initially created on terrains "
1901 "defined for them in the ruleset (if the ruleset supports it). "
1902 "The server variable's scale is animals per "
1903 "thousand tiles."), NULL, NULL, NULL,
1905
1906 /* Options affecting numbers of players and AI players. These only
1907 * affect the start of the game and can not be adjusted after that.
1908 */
1909 GEN_INT("minplayers", game.server.min_players,
1912 N_("Minimum number of players"),
1913 N_("There must be at least this many players (connected "
1914 "human players) before the game can start."),
1915 NULL, NULL, NULL,
1917
1918 GEN_INT("maxplayers", game.server.max_players,
1920 N_("Maximum number of players"),
1921 N_("The maximal number of human and AI players who can be in "
1922 "the game. When this number of players are connected in "
1923 "the pregame state, any new players who try to connect "
1924 "will be rejected.\n"
1925 "When playing a scenario which defines player start positions, "
1926 "this setting cannot be set to greater than the number of "
1927 "defined start positions."),
1930
1931 GEN_INT("aifill", game.info.aifill,
1933 N_("Limited number of AI players"),
1934 N_("If set to a positive value, then AI players will be "
1935 "automatically created or removed to keep the total "
1936 "number of players at this amount. As more players join, "
1937 "these AI players will be replaced. When set to zero, "
1938 "all AI players will be removed."),
1941
1942 GEN_ENUM("persistentready", game.info.persistent_ready,
1944 N_("When the Readiness of a player gets autotoggled off"),
1945 N_("In pre-game, usually when new players join or old ones leave, "
1946 "those who have already accepted game to start by toggling \"Ready\" "
1947 "get that autotoggled off in the changed situation. This setting "
1948 "can be used to make readiness more persistent."),
1950
1951 GEN_STRING("nationset", game.server.nationset,
1954 N_("Set of nations to choose from"),
1955 /* TRANS: do not translate '/list nationsets' */
1956 N_("Controls the set of nations allowed in the game. The "
1957 "choices are defined by the ruleset.\n"
1958 "Only nations in the set selected here will be allowed in "
1959 "any circumstances, including new players and civil war; "
1960 "small sets may thus limit the number of players in a game.\n"
1961 "If this is left blank, the ruleset's default nation set is "
1962 "used.\n"
1963 "See '/list nationsets' for possible choices for the "
1964 "currently loaded ruleset."),
1966
1967 GEN_INT("ec_turns", game.server.event_cache.turns,
1970 N_("Event cache for this number of turns"),
1971 N_("Event messages are saved for this number of turns. A value of "
1972 "0 deactivates the event cache."),
1975
1976 GEN_INT("ec_max_size", game.server.event_cache.max_size,
1979 N_("Size of the event cache"),
1980 N_("This defines the maximal number of events in the event cache."),
1983
1984 GEN_BOOL("ec_chat", game.server.event_cache.chat,
1987 N_("Save chat messages in the event cache"),
1988 N_("If turned on, chat messages will be saved in the event "
1990
1991 GEN_BOOL("ec_info", game.server.event_cache.info,
1994 N_("Print turn and time for each cached event"),
1995 /* TRANS: Don't translate the text between single quotes. */
1996 N_("If turned on, all cached events will be marked by the turn "
1997 "and time of the event like '(T2 - 15:29:52)'."),
1999
2000 /* Game initialization parameters (only affect the first start of the game,
2001 * and not reloads). Can not be changed after first start of game.
2002 */
2003 GEN_STRING("startunits", game.server.start_units,
2006 N_("List of players' initial units"),
2007 N_("This should be a string of characters, each of which "
2008 "specifies a unit role. The first character must be native to "
2009 "at least one \"Starter\" terrain. The characters and their "
2010 "meanings are:\n"
2011 " c = City founder (eg., Settlers)\n"
2012 " w = Terrain worker (eg., Engineers)\n"
2013 " x = Explorer (eg., Explorer)\n"
2014 " k = Gameloss (eg., King)\n"
2015 " s = Diplomat (eg., Diplomat)\n"
2016 " f = Ferryboat (eg., Trireme)\n"
2017 " d = Ok defense unit (eg., Warriors)\n"
2018 " D = Good defense unit (eg., Phalanx)\n"
2019 " a = Fast attack unit (eg., Horsemen)\n"
2020 " A = Strong attack unit (eg., Catapult)\n"),
2022
2023 GEN_BOOL("startcity", game.server.start_city,
2026 N_("Whether player starts with a city"),
2027 N_("If this is set, game will start with player's first "
2028 "city already founded to starting location."),
2030
2031 GEN_INT("dispersion", game.server.dispersion,
2034 N_("Area where initial units are located"),
2035 N_("This is the radius within "
2036 "which the initial units are dispersed."),
2037 NULL, NULL, NULL,
2039
2040 GEN_INT("gold", game.info.gold,
2043 N_("Starting gold per player"),
2044 N_("At the beginning of the game, each player is given this "
2045 "much gold."), NULL, NULL, NULL,
2047
2048 GEN_INT("infrapoints", game.info.infrapoints,
2051 N_("Starting infrapoints per player"),
2052 N_("At the beginning of the game, each player is given this "
2053 "many infrapoints."), NULL, NULL, NULL,
2055
2056 GEN_INT("techlevel", game.info.tech,
2059 N_("Number of initial techs per player"),
2060 /* TRANS: The string between single quotes is a setting name and
2061 * should not be translated. */
2062 N_("At the beginning of the game, each player is given this "
2063 "many technologies. The technologies chosen are random for "
2064 "each player. Depending on the value of tech_cost_style in "
2065 "the ruleset, a big value for 'techlevel' can make the next "
2066 "techs really expensive."), NULL, NULL, NULL,
2068
2069 GEN_INT("sciencebox", game.info.sciencebox,
2072 N_("Technology cost multiplier percentage"),
2073 N_("This affects how quickly players can research new "
2074 "technology. All tech costs are multiplied by this amount "
2075 "(as a percentage). The base tech costs are determined by "
2076 "the ruleset or other game settings."),
2079
2080 GEN_BOOL("multiresearch", game.server.multiresearch,
2082 N_("Allow researching multiple technologies"),
2083 N_("Allows switching to any technology without wasting old "
2084 "research. Bulbs are never transferred to new technology. "
2085 "Techpenalty options are ineffective after enabling that "
2086 "option."), NULL, NULL,
2088
2089 GEN_INT("techpenalty", game.server.techpenalty,
2091 N_("Percentage penalty when changing tech"),
2092 N_("If you change your current research technology, and you have "
2093 "positive research points, you lose this percentage of those "
2094 "research points. This does not apply when you have just gained "
2095 "a technology this turn."), NULL, NULL, NULL,
2098
2099 GEN_INT("techlost_recv", game.server.techlost_recv,
2101 N_("Chance to lose a technology while receiving it"),
2102 N_("The chance that learning a technology by treaty or theft "
2103 "will fail."),
2106
2107 GEN_INT("techlost_donor", game.server.techlost_donor,
2109 N_("Chance to lose a technology while giving it"),
2110 N_("The chance that your civilization will lose a technology if "
2111 "you teach it to someone else by treaty, or if it is stolen "
2112 "from you."),
2115
2116 GEN_INT("techleak", game.info.tech_leak_pct,
2118 N_("Tech leakage percent"),
2119 N_("The rate of the tech leakage. This multiplied by the "
2120 "percentage of players who know the tech tell which "
2121 "percentage of tech's bulb cost gets leaked each turn. "
2122 "This setting has no effect if the ruleset has disabled "
2123 "tech leakage."),
2126
2127 GEN_BOOL("team_pooled_research", game.info.team_pooled_research,
2129 N_("Team pooled research"),
2130 N_("If this setting is turned on, then the team mates will share "
2131 "the science research. Else, every player of the team will "
2132 "have to make its own."),
2134
2135 GEN_INT("diplbulbcost", game.server.diplbulbcost,
2137 N_("Penalty when getting tech from treaty"),
2138 N_("For each technology you gain from a diplomatic treaty, you "
2139 "lose research points equal to this percentage of the cost to "
2140 "research a new technology. If this is non-zero, you can end up "
2141 "with negative research points."),
2142 NULL, NULL, NULL,
2144
2145 GEN_INT("diplgoldcost", game.server.diplgoldcost,
2147 N_("Penalty when getting gold from treaty"),
2148 N_("When transferring gold in diplomatic treaties, this percentage "
2149 "of the agreed sum is lost to both parties; it is deducted from "
2150 "the donor but not received by the recipient."),
2151 NULL, NULL, NULL,
2153
2154 GEN_INT("incite_gold_loss_chance", game.server.incite_gold_loss_chance,
2156 N_("Probability of gold loss during inciting revolt"),
2157 N_("When unit trying to incite revolt is eliminated, half of the gold "
2158 "(or quarter, if unit was caught), prepared to bribe citizens, "
2159 "can be lost or captured by enemy."),
2160 NULL, NULL, NULL,
2163
2164 GEN_INT("incite_gold_capt_chance", game.server.incite_gold_capt_chance,
2166 N_("Probability of gold capture during inciting revolt"),
2167 N_("When unit trying to incite revolt is eliminated and lose its "
2168 "gold, there is chance that this gold would be captured by "
2169 "city defender. Transfer tax would be applied, though. "
2170 "This setting is irrevelant, if incite_gold_loss_chance is zero."),
2171 NULL, NULL, NULL,
2174
2175 GEN_INT("conquercost", game.server.conquercost,
2177 N_("Penalty when getting tech from conquering"),
2178 N_("For each technology you gain by conquering an enemy city, you "
2179 "lose research points equal to this percentage of the cost to "
2180 "research a new technology. If this is non-zero, you can end up "
2181 "with negative research points."),
2182 NULL, NULL, NULL,
2185
2186 GEN_INT("freecost", game.server.freecost,
2188 N_("Penalty when getting a free tech"),
2189 /* TRANS: The strings between single quotes are setting names and
2190 * shouldn't be translated. */
2191 N_("For each technology you gain \"for free\" (other than "
2192 "covered by 'diplcost' or 'conquercost': for instance, from huts "
2193 "or from Great Library effects), you lose research points "
2194 "equal to this percentage of the cost to research a new "
2195 "technology. If this is non-zero, you can end up "
2196 "with negative research points."),
2197 NULL, NULL, NULL,
2199
2200 GEN_INT("techlossforgiveness", game.info.techloss_forgiveness,
2202 N_("Research point debt threshold for losing tech"),
2203 N_("When you have negative research points, and your shortfall is "
2204 "greater than this percentage of the cost of your current "
2205 "research, you forget a technology you already knew.\n"
2206 "The special value -1 prevents loss of technology regardless of "
2207 "research points."),
2208 NULL, NULL, NULL,
2211
2212 GEN_INT("techlossrestore", game.server.techloss_restore,
2214 N_("Research points restored after losing a tech"),
2215 N_("When you lose a technology due to a negative research balance "
2216 "(see 'techlossforgiveness'), this percentage of its research "
2217 "cost is credited to your research balance (this may not be "
2218 "sufficient to make it positive).\n"
2219 "The special value -1 means that your research balance is always "
2220 "restored to zero, regardless of your previous shortfall."),
2221 NULL, NULL, NULL,
2224
2225 GEN_INT("foodbox", game.info.foodbox,
2228 N_("Food required for a city to grow"),
2229 N_("This is the base amount of food required to grow a city. "
2230 "This value is multiplied by another factor that comes from "
2231 "the ruleset and is dependent on the size of the city."),
2232 NULL, NULL, NULL,
2234
2235 GEN_INT("aqueductloss", game.server.aqueductloss,
2237 N_("Percentage food lost when city can't grow"),
2238 N_("If a city would expand, but it can't because it lacks some "
2239 "prerequisite (traditionally an Aqueduct or Sewer System), "
2240 "this is the base percentage of its foodbox that is lost "
2241 "each turn; the penalty may be reduced by buildings or other "
2242 "circumstances, depending on the ruleset."),
2243 NULL, NULL, NULL,
2246
2247 GEN_INT("shieldbox", game.info.shieldbox,
2250 N_("Multiplier percentage for production costs"),
2251 N_("This affects how quickly units and buildings can be "
2252 "produced. The base costs are multiplied by this value (as "
2253 "a percentage)."),
2254 NULL, NULL, NULL,
2256
2257 /* Notradesize and fulltradesize used to have callbacks to prevent them
2258 * from being set illegally (notradesize > fulltradesize). However this
2259 * provided a problem when setting them both through the client's settings
2260 * dialog, since they cannot both be set atomically. So the callbacks were
2261 * removed and instead the game now knows how to deal with invalid
2262 * settings. */
2263 GEN_INT("fulltradesize", game.info.fulltradesize,
2265 N_("Minimum city size to get full trade"),
2266 /* TRANS: The strings between single quotes are setting names and
2267 * shouldn't be translated. */
2268 N_("There is a trade penalty in all cities smaller than this. "
2269 "The penalty is 100% (no trade at all) for sizes up to "
2270 "'notradesize', and decreases gradually to 0% (no penalty "
2271 "except the normal corruption) for size='fulltradesize'. "
2272 "See also 'notradesize'."), NULL, NULL, NULL,
2275
2276 GEN_INT("notradesize", game.info.notradesize,
2278 N_("Maximum size of a city without trade"),
2279 /* TRANS: The strings between single quotes are setting names and
2280 * shouldn't be translated. */
2281 N_("Cities do not produce any trade at all unless their size "
2282 "is larger than this amount. The produced trade increases "
2283 "gradually for cities larger than 'notradesize' and smaller "
2284 "than 'fulltradesize'. See also 'fulltradesize'."),
2285 NULL, NULL, NULL,
2288
2289 GEN_INT("tradeworldrelpct", game.info.trade_world_rel_pct,
2291 N_("How largely trade distance is relative to world size"),
2292 /* TRANS: The strings between single quotes are setting names and
2293 * shouldn't be translated. */
2294 N_("When determining trade between cities, the distance factor "
2295 "can be partly or fully relative to world size. This setting "
2296 "determines how big percentage of the bonus calculation is "
2297 "relative to world size, and how much only absolute distance "
2298 "matters."),
2299 NULL, NULL, NULL,
2302
2303 GEN_INT("citymindist", game.info.citymindist,
2306 N_("Minimum distance between cities"),
2307 N_("When a player attempts to found a new city, it is prevented "
2308 "if the distance from any existing city is less than this "
2309 "setting. For example, when this setting is 3, there must be "
2310 "at least two clear tiles in any direction between all existing "
2311 "cities and the new city site. A value of 1 removes any such "
2312 "restriction on city placement."),
2313 NULL, NULL, NULL,
2316
2317 GEN_BOOL("trading_tech", game.info.trading_tech,
2319 N_("Technology trading"),
2320 N_("If turned off, trading technologies in the diplomacy dialog "
2321 "is not allowed."), NULL, NULL,
2323
2324 GEN_BOOL("trading_gold", game.info.trading_gold,
2326 N_("Gold trading"),
2327 N_("If turned off, trading gold in the diplomacy dialog "
2328 "is not allowed."), NULL, NULL,
2330
2331 GEN_BOOL("trading_city", game.info.trading_city,
2333 N_("City trading"),
2334 N_("If turned off, trading cities in the diplomacy dialog "
2335 "is not allowed."), NULL, NULL,
2337
2338 GEN_ENUM("caravan_bonus_style", game.info.caravan_bonus_style,
2340 N_("Caravan bonus style"),
2341 N_("The formula for the bonus when a caravan enters a city. "
2342 "CLASSIC bonuses are proportional to distance and trade "
2343 "of source and destination with multipliers for overseas and "
2344 "international destinations. LOGARITHMIC bonuses are "
2345 "proportional to log^2(distance + trade)."),
2348
2349 GEN_ENUM("trade_revenue_style", game.info.trade_revenue_style,
2351 N_("Trade revenue style"),
2352 N_("The formula for the trade a city receives from a trade route. "
2353 "CLASSIC revenues are given by the sum of the two city sizes "
2354 "plus the distance between them, with multipliers for overseas "
2355 "and international routes. "
2356 "SIMPLE revenues are proportional to the average trade of the "
2357 "two cities."),
2360
2361 GEN_INT("trademindist", game.info.trademindist,
2363 N_("Minimum distance for trade routes"),
2364 N_("In order for two cities in the same civilization to establish "
2365 "a trade route, they must be at least this far apart on the "
2366 "map. For square grids, the distance is calculated as "
2367 "\"Manhattan distance\", that is, the sum of the displacements "
2368 "along the x and y directions."), NULL, NULL, NULL,
2371
2372 GEN_INT("rapturedelay", game.info.rapturedelay,
2375 N_("Number of turns between rapture effect"),
2376 N_("Sets the number of turns between rapture growth of a city. "
2377 "If set to n a city will grow after celebrating for n+1 "
2378 "turns."),
2379 NULL, NULL, NULL,
2382
2383 GEN_INT("disasters", game.info.disasters,
2386 N_("Frequency of disasters"),
2387 N_("Affects how often random disasters happen to cities, "
2388 "if any are defined by the ruleset. The relative frequency "
2389 "of disaster types is set by the ruleset. Zero prevents "
2390 "any random disasters from occurring."),
2391 NULL, NULL, NULL,
2394
2395 GEN_ENUM("traitdistribution", game.server.trait_dist,
2397 N_("AI trait distribution method"),
2398 N_("How trait values are given to AI players."),
2400
2401 GEN_INT("razechance", game.server.razechance,
2403 N_("Chance for conquered building destruction"),
2404 N_("When a player conquers a city, each city improvement has this "
2405 "percentage chance to be destroyed."), NULL, NULL, NULL,
2407
2408 GEN_INT("occupychance", game.server.occupychance,
2410 N_("Chance of moving into tile after attack"),
2411 N_("If set to 0, combat is Civ1/2-style (when you attack, "
2412 "you remain in place). If set to 100, attacking units "
2413 "will always move into the tile they attacked when they win "
2414 "the combat (and no enemy units remain in the tile). If "
2415 "set to a value between 0 and 100, this will be used as "
2416 "the percent chance of \"occupying\" territory."),
2417 NULL, NULL, NULL,
2420
2423 N_("Turn on/off server-side autoattack"),
2424 N_("If set to on, units with moves left will automatically "
2425 "consider attacking enemy units that move adjacent to them."),
2427
2428 GEN_BOOL("killstack", game.info.killstack,
2431 N_("Do all units in tile die with defender"),
2432 N_("If this is enabled, each time a defender unit loses in combat, "
2433 "and is not inside a city or suitable base, all units in the same "
2434 "tile are destroyed along with the defender. If this is disabled, "
2435 "only the defender unit is destroyed."),
2437
2438 GEN_BOOL("killcitizen", game.info.killcitizen,
2440 N_("Reduce city population after attack"),
2441 N_("This flag indicates whether a city's population is reduced "
2442 "after a successful attack by an enemy unit. If this is "
2443 "disabled, population is never reduced. Even when this is "
2444 "enabled, only some units may kill citizens."),
2446
2447 GEN_INT("killunhomed", game.server.killunhomed,
2449 N_("Slowly kill units without home cities (e.g., starting units)"),
2450 N_("If greater than 0, then every unit without a homecity will "
2451 "lose hitpoints each turn. The number of hitpoints lost is "
2452 "given by 'killunhomed' percent of the hitpoints of the unit "
2453 "type. At least one hitpoint is lost every turn until the "
2454 "death of the unit."),
2457
2458 GEN_ENUM("borders", game.info.borders,
2461 N_("National borders"),
2462 N_("If this is not disabled, then any land tiles around a "
2463 "city or border-claiming extra (like the classic ruleset's "
2464 "Fortress base) will be owned by that nation. "
2465 "SEE_INSIDE and EXPAND makes everything inside a player's "
2466 "borders visible at once. ENABLED will, in some rulesets, "
2467 "grant the same visibility if certain conditions are met."),
2469
2470 GEN_ENUM("happyborders", game.info.happyborders,
2473 N_("Units inside borders cause no unhappiness"),
2474 N_("If this is set, units will not cause unhappiness when "
2475 "inside your borders, or even allies borders, depending "
2476 "on value."), NULL, NULL, NULL,
2478
2479 GEN_ENUM("diplomacy", game.info.diplomacy,
2482 N_("Ability to do diplomacy with other players"),
2483 N_("This setting controls the ability to do diplomacy with "
2484 "other players."),
2486
2489 N_("Allowed city names"),
2490 /* TRANS: The strings between double quotes are also translated
2491 * separately (they must match!). The strings between parentheses
2492 * and in uppercase must not be translated. */
2493 N_("- \"No restrictions\" (NO_RESTRICTIONS): players can have "
2494 "multiple cities with the same names.\n"
2495 "- \"Unique to a player\" (PLAYER_UNIQUE): one player can't "
2496 "have multiple cities with the same name.\n"
2497 "- \"Globally unique\" (GLOBAL_UNIQUE): all cities in a game "
2498 "have to have different names.\n"
2499 "- \"No city name stealing\" (NO_STEALING): like "
2500 "\"Globally unique\", but a player isn't allowed to use a "
2501 "default city name of another nation unless it is a default "
2502 "for their nation also."),
2504
2505 GEN_ENUM("plrcolormode", game.server.plrcolormode,
2507 N_("How to pick player colors"),
2508 /* TRANS: The strings between double quotes are also translated
2509 * separately (they must match!). The strings between single quotes
2510 * are setting names and shouldn't be translated. The strings
2511 * between parentheses and in uppercase must not be translated. */
2512 N_("This setting determines how player colors are chosen. Player "
2513 "colors are used in the Nations report, for national borders on "
2514 "the map, and so on.\n"
2515 "- \"Per-player, in order\" (PLR_ORDER): colors are assigned to "
2516 "individual players in order from a list defined by the "
2517 "ruleset.\n"
2518 "- \"Per-player, random\" (PLR_RANDOM): colors are assigned "
2519 "to individual players randomly from the set defined by the "
2520 "ruleset.\n"
2521 "- \"Set manually\" (PLR_SET): colors can be set with the "
2522 "'playercolor' command before the game starts; these are not "
2523 "restricted to the ruleset colors. Any players for which no "
2524 "color is set when the game starts get a random color from the "
2525 "ruleset.\n"
2526 "- \"Per-team, in order\" (TEAM_ORDER): colors are assigned to "
2527 "teams from the list in the ruleset. Every player on the same "
2528 "team gets the same color.\n"
2529 "- \"Per-nation, in order\" (NATION_ORDER): if the ruleset "
2530 "defines a color for a player's nation, the player takes that "
2531 "color. Any players whose nations don't have associated colors "
2532 "get a random color from the list in the ruleset.\n"
2533 "Regardless of this setting, individual player colors can be "
2534 "changed after the game starts with the 'playercolor' command."),
2537
2538 /* Flexible rules: these can be changed after the game has started.
2539 *
2540 * The distinction between "rules" and "flexible rules" is not always
2541 * clearcut, and some existing cases may be largely historical or
2542 * accidental. However some generalizations can be made:
2543 *
2544 * -- Low-level game mechanics should not be flexible (eg, rulesets).
2545 * -- Options which would affect the game "state" (city production etc)
2546 * should not be flexible (eg, foodbox).
2547 * -- Options which are explicitly sent to the client (eg, in
2548 * packet_game_info) should probably not be flexible, or at
2549 * least need extra care to be flexible.
2550 */
2551 GEN_ENUM("barbarians", game.server.barbarianrate,
2554 N_("Barbarian appearance frequency"),
2555 /* TRANS: The string between single quotes is a setting name and
2556 * should not be translated. */
2557 N_("This setting controls how frequently the barbarians appear "
2558 "in the game. See also the 'onsetbarbs' setting."),
2560
2561 GEN_INT("onsetbarbs", game.server.onsetbarbarian,
2564 N_("Barbarian onset turn"),
2565 N_("Barbarians will not appear before this turn."),
2566 NULL, NULL, NULL,
2569
2570 GEN_ENUM("revolentype", game.info.revolentype,
2572 N_("Way to determine revolution length"),
2573 N_("Which method is used in determining how long period of anarchy "
2574 "lasts when changing government. The actual value is set with "
2575 "'revolen' setting. The 'quickening' methods depend on how "
2576 "many times any player has changed to this type of government "
2577 "before, so it becomes easier to establish a new system of "
2578 "government if it has been done before."),
2580
2584 N_("Length of revolution"),
2585 N_("When changing governments, a period of anarchy will occur. "
2586 "Value of this setting, used the way 'revolentype' setting "
2587 "dictates, defines the length of the anarchy."),
2588 NULL, NULL, NULL,
2591
2592 GEN_BOOL("fogofwar", game.info.fogofwar,
2594 N_("Whether to enable fog of war"),
2595 N_("If this is enabled, only those units and cities within "
2596 "the vision range of your own units and cities will be "
2597 "revealed to you. You will not see new cities or terrain "
2598 "changes in tiles not observed."),
2600
2601 GEN_BOOL("foggedborders", game.server.foggedborders,
2603 N_("Whether fog of war applies to border changes"),
2604 N_("If this setting is enabled, players will not be able "
2605 "to see changes in tile ownership if they do not have "
2606 "direct sight of the affected tiles. Otherwise, players "
2607 "can see any or all changes to borders as long as they "
2608 "have previously seen the tiles."),
2610
2611 GEN_BITWISE("airliftingstyle", game.info.airlifting_style,
2613 ALLOW_NONE, ALLOW_BASIC, N_("Airlifting style"),
2614 /* TRANS: The strings between double quotes are also
2615 * translated separately (they must match!). The strings
2616 * between parenthesis and in uppercase must not be
2617 * translated. */
2618 N_("This setting affects airlifting units between cities. It "
2619 "can be a set of the following values:\n"
2620 "- \"Allows units to be airlifted from allied cities\" "
2621 "(FROM_ALLIES).\n"
2622 "- \"Allows units to be airlifted to allied cities\" "
2623 "(TO_ALLIES).\n"
2624 "- \"Unlimited units from source city\" (SRC_UNLIMITED): "
2625 "airlifting from a city doesn't reduce the "
2626 "airlifted counter. It depends on the ruleset whether "
2627 "this is possible even with zero airlift capacity.\n"
2628 "- \"Unlimited units to destination city\" "
2629 "(DEST_UNLIMITED): airlifting to a city doesn't "
2630 "reduce the airlifted counter. It depends on the ruleset "
2631 "whether this is possible even with zero airlift capacity."),
2633
2634 GEN_INT("diplchance", game.server.diplchance,
2637 N_("Base chance for diplomats and spies to succeed"),
2638 N_("The base chance of a spy returning from a successful mission and "
2639 "the base chance of success for diplomats and spies for most "
2640 "aggressive mission types. Not all the mission types use diplchance "
2641 "as a base chance – a ruleset can even say that no action at all does. "
2642 "Unit Bribing, and Unit Sabotaging never do. "
2643 "Non-aggressive missions typically have no base chance "
2644 "at all, but always success."),
2645 NULL, NULL, NULL,
2647
2651 N_("What kinds of victories are possible"),
2652 /* TRANS: The strings between double quotes are also translated
2653 * separately (they must match!). The strings between single
2654 * quotes are setting names and shouldn't be translated. The
2655 * strings between parentheses and in uppercase must stay as
2656 * untranslated. */
2657 N_("This setting controls how game can be won. One can always "
2658 "win by conquering entire planet, but other victory conditions "
2659 "can be enabled or disabled:\n"
2660 "- \"Spacerace\" (SPACERACE): Spaceship is built and travels to "
2661 "Alpha Centauri.\n"
2662 "- \"Allied\" (ALLIED): After defeating enemies, all remaining "
2663 "players are allied.\n"
2664 "- \"Culture\" (CULTURE): Player meets ruleset defined cultural "
2665 "domination criteria.\n"),
2667
2670 N_("Should the game end if the spaceship arrives?"),
2671 N_("If this option is turned on, the game will end with the "
2672 "arrival of a spaceship at Alpha Centauri."),
2674
2675 GEN_INT("spaceship_travel_pct", game.server.spaceship_travel_pct,
2678 N_("Percentage to multiply spaceship travel time by"),
2679 N_("This percentage is multiplied onto the time it will take for "
2680 "a spaceship to arrive at Alpha Centauri."), NULL, NULL, NULL,
2683
2684 GEN_INT("civilwarsize", game.server.civilwarsize,
2687 N_("Minimum number of cities for civil war"),
2688 N_("A civil war is triggered when a player has at least this "
2689 "many cities and the player's capital is captured. If "
2690 "this option is set to the maximum value, civil wars are "
2691 "turned off altogether."), NULL, NULL, NULL,
2694
2695 GEN_BOOL("restrictinfra", game.info.restrictinfra,
2698 N_("Restrict the use of the infrastructure for enemy units"),
2699 N_("If this option is enabled, the use of roads and rails "
2700 "will be restricted for enemy units."), NULL, NULL,
2702
2703 GEN_BOOL("unreachableprotects", game.info.unreachable_protects,
2706 N_("Does unreachable unit protect reachable ones"),
2707 N_("This option controls whether tiles with both unreachable "
2708 "and reachable units can be attacked. If disabled, any "
2709 "tile with reachable units can be attacked. If enabled, "
2710 "tiles with an unreachable unit in them cannot be attacked. "
2711 "Some units in some rulesets may override this, never "
2712 "protecting reachable units on their tile."),
2714
2715 GEN_INT("contactturns", game.server.contactturns,
2718 N_("Turns until player contact is lost"),
2719 N_("Players may meet for diplomacy this number of turns "
2720 "after their units have last met, even when they do not have "
2721 "an embassy. If set to zero, then players cannot meet unless "
2722 "they have an embassy."),
2723 NULL, NULL, NULL,
2726
2727 GEN_BOOL("savepalace", game.server.savepalace,
2730 N_("Rebuild palace whenever capital is conquered"),
2731 N_("If this is turned on, when the capital is conquered the "
2732 "palace is automatically rebuilt for free in another randomly "
2733 "chosen city. This is significant because the technology "
2734 "requirement for building a palace will be ignored. (In "
2735 "some rulesets, buildings other than the palace are affected "
2736 "by this setting.)"),
2738
2739 GEN_BOOL("homecaughtunits", game.server.homecaughtunits,
2742 N_("Give caught units a homecity"),
2743 /* TRANS: The string between single quotes is a setting name and
2744 * should not be translated. */
2745 N_("If unset, caught units will have no homecity and will be "
2746 "subject to the 'killunhomed' option."),
2748
2749 GEN_BOOL("naturalcitynames", game.server.natural_city_names,
2752 N_("Whether to use natural city names"),
2753 N_("If enabled, the default city names will be determined based "
2754 "on the surrounding terrain."),
2756
2757 GEN_BOOL("migration", game.server.migration,
2760 N_("Whether to enable citizen migration"),
2761 /* TRANS: The strings between single quotes are setting names
2762 * and should not be translated. */
2763 N_("This is the master setting that controls whether citizen "
2764 "migration is active in the game. If enabled, citizens may "
2765 "automatically move from less desirable cities to more "
2766 "desirable ones. The \"desirability\" of a given city is "
2767 "calculated from a number of factors. In general larger "
2768 "cities with more income and improvements will be preferred. "
2769 "Citizens will never migrate out of the capital, or cause "
2770 "a wonder to be lost by disbanding a city. A number of other "
2771 "settings control how migration behaves:\n"
2772 " 'mgr_turninterval' - How often citizens try to migrate.\n"
2773 " 'mgr_foodneeded' - Whether destination food is checked.\n"
2774 " 'mgr_distance' - How far citizens will migrate.\n"
2775 " 'mgr_worldchance' - Chance for inter-nation migration.\n"
2776 " 'mgr_nationchance' - Chance for intra-nation migration."),
2778
2779 GEN_INT("mgr_turninterval", game.server.mgr_turninterval,
2782 N_("Number of turns between migrations from a city"),
2783 /* TRANS: Do not translate 'migration' setting name. */
2784 N_("This setting controls the number of turns between migration "
2785 "checks for a given city. The interval is calculated from "
2786 "the founding turn of the city. So for example if this "
2787 "setting is 5, citizens will look for a suitable migration "
2788 "destination every five turns from the founding of their "
2789 "current city. Migration will never occur the same turn "
2790 "that a city is built. This setting has no effect unless "
2791 "migration is enabled by the 'migration' setting."),
2792 NULL, NULL, NULL,
2795
2796 GEN_BOOL("mgr_foodneeded", game.server.mgr_foodneeded,
2799 N_("Whether migration is limited by food"),
2800 /* TRANS: Do not translate 'migration' setting name. */
2801 N_("If this setting is enabled, citizens will not migrate to "
2802 "cities which would not have enough food to support them. "
2803 "This setting has no effect unless migration is enabled by "
2804 "the 'migration' setting."), NULL, NULL,
2806
2807 GEN_INT("mgr_distance", game.server.mgr_distance,
2810 N_("Maximum distance citizens may migrate"),
2811 /* TRANS: Do not translate 'migration' setting name. */
2812 N_("This setting controls how far citizens may look for a "
2813 "suitable migration destination when deciding which city "
2814 "to migrate to. The value is added to the candidate target "
2815 "city's radius and compared to the distance between the "
2816 "two cities. If the distance is lower or equal, migration "
2817 "is possible. (So with a setting of 0, citizens will only "
2818 "consider migrating if their city's center is within the "
2819 "destination city's working radius.) This setting has no "
2820 "effect unless migration is enabled by the 'migration' "
2821 "setting."),
2824
2825 GEN_INT("mgr_nationchance", game.server.mgr_nationchance,
2828 N_("Percent probability for migration within the same nation"),
2829 /* TRANS: Do not translate 'migration' setting name. */
2830 N_("This setting controls how likely it is for citizens to "
2831 "migrate between cities owned by the same player. Zero "
2832 "indicates migration will never occur, 100 means that "
2833 "migration will always occur if the citizens find a suitable "
2834 "destination. This setting has no effect unless migration "
2835 "is activated by the 'migration' setting."),
2836 NULL, NULL, NULL,
2839
2840 GEN_INT("mgr_worldchance", game.server.mgr_worldchance,
2843 N_("Percent probability for migration between foreign cities"),
2844 /* TRANS: Do not translate 'migration' setting name. */
2845 N_("This setting controls how likely it is for migration "
2846 "to occur between cities owned by different players. "
2847 "Zero indicates migration will never occur, 100 means "
2848 "that citizens will always migrate if they find a suitable "
2849 "destination. This setting has no effect if migration is "
2850 "not enabled by the 'migration' setting."),
2851 NULL, NULL, NULL,
2854
2855 /* Meta options: these don't affect the internal rules of the game, but
2856 * do affect players. Also options which only produce extra server
2857 * "output" and don't affect the actual game.
2858 * ("endturn" is here, and not RULES_FLEXIBLE, because it doesn't
2859 * affect what happens in the game, it just determines when the
2860 * players stop playing and look at the score.)
2861 */
2862 GEN_STRING("allowtake", game.server.allow_take,
2864 N_("Players that users are allowed to take"),
2865 /* TRANS: the strings in double quotes are server command names
2866 * and should not be translated. */
2867 N_("This should be a string of characters, each of which "
2868 "specifies a type or status of a civilization (player).\n"
2869 "Clients will only be permitted to take or observe those "
2870 "players which match one of the specified letters. This "
2871 "only affects future uses of the \"take\" or \"observe\" "
2872 "commands; it is not retroactive. The characters and their "
2873 "meanings are:\n"
2874 " o,O = Global observer\n"
2875 " b = Barbarian players\n"
2876 " d = Dead players\n"
2877 " a,A = AI players\n"
2878 " h,H = Human players\n"
2879 "The first description on this list which matches a "
2880 "player is the one which applies. Thus 'd' does not "
2881 "include dead barbarians, 'a' does not include dead AI "
2882 "players, and so on. Upper case letters apply before "
2883 "the game has started, lower case letters afterwards.\n"
2884 "Each character above may be followed by one of the "
2885 "following numbers to allow or restrict the manner "
2886 "of connection:\n"
2887 "(none) = Controller allowed, observers allowed, "
2888 "can displace connections. (Displacing a connection means "
2889 "that you may take over a player, even when another user "
2890 "already controls that player.)\n"
2891 " 1 = Controller allowed, observers allowed, "
2892 "can't displace connections;\n"
2893 " 2 = Controller allowed, no observers allowed, "
2894 "can displace connections;\n"
2895 " 3 = Controller allowed, no observers allowed, "
2896 "can't displace connections;\n"
2897 " 4 = No controller allowed, observers allowed"),
2899
2900 GEN_BOOL("autotoggle", game.server.auto_ai_toggle,
2903 N_("Whether AI-status toggles with connection"),
2904 N_("If enabled, AI status is turned off when a player "
2905 "connects, and on when a player disconnects."),
2907
2908 GEN_INT("endturn", game.server.end_turn,
2910 N_("Turn the game ends"),
2911 N_("The game will end at the end of the given turn."),
2914
2917 N_("Reveal the map"),
2918 /* TRANS: The strings between double quotes are also translated
2919 * separately (they must match!). The strings between single
2920 * quotes are setting names and shouldn't be translated. The
2921 * strings between parentheses and in uppercase must not be
2922 * translated. */
2923 N_("If \"Reveal map at game start\" (START) is set, the "
2924 "initial state of the entire map will be known to all "
2925 "players from the start of the game, although it may "
2926 "still be fogged (depending on the 'fogofwar' setting). "
2927 "If \"Unfog map for dead players\" (DEAD) is set, dead "
2928 "players can see the entire map, if they are alone in "
2929 "their team."),
2931
2932 GEN_INT("timeout", game.info.timeout,
2934 N_("Maximum seconds per turn"),
2935 /* TRANS: \"Turn Done\" refers to the client button; it is also
2936 * translated separately, the translation should be the same.
2937 * \"timeoutincrease\" is a command name and must not to be
2938 * translated. */
2939 N_("If all players have not hit \"Turn Done\" before this "
2940 "time is up, then the turn ends automatically. Zero "
2941 "means there is no timeout. In servers compiled with "
2942 "debugging, a timeout of -1 sets the autogame test mode. "
2943 "Only connections with hack level access may set the "
2944 "timeout to fewer than 30 seconds. Use this with the "
2945 "command \"timeoutincrease\" to have a dynamic timer. "
2946 "The first turn is treated as a special case and is controlled "
2947 "by the 'first_timeout' setting."),
2950
2951 GEN_INT("first_timeout", game.info.first_timeout,
2953 N_("First turn timeout"),
2954 /* TRANS: The strings between single quotes are setting names and
2955 * should not be translated. */
2956 N_("If greater than 0, T1 will last for 'first_timeout' seconds.\n"
2957 "If set to 0, T1 will not have a timeout.\n"
2958 "If set to -1, the special treatment of T1 will be disabled.\n"
2959 "See also 'timeout'."),
2963
2964 GEN_INT("timeaddenemymove", game.server.timeoutaddenemymove,
2966 N_("Timeout at least n seconds when enemy moved"),
2967 N_("Any time a unit moves while in sight of an enemy player, "
2968 "the remaining timeout is increased to this value."),
2969 NULL, NULL, NULL,
2971
2972 GEN_INT("unitwaittime", game.server.unitwaittime,
2975 N_("Minimum time between unit actions over turn change"),
2976 /* TRANS: The string between single quotes is a setting name and
2977 * should not be translated. */
2978 N_("This setting gives the minimum amount of time in seconds "
2979 "between unit moves and other significant actions (such as "
2980 "building cities) after a turn change occurs. For example, "
2981 "if this setting is set to 20 and a unit moves 5 seconds "
2982 "before the turn change, it will not be able to move or act "
2983 "in the next turn for at least 15 seconds. This value is "
2984 "limited to a maximum value of 2/3 'timeout'."),
2987
2988 /* This setting points to the "stored" value; changing it won't have
2989 * an effect until the next synchronization point (i.e., the start of
2990 * the next turn). */
2994 N_("Control of simultaneous player/team phases"),
2995 N_("This setting controls whether players may make "
2996 "moves at the same time during a turn. Change "
2997 "in setting takes effect next turn."),
2999
3000 GEN_INT("nettimeout", game.server.tcptimeout,
3002 N_("Seconds to let a client's network connection block"),
3003 N_("If a network connection is blocking for a time greater than "
3004 "this value, then the connection is closed. Zero "
3005 "means there is no timeout (although connections will be "
3006 "automatically disconnected eventually)."),
3007 NULL, NULL, NULL,
3009
3010 GEN_INT("netwait", game.server.netwait,
3012 N_("Max seconds for network buffers to drain"),
3013 N_("The server will wait for up to the value of this "
3014 "parameter in seconds, for all client connection network "
3015 "buffers to unblock. Zero means the server will not "
3016 "wait at all."), NULL, NULL, NULL,
3018
3019 GEN_INT("pingtime", game.server.pingtime,
3021 N_("Seconds between PINGs"),
3022 N_("The server will poll the clients with a PING request "
3023 "each time this period elapses."), NULL, NULL, NULL,
3025
3026 GEN_INT("pingtimeout", game.server.pingtimeout,
3029 N_("Time to cut a client"),
3030 N_("If a client doesn't reply to a PING in this time the "
3031 "client is disconnected."), NULL, NULL, NULL,
3033
3034 GEN_BOOL("iphide", game.server.ip_hide,
3037 N_("Keep client IP hidden"),
3038 N_("Don't tell client IP address to other clients. Server operator "
3039 "can still see it. Also, changing this setting cannot do anything "
3040 "to the information already sent before."),
3042
3043 GEN_BOOL("turnblock", game.server.turnblock,
3046 N_("Turn-blocking game play mode"),
3047 N_("If this is turned on, the game turn is not advanced "
3048 "until all players have finished their turn, including "
3049 "disconnected players."),
3051
3052 GEN_BOOL("fixedlength", game.server.fixedlength,
3055 N_("Fixed-length turns play mode"),
3056 /* TRANS: \"Turn Done\" refers to the client button; it is also
3057 * translated separately, the translation should be the same. */
3058 N_("If this is turned on the game turn will not advance "
3059 "until the timeout has expired, even after all players "
3060 "have clicked on \"Turn Done\"."),
3061 NULL, NULL, FALSE)
3062
3063 GEN_INT("top_cities", game.info.top_cities_count,
3066 N_("Number of cities in Top Cities report"),
3067 N_("How many cities should the Top Cities report contain? "
3068 "If this is zero, Top Cities report is not available "
3069 "at all."), NULL, NULL, NULL,
3072
3073 GEN_STRING("demography", game.server.demography,
3076 N_("What is in the Demographics report"),
3077 /* TRANS: The strings between double quotes should be
3078 * translated. */
3079 N_("This should be a string of characters, each of which "
3080 "specifies the inclusion of a line of information "
3081 "in the Demographics report.\n"
3082 "The characters and their meanings are:\n"
3083 " N = include Population\n"
3084 " P = include Production\n"
3085 " A = include Land Area\n"
3086 " L = include Literacy\n"
3087 " R = include Research Speed\n"
3088 " S = include Settled Area\n"
3089 " E = include Economics\n"
3090 " M = include Military Service\n"
3091 " O = include Pollution\n"
3092 " C = include Culture\n"
3093 "Additionally, the following characters control whether "
3094 "or not certain columns are displayed in the report:\n"
3095 " q = display \"quantity\" column\n"
3096 " r = display \"rank\" column\n"
3097 " b = display \"best nation\" column\n"
3098 "The order of characters is not significant, but "
3099 "their capitalization is."),
3101
3102 GEN_INT("saveturns", game.server.save_nturns,
3104 N_("Turns per auto-save"),
3105 /* TRANS: The string between double quotes is also translated
3106 * separately (it must match!). The string between single
3107 * quotes is a setting name and shouldn't be translated. */
3108 N_("How many turns elapse between automatic game saves. This "
3109 "setting only has an effect when the 'autosaves' setting "
3110 "includes \"New turn\"."), NULL, NULL, NULL,
3112
3113 GEN_INT("savefrequency", game.server.save_frequency,
3115 N_("Minutes per auto-save"),
3116 /* TRANS: The string between double quotes is also translated
3117 * separately (it must match!). The string between single
3118 * quotes is a setting name and shouldn't be translated. */
3119 N_("How many minutes elapse between automatic game saves. "
3120 "Unlike other save types, this save is only meant as backup "
3121 "for computer memory, and it always uses the same name, older "
3122 "saves are not kept. This setting only has an effect when the "
3123 "'autosaves' setting includes \"Timer\"."), NULL, NULL, NULL,
3125
3126 GEN_BITWISE("autosaves", game.server.autosaves,
3128 N_("Which savegames are generated automatically"),
3129 /* TRANS: The strings between double quotes are also translated
3130 * separately (they must match!). The strings between single
3131 * quotes are setting names and shouldn't be translated. The
3132 * strings between parentheses and in uppercase must stay as
3133 * untranslated. */
3134 N_("This setting controls which autosave types get generated:\n"
3135 "- \"New turn\" (TURN): Save when turn begins, once every "
3136 "'saveturns' turns.\n"
3137 "- \"Game over\" (GAMEOVER): Final save when game ends.\n"
3138 "- \"No player connections\" (QUITIDLE): "
3139 "Save before server restarts due to lack of players.\n"
3140 "- \"Server interrupted\" (INTERRUPT): Save when server "
3141 "quits due to interrupt.\n"
3142 "- \"Timer\" (TIMER): Save every 'savefrequency' minutes."),
3144
3145 GEN_BOOL("threaded_save", game.server.threaded_save,
3147 N_("Whether to do saving in separate thread"),
3148 /* TRANS: The string between single quotes is a setting name and
3149 * should not be translated. */
3150 N_("If this is turned in, compressing and saving the actual "
3151 "file containing the game situation takes place in "
3152 "the background while game otherwise continues. This way "
3153 "users are not required to wait for the save to finish."),
3155
3158 N_("Savegame compression level"),
3159 /* TRANS: 'compresstype' setting name should not be translated. */
3160 N_("If non-zero, saved games will be compressed depending on the "
3161 "'compresstype' setting. Larger values will give better "
3162 "compression but take longer."),
3163 NULL, NULL, NULL,
3165
3166 GEN_ENUM("compresstype", game.server.save_compress_type,
3168 N_("Savegame compression algorithm"),
3169 N_("Compression library to use for savegames."),
3171
3172 GEN_STRING("savename", game.server.save_name,
3174 N_("Definition of the save file name"),
3175 /* TRANS: %R, %S, %T and %Y must not be translated. The
3176 * strings (examples and setting names) between single quotes
3177 * neither. The strings between <> should be translated.
3178 * xgettext:no-c-format */
3179 N_("Within the string the following custom formats are "
3180 "allowed:\n"
3181 " %R = <reason>\n"
3182 " %S = <suffix>\n"
3183 " %T = <turn-number>\n"
3184 " %Y = <game-year>\n"
3185 "\n"
3186 "Example: 'freeciv-T%04T-Y%+05Y-%R' => "
3187 "'freeciv-T0100-Y00001-manual'\n"
3188 "\n"
3189 "Be careful to use at least one of %T and %Y, else newer "
3190 "savegames will overwrite old ones. If none of the formats "
3191 "is used '-T%04T-Y%05Y-%R' is appended to the value of "
3192 "'savename'."),
3194
3195 GEN_BOOL("scorelog", game.server.scorelog,
3199#else /* FREECIV_WEB */
3201#endif /* FREECIV_WEB */
3202 N_("Whether to log player statistics"),
3203 /* TRANS: The string between single quotes is a setting name and
3204 * should not be translated. */
3205 N_("If this is turned on, player statistics are appended to "
3206 "the file defined by the option 'scorefile' every turn. "
3207 "These statistics can be used to create power graphs after "
3209
3210 GEN_ENUM("scoreloglevel", game.server.scoreloglevel,
3213 N_("Scorelog level"),
3214 N_("Whether scores are logged for all players including AIs, "
3215 "or only for human players."), NULL, NULL, NULL,
3217
3218#ifndef FREECIV_WEB
3219 GEN_STRING("scorefile", game.server.scorefile,
3222 N_("Name for the score log file"),
3223 /* TRANS: Don't translate the string in single quotes. */
3224 N_("The default name for the score log file is "
3225 "'freeciv-score.log'."),
3227#endif /* !FREECIV_WEB */
3228
3229 GEN_INT("maxconnectionsperhost", game.server.maxconnectionsperhost,
3232 N_("Maximum number of connections to the server per host"),
3233 N_("New connections from a given host will be rejected if "
3234 "the total number of connections from the very same host "
3235 "equals or exceeds this value. A value of 0 means that "
3236 "there is no limit, at least up to the maximum number of "
3237 "connections supported by the server."), NULL, NULL, NULL,
3240
3241 GEN_INT("kicktime", game.server.kick_time,
3244 N_("Time before a kicked user can reconnect"),
3245 /* TRANS: the string in double quotes is a server command name and
3246 * should not be translated */
3247 N_("Gives the time in seconds before a user kicked using the "
3248 "\"kick\" command may reconnect. Changing this setting will "
3249 "affect users kicked in the past."), NULL, NULL, NULL,
3251
3254 N_("Metaserver info line"),
3255 N_("User defined metaserver info line. For most of the time "
3256 "a user defined metamessage will be used instead of an "
3257 "automatically generated message. "
3258 "Set to empty (\"\", not \"empty\") to always use an "
3259 "automatically generated meta server message."),
3261
3262 GEN_ENUM("ailevel", game.info.skill_level,
3264 N_("Level of new AIs"),
3265 N_("Difficulty level of any AI players to be created now on. "
3266 "Changing value of this setting does not affect "
3267 "existing players."), NULL, NULL, NULL,
3269
3272 N_("Default AI type"),
3273 N_("Name of the default AI type. New AI players will be "
3274 "created with that type by default. Changing this "
3275 "setting does not affect existing AI players."),
3277};
3278
3279#undef GEN_BOOL
3280#undef GEN_INT
3281#undef GEN_STRING
3282#undef GEN_ENUM
3283#undef GEN_BITWISE
3284
3285/* The number of settings, not including the END. */
3287
3288/************************************************************************/
3292{
3293 return (0 <= id && id < SETTINGS_NUM ? settings + id : NULL);
3294}
3295
3296/************************************************************************/
3299struct setting *setting_by_name(const char *name)
3300{
3302
3304 if (0 == strcmp(name, pset->name)) {
3305 return pset;
3306 }
3308 return NULL;
3309}
3310
3311/************************************************************************/
3314int setting_number(const struct setting *pset)
3315{
3316 fc_assert_ret_val(pset != NULL, -1);
3317 return pset - settings;
3318}
3319
3320/************************************************************************/
3323const char *setting_name(const struct setting *pset)
3324{
3325 return pset->name;
3326}
3327
3328/************************************************************************/
3331const char *setting_short_help(const struct setting *pset)
3332{
3333 return pset->short_help;
3334}
3335
3336/************************************************************************/
3340const char *setting_extra_help(const struct setting *pset, bool constant)
3341{
3342 if (!constant && pset->help_func != NULL) {
3343 return pset->help_func(pset);
3344 }
3345
3346 return _(pset->extra_help);
3347}
3348
3349/************************************************************************/
3353{
3354 return pset->stype;
3355}
3356
3357/************************************************************************/
3361{
3362 return pset->slevel;
3363}
3364
3365/************************************************************************/
3369{
3370 return pset->scategory;
3371}
3372
3373/************************************************************************/
3378static bool setting_is_free_to_change(const struct setting *pset,
3379 char *reject_msg,
3380 size_t reject_msg_len)
3381{
3382 switch (pset->sclass) {
3383 case SSET_MAP_SIZE:
3384 case SSET_MAP_GEN:
3385 /* Only change map options if we don't yet have a map: */
3386 if (map_is_empty()) {
3387 return TRUE;
3388 }
3389
3391 _("The setting '%s' can't be modified after the map "
3392 "is fixed."), setting_name(pset));
3393 return FALSE;
3394
3396 /* Like SSET_RULES except that it can be changed before the game starts
3397 * for heavy scenarios. A heavy scenario comes with players. It can
3398 * include cities, units, diplomatic relations and other complex
3399 * state. Make sure that changing a setting can't make the state of a
3400 * heavy scenario illegal if you want to change it from SSET_RULES to
3401 * SSET_RULES_SCENARIO. */
3402
3404 && server_state() == S_S_INITIAL) {
3405 /* Special case detected. */
3406 return TRUE;
3407 }
3408
3409 /* The special case didn't make it legal to change the setting. Don't
3410 * give up. It could still be legal. Fall through so the non special
3411 * cases are checked too. */
3413
3414 case SSET_MAP_ADD:
3415 case SSET_PLAYERS:
3416 case SSET_GAME_INIT:
3417 case SSET_RULES:
3418 /* Only change start params and most rules if we don't yet have a map,
3419 * or if we do have a map but its a scenario one (ie, the game has
3420 * never actually been started).
3421 */
3422 if (map_is_empty() || game.info.is_new_game) {
3423 return TRUE;
3424 }
3425
3427 _("The setting '%s' can't be modified after the game "
3428 "has started."), setting_name(pset));
3429 return FALSE;
3430
3433 case SSET_META:
3434 /* These can always be changed: */
3435 return TRUE;
3436 }
3437
3438 log_error("Wrong class variant for setting %s (%d): %d.",
3440 settings_snprintf(reject_msg, reject_msg_len, _("Internal error."));
3441
3442 return FALSE;
3443}
3444
3445/************************************************************************/
3451 struct connection *caller, char *reject_msg,
3452 size_t reject_msg_len)
3453{
3454 if (caller
3455 && (caller->access_level < pset->access_level_write)) {
3457 _("You are not allowed to change the setting '%s'."),
3459 return FALSE;
3460 }
3461
3462 switch (pset->lock) {
3463 case SLOCK_NONE:
3464 break;
3465 case SLOCK_RULESET:
3466 /* Setting is locked by the ruleset */
3468 _("The setting '%s' is locked by the ruleset."),
3470 return FALSE;
3471 case SLOCK_ADMIN:
3472 /* Setting is locked by admin */
3474 _("The setting '%s' is locked by admin."),
3476 return FALSE;
3477 }
3478
3480}
3481
3482/************************************************************************/
3487 enum cmdlevel plevel)
3488{
3489 return (plevel >= pset->access_level_read);
3490}
3491
3492/************************************************************************/
3497 struct connection *caller)
3498{
3499 return (!caller
3501}
3502
3503/************************************************************************/
3509static enum m_pre_result
3511 const char *prefix, int *ind_result,
3512 const char **matches, size_t max_matches,
3513 size_t *pnum_matches)
3514{
3515 const struct sset_val_name *name;
3516 size_t len = strlen(prefix);
3517 size_t num_matches;
3518 int i;
3519
3520 *pnum_matches = 0;
3521
3522 if (0 == len) {
3523 return M_PRE_EMPTY;
3524 }
3525
3526 for (i = 0, num_matches = 0; (name = name_fn(i)); i++) {
3527 if (0 == fc_strncasecmp(name->support, prefix, len)) {
3528 if (strlen(name->support) == len) {
3529 *ind_result = i;
3530 return M_PRE_EXACT;
3531 }
3532 if (num_matches < max_matches) {
3533 matches[num_matches] = name->support;
3534 (*pnum_matches)++;
3535 }
3536 if (0 == num_matches++) {
3537 *ind_result = i;
3538 }
3539 }
3540 }
3541
3542 if (1 == num_matches) {
3543 return M_PRE_ONLY;
3544 } else if (1 < num_matches) {
3545 return M_PRE_AMBIGUOUS;
3546 } else {
3547 return M_PRE_FAIL;
3548 }
3549}
3550
3551/************************************************************************/
3556 const char *prefix, int *pvalue,
3557 char *reject_msg,
3558 size_t reject_msg_len)
3559{
3560 const char *matches[16];
3561 size_t num_matches;
3562
3563 switch (setting_match_prefix_base(name_fn, prefix, pvalue, matches,
3565 case M_PRE_EXACT:
3566 case M_PRE_ONLY:
3567 return TRUE; /* Ok. */
3568 case M_PRE_AMBIGUOUS:
3569 {
3570 struct astring astr = ASTRING_INIT;
3571
3572 fc_assert(2 <= num_matches);
3574 _("\"%s\" prefix is ambiguous. Candidates are: %s."),
3575 prefix,
3577 astr_free(&astr);
3578 }
3579 return FALSE;
3580 case M_PRE_EMPTY:
3581 settings_snprintf(reject_msg, reject_msg_len, _("Missing value."));
3582 return FALSE;
3583 case M_PRE_LONG:
3584 case M_PRE_FAIL:
3585 case M_PRE_LAST:
3586 break;
3587 }
3588
3590 _("No match for \"%s\"."), prefix);
3591 return FALSE;
3592}
3593
3594/************************************************************************/
3597static const char *setting_bool_to_str(const struct setting *pset,
3598 bool value, bool pretty,
3599 char *buf, size_t buf_len)
3600{
3601 const struct sset_val_name *name = pset->boolean.name(value);
3602
3603 if (pretty) {
3604 fc_snprintf(buf, buf_len, "%s", Q_(name->pretty));
3605 } else {
3606 fc_strlcpy(buf, name->support, buf_len);
3607 }
3608 return buf;
3609}
3610
3611/************************************************************************/
3618static bool setting_bool_validate_base(const struct setting *pset,
3619 const char *val, int *pint_val,
3620 struct connection *caller,
3621 char *reject_msg,
3622 size_t reject_msg_len)
3623{
3624 char buf[256];
3625
3626 if (SST_BOOL != pset->stype) {
3628 _("This setting is not a boolean."));
3629 return FALSE;
3630 }
3631
3632 sz_strlcpy(buf, val);
3634
3635 return (setting_match_prefix(pset->boolean.name, buf, pint_val,
3637 && (NULL == pset->boolean.validate
3638 || pset->boolean.validate(0 != *pint_val, caller, reject_msg,
3639 reject_msg_len)));
3640}
3641
3642/************************************************************************/
3647bool setting_bool_set(struct setting *pset, const char *val,
3648 struct connection *caller, char *reject_msg,
3649 size_t reject_msg_len)
3650{
3651 int int_val;
3652
3654 || !setting_bool_validate_base(pset, val, &int_val, caller,
3656 return FALSE;
3657 }
3658
3659 *pset->boolean.pvalue = (0 != int_val);
3660 return TRUE;
3661}
3662
3663/************************************************************************/
3667{
3669
3670 return *pset->boolean.pvalue;
3671}
3672
3673/************************************************************************/
3678bool setting_bool_validate(const struct setting *pset, const char *val,
3679 struct connection *caller, char *reject_msg,
3680 size_t reject_msg_len)
3681{
3682 int int_val;
3683
3684 return setting_bool_validate_base(pset, val, &int_val, caller,
3686}
3687
3688/************************************************************************/
3692static const char *setting_bool_secfile_str(secfile_data_t data, int val)
3693{
3694 const struct sset_val_name *name =
3695 ((const struct setting *) data)->boolean.name(val);
3696
3697 return (NULL != name ? name->support : NULL);
3698}
3699
3700/************************************************************************/
3703static const char *setting_int_to_str(const struct setting *pset,
3704 int value, bool pretty,
3705 char *buf, size_t buf_len)
3706{
3707 fc_snprintf(buf, buf_len, "%d", value);
3708 return buf;
3709}
3710
3711/************************************************************************/
3714int setting_int_min(const struct setting *pset)
3715{
3716 fc_assert_ret_val(pset->stype == SST_INT, 0);
3717 return pset->integer.min_value;
3718}
3719
3720/************************************************************************/
3723int setting_int_max(const struct setting *pset)
3724{
3725 fc_assert_ret_val(pset->stype == SST_INT, 0);
3726 return pset->integer.max_value;
3727}
3728
3729/************************************************************************/
3733bool setting_int_set(struct setting *pset, int val,
3734 struct connection *caller, char *reject_msg,
3735 size_t reject_msg_len)
3736{
3738 || !setting_int_validate(pset, val, caller, reject_msg,
3739 reject_msg_len)) {
3740 return FALSE;
3741 }
3742
3743 *pset->integer.pvalue = val;
3744 return TRUE;
3745}
3746
3747/************************************************************************/
3753bool setting_int_validate(const struct setting *pset, int val,
3754 struct connection *caller, char *reject_msg,
3755 size_t reject_msg_len)
3756{
3757 if (SST_INT != pset->stype) {
3759 _("This setting is not an integer."));
3760 return FALSE;
3761 }
3762
3763 if (val < pset->integer.min_value || val > pset->integer.max_value) {
3765 _("Value out of range: %d (min: %d; max: %d)."),
3766 val, pset->integer.min_value, pset->integer.max_value);
3767 return FALSE;
3768 }
3769
3770 return (!pset->integer.validate
3771 || pset->integer.validate(val, caller, reject_msg,
3773}
3774
3775/************************************************************************/
3779{
3781
3782 return *pset->integer.pvalue;
3783}
3784
3785/************************************************************************/
3788static const char *setting_str_to_str(const struct setting *pset,
3789 const char *value, bool pretty,
3790 char *buf, size_t buf_len)
3791{
3792 if (pretty) {
3793 fc_snprintf(buf, buf_len, "\"%s\"", value);
3794 } else {
3796 }
3797 return buf;
3798}
3799
3800/************************************************************************/
3804bool setting_str_set(struct setting *pset, const char *val,
3805 struct connection *caller, char *reject_msg,
3806 size_t reject_msg_len)
3807{
3809 || !setting_str_validate(pset, val, caller, reject_msg,
3810 reject_msg_len)) {
3811 return FALSE;
3812 }
3813
3814 fc_strlcpy(pset->string.value, val, pset->string.value_size);
3815 return TRUE;
3816}
3817
3818/************************************************************************/
3824bool setting_str_validate(const struct setting *pset, const char *val,
3825 struct connection *caller, char *reject_msg,
3826 size_t reject_msg_len)
3827{
3828 if (SST_STRING != pset->stype) {
3830 _("This setting is not a string."));
3831 return FALSE;
3832 }
3833
3834 if (strlen(val) >= pset->string.value_size) {
3836 _("String value too long (max length: %lu)."),
3837 (unsigned long) pset->string.value_size);
3838 return FALSE;
3839 }
3840
3841 return (!pset->string.validate
3842 || pset->string.validate(val, caller, reject_msg,
3844}
3845
3846/************************************************************************/
3850{
3852
3853 return pset->string.value;
3854}
3855
3856/************************************************************************/
3861{
3862 struct sf_cb_data *info = (struct sf_cb_data *)data;
3863 const struct sset_val_name *name;
3864
3865 name = info->set->enumerator.name(val);
3866
3867 if (info->compat && name != NULL) {
3868 const char *ret = setcompat_current_val_from_previous(info->set,
3869 name->support);
3870
3871 if (ret != NULL) {
3872 return ret;
3873 }
3874 }
3875
3876 return (NULL != name ? name->support : NULL);
3877}
3878
3879/************************************************************************/
3883const char *setting_enum_val(const struct setting *pset, int val, bool pretty)
3884{
3885 const struct sset_val_name *name;
3886
3887 fc_assert_ret_val(SST_ENUM == pset->stype, NULL);
3888 name = pset->enumerator.name(val);
3889 if (NULL == name) {
3890 return NULL;
3891 } else if (pretty) {
3892 return _(name->pretty);
3893 } else {
3894 return name->support;
3895 }
3896}
3897
3898/************************************************************************/
3902static const char *setting_enum_to_str(const struct setting *pset,
3903 int value, bool pretty,
3904 char *buf, size_t buf_len)
3905{
3906 const struct sset_val_name *name = pset->enumerator.name(value);
3907
3908 if (pretty) {
3909 fc_snprintf(buf, buf_len, "\"%s\" (%s)",
3910 Q_(name->pretty), name->support);
3911 } else {
3912 fc_strlcpy(buf, name->support, buf_len);
3913 }
3914 return buf;
3915}
3916
3917/************************************************************************/
3924static bool setting_enum_validate_base(const struct setting *pset,
3925 const char *val, int *pint_val,
3926 struct connection *caller,
3927 char *reject_msg,
3928 size_t reject_msg_len)
3929{
3930 char buf[256];
3931
3932 if (SST_ENUM != pset->stype) {
3934 _("This setting is not an enumerator."));
3935 return FALSE;
3936 }
3937
3938 sz_strlcpy(buf, val);
3940
3941 return (setting_match_prefix(pset->enumerator.name, buf, pint_val,
3943 && (NULL == pset->enumerator.validate
3944 || pset->enumerator.validate(*pint_val, caller, reject_msg,
3945 reject_msg_len)));
3946}
3947
3948/************************************************************************/
3951static bool set_enum_value(struct setting *pset, int val)
3952{
3953 switch (pset->enumerator.store_size) {
3954 case sizeof(int):
3955 {
3956 int *to_int = pset->enumerator.pvalue;
3957
3958 *to_int = val;
3959 }
3960 break;
3961 case sizeof(char):
3962 {
3963 char *to_char = pset->enumerator.pvalue;
3964
3965 *to_char = (char) val;
3966 }
3967 break;
3968 case sizeof(short):
3969 {
3970 short *to_short = pset->enumerator.pvalue;
3971
3972 *to_short = (short) val;
3973 }
3974 break;
3975 default:
3976 return FALSE;
3977 }
3978
3979 return TRUE;
3980}
3981
3982/************************************************************************/
3985int read_enum_value(const struct setting *pset)
3986{
3987 int val;
3988
3989 switch (pset->enumerator.store_size) {
3990 case sizeof(int):
3991 val = *((int *)pset->enumerator.pvalue);
3992 break;
3993 case sizeof(char):
3994 val = *((char *)pset->enumerator.pvalue);
3995 break;
3996 case sizeof(short):
3997 val = *((short *)pset->enumerator.pvalue);
3998 break;
3999 default:
4000 log_error("Illegal enum store size %d, can't read value", pset->enumerator.store_size);
4001 return 0;
4002 }
4003
4004 return val;
4005}
4006
4007/************************************************************************/
4012bool setting_enum_set(struct setting *pset, const char *val,
4013 struct connection *caller, char *reject_msg,
4014 size_t reject_msg_len)
4015{
4016 int int_val;
4017
4019 return FALSE;
4020 }
4021
4022 if (!setting_enum_validate_base(pset, val, &int_val, caller,
4024 return FALSE;
4025 }
4026
4027 if (!set_enum_value(pset, int_val)) {
4028 log_error("Illegal enumerator value size %d for %s",
4029 pset->enumerator.store_size, val);
4030 return FALSE;
4031 }
4032
4033 return TRUE;
4034}
4035
4036/************************************************************************/
4041bool setting_enum_validate(const struct setting *pset, const char *val,
4042 struct connection *caller, char *reject_msg,
4043 size_t reject_msg_len)
4044{
4045 int int_val;
4046
4047 return setting_enum_validate_base(pset, val, &int_val, caller,
4049}
4050
4051/************************************************************************/
4056{
4057 struct sf_cb_data *info = (struct sf_cb_data *)data;
4058 const struct sset_val_name *name = info->set->bitwise.name(bit);
4059
4060 if (info->compat && name == NULL) {
4061 if (!fc_strcasecmp("topology", setting_name(info->set))) {
4062 if ((1 << bit) == TF_OLD_WRAPX) {
4063 return "WrapX";
4064 }
4065 if ((1 << bit) == TF_OLD_WRAPY) {
4066 return "WrapY";
4067 }
4068 }
4069 }
4070
4071 return (NULL != name ? name->support : NULL);
4072}
4073
4074/************************************************************************/
4078const char *setting_bitwise_bit(const struct setting *pset,
4079 int bit, bool pretty)
4080{
4081 const struct sset_val_name *name;
4082
4084 name = pset->bitwise.name(bit);
4085 if (NULL == name) {
4086 return NULL;
4087 } else if (pretty) {
4088 return _(name->pretty);
4089 } else {
4090 return name->support;
4091 }
4092}
4093
4094/************************************************************************/
4097static const char *setting_bitwise_to_str(const struct setting *pset,
4098 unsigned value, bool pretty,
4099 char *buf, size_t buf_len)
4100{
4101 const struct sset_val_name *name;
4102 char *old_buf = buf;
4103 int bit;
4104
4105 if (pretty) {
4106 char buf2[256];
4107 struct astring astr = ASTRING_INIT;
4108 struct strvec *vec = strvec_new();
4109 size_t len;
4110
4111 for (bit = 0; (name = pset->bitwise.name(bit)); bit++) {
4112 if ((1 << bit) & value) {
4113 /* TRANS: only emphasizing a string. */
4114 fc_snprintf(buf2, sizeof(buf2), _("\"%s\""), Q_(name->pretty));
4116 }
4117 }
4118
4119 if (0 == strvec_size(vec)) {
4120 /* No value. */
4121 fc_assert(0 == value);
4122 /* TRANS: Bitwise setting has no bits set. */
4123 fc_strlcpy(buf, _("empty value"), buf_len);
4125 return buf;
4126 }
4127
4131 astr_free(&astr);
4132 fc_strlcat(buf, " (", buf_len);
4133 len = strlen(buf);
4134 buf += len;
4135 buf_len -= len;
4136 }
4137
4138 /* Long support part. */
4139 buf[0] = '\0';
4140 for (bit = 0; (name = pset->bitwise.name(bit)); bit++) {
4141 if ((1 << bit) & value) {
4142 if ('\0' != buf[0]) {
4143 fc_strlcat(buf, "|", buf_len);
4144 }
4145 fc_strlcat(buf, name->support, buf_len);
4146 }
4147 }
4148
4149 if (pretty) {
4150 fc_strlcat(buf, ")", buf_len);
4151 }
4152 return old_buf;
4153}
4154
4155/************************************************************************/
4163 const char *val,
4164 unsigned *pint_val,
4165 struct connection *caller,
4166 char *reject_msg,
4167 size_t reject_msg_len)
4168{
4169 char buf[256];
4170 const char *p;
4171 int bit;
4172
4173 if (SST_BITWISE != pset->stype) {
4175 _("This setting is not a bitwise."));
4176 return FALSE;
4177 }
4178
4179 *pint_val = 0;
4180
4181 /* Value names are separated by '|'. */
4182 do {
4183 p = strchr(val, '|');
4184 if (NULL != p) {
4185 p++;
4186 fc_strlcpy(buf, val, MIN(p - val, sizeof(buf)));
4187 } else {
4188 /* Last segment, full copy. */
4189 sz_strlcpy(buf, val);
4190 }
4192 if (NULL == p && '\0' == buf[0] && 0 == *pint_val) {
4193 /* Empty string = value 0. */
4194 break;
4195 } else if (!setting_match_prefix(pset->bitwise.name, buf, &bit,
4197 return FALSE;
4198 }
4199 *pint_val |= 1 << bit;
4200 val = p;
4201 } while (NULL != p);
4202
4203 return (NULL == pset->bitwise.validate
4204 || pset->bitwise.validate(*pint_val, caller,
4206}
4207
4208/************************************************************************/
4213bool setting_bitwise_set(struct setting *pset, const char *val,
4214 struct connection *caller, char *reject_msg,
4215 size_t reject_msg_len)
4216{
4217 unsigned int_val;
4218
4220 || !setting_bitwise_validate_base(pset, val, &int_val, caller,
4222 return FALSE;
4223 }
4224
4225 *pset->bitwise.pvalue = int_val;
4226 return TRUE;
4227}
4228
4229/************************************************************************/
4234bool setting_bitwise_validate(const struct setting *pset, const char *val,
4235 struct connection *caller, char *reject_msg,
4236 size_t reject_msg_len)
4237{
4238 unsigned int_val;
4239
4240 return setting_bitwise_validate_base(pset, val, &int_val, caller,
4242}
4243
4244/************************************************************************/
4248{
4250
4251 return *pset->bitwise.pvalue;
4252}
4253
4254/************************************************************************/
4257const char *setting_value_name(const struct setting *pset, bool pretty,
4258 char *buf, size_t buf_len)
4259{
4263
4264 switch (pset->stype) {
4265 case SST_BOOL:
4266 return setting_bool_to_str(pset, *pset->boolean.pvalue,
4267 pretty, buf, buf_len);
4268 case SST_INT:
4269 return setting_int_to_str(pset, *pset->integer.pvalue,
4270 pretty, buf, buf_len);
4271 case SST_STRING:
4272 return setting_str_to_str(pset, pset->string.value,
4273 pretty, buf, buf_len);
4274 case SST_ENUM:
4276 pretty, buf, buf_len);
4277 case SST_BITWISE:
4278 return setting_bitwise_to_str(pset, *pset->bitwise.pvalue,
4279 pretty, buf, buf_len);
4280 case SST_COUNT:
4281 /* Error logged below. */
4282 break;
4283 }
4284
4285 log_error("%s(): Setting \"%s\" (nb %d) not handled in switch statement.",
4287 return NULL;
4288}
4289
4290/************************************************************************/
4293const char *setting_default_name(const struct setting *pset, bool pretty,
4294 char *buf, size_t buf_len)
4295{
4299
4300 switch (pset->stype) {
4301 case SST_BOOL:
4302 return setting_bool_to_str(pset, pset->boolean.default_value,
4303 pretty, buf, buf_len);
4304 case SST_INT:
4305 return setting_int_to_str(pset, pset->integer.default_value,
4306 pretty, buf, buf_len);
4307 case SST_STRING:
4308 return setting_str_to_str(pset, pset->string.default_value,
4309 pretty, buf, buf_len);
4310 case SST_ENUM:
4311 return setting_enum_to_str(pset, pset->enumerator.default_value,
4312 pretty, buf, buf_len);
4313 case SST_BITWISE:
4314 return setting_bitwise_to_str(pset, pset->bitwise.default_value,
4315 pretty, buf, buf_len);
4316 case SST_COUNT:
4317 /* Error logged below. */
4318 break;
4319 }
4320
4321 log_error("%s(): Setting \"%s\" (nb %d) not handled in switch statement.",
4323 return NULL;
4324}
4325
4326/************************************************************************/
4330{
4331 switch (pset->stype) {
4332 case SST_BOOL:
4333 (*pset->boolean.pvalue) = pset->boolean.default_value;
4334 break;
4335 case SST_INT:
4336 (*pset->integer.pvalue) = pset->integer.default_value;
4337 break;
4338 case SST_STRING:
4339 fc_strlcpy(pset->string.value, pset->string.default_value,
4340 pset->string.value_size);
4341 break;
4342 case SST_ENUM:
4343 set_enum_value(pset, pset->enumerator.default_value);
4344 break;
4345 case SST_BITWISE:
4346 (*pset->bitwise.pvalue) = pset->bitwise.default_value;
4347 break;
4348 case SST_COUNT:
4349 fc_assert(pset->stype != SST_COUNT);
4350 break;
4351 }
4352
4353 pset->setdef = SETDEF_INTERNAL;
4354}
4355
4356/************************************************************************/
4359void setting_action(const struct setting *pset)
4360{
4361 if (pset->action != NULL) {
4362 pset->action(pset);
4363 }
4364}
4365
4366/************************************************************************/
4369bool settings_ruleset(struct section_file *file, const char *section,
4370 bool act, bool compat)
4371{
4372 const char *name;
4373 int j;
4374
4375 /* Unlock all settings. */
4378 if (pset->ruleset_settable && !setting_locked(pset)) {
4380 }
4382
4383 /* Settings */
4384 if (NULL == secfile_section_by_name(file, section)) {
4385 /* No settings in ruleset file */
4386 log_verbose("no [%s] section for game settings in %s", section,
4387 secfile_name(file));
4388 } else {
4390
4391 for (j = 0; (name = secfile_lookup_str_default(file, NULL, "%s.set%d.name",
4392 section, j)); j++) {
4393 char path[256];
4394
4396 /* Skip this setting for now; handle it later */
4398 continue;
4399 }
4400
4401 fc_snprintf(path, sizeof(path), "%s.set%d", section, j);
4402
4403 if (compat) {
4405 }
4406
4407 if (!setting_ruleset_one(file, name, path, compat)) {
4408 log_error("unknown unsettable setting in '%s': %s",
4409 secfile_name(file), name);
4410 }
4411 }
4412
4416 }
4417 }
4418
4419 /* Execute all setting actions to consider actions due to the
4420 * default values. */
4421 if (act) {
4423 if (pset->ruleset_settable) {
4425 }
4427 }
4428
4430
4431 /* send game settings */
4433
4434 return TRUE;
4435}
4436
4437/***********************************************************************/
4440static inline void setting_ruleset_setdef(struct setting *pset)
4441{
4442 pset->setdef = SETDEF_RULESET;
4443}
4444
4445/************************************************************************/
4448static bool setting_ruleset_one(struct section_file *file,
4449 const char *name, const char *path,
4450 bool compat)
4451{
4452 struct setting *pset = NULL;
4453 char reject_msg[256], buf[256];
4454 bool lock;
4455 struct sf_cb_data info = { pset, compat };
4456
4459 pset = pset_check;
4460 break;
4461 }
4463
4464 if (pset == NULL || !pset->ruleset_settable) {
4465 /* No setting found or it's not settable by ruleset */
4466 return FALSE;
4467 }
4468
4469 if (!setting_locked(pset)) {
4470 info.set = pset;
4471 info.compat = compat;
4472
4473 switch (pset->stype) {
4474 case SST_BOOL:
4475 {
4476 int ival;
4477 bool val;
4478
4479 /* Allow string with same boolean representation as accepted on
4480 * server command line */
4483 "%s.value", path)) {
4484 val = (ival != 0);
4485 } else if (!secfile_lookup_bool(file, &val, "%s.value", path)) {
4486 log_error("Can't read value for setting '%s': %s", name,
4487 secfile_error());
4488 break;
4489 }
4490 if (val != *pset->boolean.pvalue) {
4491 if (NULL == pset->boolean.validate
4492 || pset->boolean.validate(val, NULL, reject_msg,
4493 sizeof(reject_msg))) {
4494 *pset->boolean.pvalue = val;
4495 log_normal(_("Ruleset: '%s' has been set to %s."),
4497 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4498 } else {
4499 log_error("%s", reject_msg);
4500 }
4501 }
4502 }
4503 break;
4504
4505 case SST_INT:
4506 {
4507 int val;
4508
4509 if (!secfile_lookup_int(file, &val, "%s.value", path)) {
4510 log_error("Can't read value for setting '%s': %s", name,
4511 secfile_error());
4512 } else if (val != *pset->integer.pvalue) {
4514 sizeof(reject_msg))) {
4515 log_normal(_("Ruleset: '%s' has been set to %s."),
4517 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4518 } else {
4519 log_error("%s", reject_msg);
4520 }
4521 }
4522 }
4523 break;
4524
4525 case SST_STRING:
4526 {
4527 const char *val = secfile_lookup_str(file, "%s.value", path);
4528
4529 if (NULL == val) {
4530 log_error("Can't read value for setting '%s': %s", name,
4531 secfile_error());
4532 } else if (0 != strcmp(val, pset->string.value)) {
4534 sizeof(reject_msg))) {
4535 log_normal(_("Ruleset: '%s' has been set to %s."),
4537 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4538 } else {
4539 log_error("%s", reject_msg);
4540 }
4541 }
4542 }
4543 break;
4544
4545 case SST_ENUM:
4546 {
4547 int val;
4548
4549 if (!secfile_lookup_enum_data(file, &val, FALSE,
4551 "%s.value", path)) {
4552 log_error("Can't read value for setting '%s': %s",
4553 name, secfile_error());
4554 } else if (val != read_enum_value(pset)) {
4555 if (NULL == pset->enumerator.validate
4556 || pset->enumerator.validate(val, NULL, reject_msg,
4557 sizeof(reject_msg))) {
4558 set_enum_value(pset, val);
4559 log_normal(_("Ruleset: '%s' has been set to %s."),
4561 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4562 } else {
4563 log_error("%s", reject_msg);
4564 }
4565 }
4566 }
4567 break;
4568
4569 case SST_BITWISE:
4570 {
4571 int val;
4572
4573 if (!secfile_lookup_enum_data(file, &val, TRUE,
4575 "%s.value", path)) {
4576 log_error("Can't read value for setting '%s': %s",
4577 name, secfile_error());
4578 } else if (val != *pset->bitwise.pvalue) {
4579 /* RSFORMAT_3_1 */
4580 if (compat && !fc_strcasecmp("topology", name)) {
4581 struct setting *wrap = setting_by_name("wrap");
4582
4583 if (val & TF_OLD_WRAPX) {
4584 if (val & TF_OLD_WRAPY) {
4585 setting_bitwise_set(wrap, "WrapX|WrapY", NULL, NULL, 0);
4586 } else {
4587 setting_bitwise_set(wrap, "WrapX", NULL, NULL, 0);
4588 }
4589 } else if (val & TF_OLD_WRAPY) {
4590 setting_bitwise_set(wrap, "WrapY", NULL, NULL, 0);
4591 } else {
4593 }
4594
4595 val &= ~(TF_OLD_WRAPX | TF_OLD_WRAPY);
4596
4597 log_normal(_("Ruleset: '%s' has been set to %s."),
4599 setting_value_name(wrap, TRUE, buf, sizeof(buf)));
4600 }
4601
4602 if (NULL == pset->bitwise.validate
4603 || pset->bitwise.validate((unsigned) val, NULL,
4604 reject_msg, sizeof(reject_msg))) {
4605 *pset->bitwise.pvalue = val;
4606 log_normal(_("Ruleset: '%s' has been set to %s."),
4608 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4609 } else {
4610 log_error("%s", reject_msg);
4611 }
4612 }
4613 }
4614 break;
4615
4616 case SST_COUNT:
4617 fc_assert(pset->stype != SST_COUNT);
4618 break;
4619 }
4620
4622 }
4623
4624 /* set lock */
4625 lock = secfile_lookup_bool_default(file, FALSE, "%s.lock", path);
4626
4627 if (lock) {
4628 /* Set lock */
4630 log_normal(_("Ruleset: '%s' has been locked by the ruleset."),
4632 }
4633
4634 return TRUE;
4635}
4636
4637/************************************************************************/
4641{
4642 switch (setting_type(pset)) {
4643 case SST_BOOL:
4644 return (*pset->boolean.pvalue != pset->boolean.default_value);
4645 case SST_INT:
4646 return (*pset->integer.pvalue != pset->integer.default_value);
4647 case SST_STRING:
4648 return (0 != strcmp(pset->string.value, pset->string.default_value));
4649 case SST_ENUM:
4650 return (read_enum_value(pset) != pset->enumerator.default_value);
4651 case SST_BITWISE:
4652 return (*pset->bitwise.pvalue != pset->bitwise.default_value);
4653 case SST_COUNT:
4654 /* Error logged below. */
4655 break;
4656 }
4657
4658 log_error("%s(): Setting \"%s\" (nb %d) not handled in switch statement.",
4660 return FALSE;
4661}
4662
4663/************************************************************************/
4666bool setting_locked(const struct setting *pset)
4667{
4668 return pset->lock != SLOCK_NONE;
4669}
4670
4671/************************************************************************/
4675{
4676 return pset->rslock;
4677}
4678
4679/************************************************************************/
4683{
4684 if (pset->lock < SLOCK_RULESET) {
4685 /* No downgrading the lock */
4686 pset->lock = SLOCK_RULESET;
4687 }
4688 pset->rslock = TRUE;
4689}
4690
4691/************************************************************************/
4695{
4696 pset->lock = SLOCK_ADMIN;
4697}
4698
4699/************************************************************************/
4703{
4704 if (pset->lock == SLOCK_RULESET) {
4705 /* No clearing upper level locks */
4706 pset->lock = SLOCK_RULESET;
4707 }
4708 pset->rslock = FALSE;
4709}
4710
4711/************************************************************************/
4715{
4716 if (pset->rslock) {
4717 pset->lock = SLOCK_RULESET;
4718 } else {
4719 pset->lock = SLOCK_NONE;
4720 }
4721}
4722
4723/************************************************************************/
4726static void setting_game_set(struct setting *pset, bool init)
4727{
4728 switch (setting_type(pset)) {
4729 case SST_BOOL:
4730 pset->boolean.game_value = *pset->boolean.pvalue;
4731 break;
4732
4733 case SST_INT:
4734 pset->integer.game_value = *pset->integer.pvalue;
4735 break;
4736
4737 case SST_STRING:
4738 if (init) {
4739 pset->string.game_value
4740 = fc_calloc(1, pset->string.value_size
4741 * sizeof(pset->string.game_value));
4742 }
4743 fc_strlcpy(pset->string.game_value, pset->string.value,
4744 pset->string.value_size);
4745 break;
4746
4747 case SST_ENUM:
4748 pset->enumerator.game_value = read_enum_value(pset);
4749 break;
4750
4751 case SST_BITWISE:
4752 pset->bitwise.game_value = *pset->bitwise.pvalue;
4753 break;
4754
4755 case SST_COUNT:
4757 break;
4758 }
4759
4760 pset->game_setdef = pset->setdef;
4761}
4762
4763/************************************************************************/
4766static void setting_game_free(struct setting *pset)
4767{
4768 if (setting_type(pset) == SST_STRING) {
4769 FC_FREE(pset->string.game_value);
4770 }
4771}
4772
4773/************************************************************************/
4777{
4778 char reject_msg[256] = "", buf[256];
4779 bool res = FALSE;
4780
4782 log_debug("Can't restore '%s': %s", setting_name(pset),
4783 reject_msg);
4784 return;
4785 }
4786
4787 if (pset->game_setdef == SETDEF_INTERNAL) {
4789 return;
4790 }
4791
4792 switch (setting_type(pset)) {
4793 case SST_BOOL:
4794 res = (NULL != setting_bool_to_str(pset, pset->boolean.game_value,
4795 FALSE, buf, sizeof(buf))
4797 sizeof(reject_msg)));
4798 break;
4799
4800 case SST_INT:
4801 res = setting_int_set(pset, pset->integer.game_value, NULL, reject_msg,
4802 sizeof(reject_msg));
4803 break;
4804
4805 case SST_STRING:
4806 res = setting_str_set(pset, pset->string.game_value, NULL, reject_msg,
4807 sizeof(reject_msg));
4808 break;
4809
4810 case SST_ENUM:
4811 res = (NULL != setting_enum_to_str(pset, pset->enumerator.game_value,
4812 FALSE, buf, sizeof(buf))
4814 sizeof(reject_msg)));
4815 break;
4816
4817 case SST_BITWISE:
4818 res = (NULL != setting_bitwise_to_str(pset, pset->bitwise.game_value,
4819 FALSE, buf, sizeof(buf))
4821 sizeof(reject_msg)));
4822 break;
4823
4824 case SST_COUNT:
4825 res = FALSE;
4826 break;
4827 }
4828
4829 if (!res) {
4830 log_error("Error restoring setting '%s' to the value from game start: "
4831 "%s", setting_name(pset), reject_msg);
4832 }
4833}
4834
4835/************************************************************************/
4839{
4843
4844 /* Settings from the start of the game are saved. */
4846}
4847
4848/************************************************************************/
4851void settings_game_save(struct section_file *file, const char *section)
4852{
4853 int set_count = 0;
4854
4856 char errbuf[200];
4857 struct sf_cb_data info = { pset, FALSE };
4858
4859 if (/* It's explicitly set to some value to save */
4861 /* It must be same at loading time as it was saving time, even if
4862 * freeciv's default has changed. */
4865
4867 "%s.set%d.name", section, set_count);
4868 switch (setting_type(pset)) {
4869 case SST_BOOL:
4870 secfile_insert_bool(file, *pset->boolean.pvalue,
4871 "%s.set%d.value", section, set_count);
4872 if (gamestart) {
4873 secfile_insert_bool(file, pset->boolean.game_value,
4874 "%s.set%d.gamestart", section, set_count);
4875 }
4876 break;
4877 case SST_INT:
4878 secfile_insert_int(file, *pset->integer.pvalue,
4879 "%s.set%d.value", section, set_count);
4880 if (gamestart) {
4881 secfile_insert_int(file, pset->integer.game_value,
4882 "%s.set%d.gamestart", section, set_count);
4883 }
4884 break;
4885 case SST_STRING:
4886 secfile_insert_str(file, pset->string.value,
4887 "%s.set%d.value", section, set_count);
4888 if (gamestart) {
4889 secfile_insert_str(file, pset->string.game_value,
4890 "%s.set%d.gamestart", section, set_count);
4891 }
4892 break;
4893 case SST_ENUM:
4896 "%s.set%d.value", section, set_count);
4897 if (gamestart) {
4898 secfile_insert_enum_data(file, pset->enumerator.game_value, FALSE,
4900 "%s.set%d.gamestart", section, set_count);
4901 }
4902 break;
4903 case SST_BITWISE:
4904 secfile_insert_enum_data(file, *pset->bitwise.pvalue, TRUE,
4906 "%s.set%d.value", section, set_count);
4907 if (gamestart) {
4908 secfile_insert_enum_data(file, pset->bitwise.game_value, TRUE,
4910 "%s.set%d.gamestart", section, set_count);
4911 }
4912 break;
4913 case SST_COUNT:
4915 secfile_insert_str(file, "Unknown setting type",
4916 "%s.set%d.value", section, set_count);
4917 if (gamestart) {
4918 secfile_insert_str(file, "Unknown setting type",
4919 "%s.set%d.gamestart", section, set_count);
4920 }
4921 break;
4922 }
4923 if (gamestart) {
4925 "%s.set%d.gamesetdef", section, set_count);
4926 }
4927 set_count++;
4928 }
4930
4931 secfile_insert_int(file, set_count, "%s.set_count", section);
4933 "%s.gamestart_valid", section);
4934}
4935
4936/************************************************************************/
4939void settings_game_load(struct section_file *file, const char *section)
4940{
4941 const char *name;
4942 char reject_msg[256], buf[256];
4943 int i, set_count;
4944 int oldcitymindist = game.info.citymindist; /* backwards compat, see below */
4945
4946 /* Compatibility with savegames created with older versions is usually
4947 * handled as conversions in savecompat.c compat_load_<version>() */
4948
4949 if (!secfile_lookup_int(file, &set_count, "%s.set_count", section)) {
4950 /* Old savegames and scenarios doesn't contain this, not an error. */
4951 log_verbose("Can't read the number of settings in the save file.");
4952 return;
4953 }
4954
4955 /* Check if the saved settings are valid settings from game start. */
4957 = secfile_lookup_bool_default(file, FALSE, "%s.gamestart_valid",
4958 section);
4959
4960 for (i = 0; i < set_count; i++) {
4961 name = secfile_lookup_str(file, "%s.set%d.name", section, i);
4962
4964 struct sf_cb_data info = { pset, FALSE };
4965
4966 if (fc_strcasecmp(setting_name(pset), name) != 0) {
4967 continue;
4968 }
4969
4970 /* Load the current value of the setting. */
4971 switch (pset->stype) {
4972 case SST_BOOL:
4973 {
4974 bool val;
4975
4976 if (!secfile_lookup_bool(file, &val, "%s.set%d.value", section,
4977 i)) {
4978 log_verbose("Option '%s' not defined in the savegame: %s", name,
4979 secfile_error());
4980 } else {
4981 pset->setdef = SETDEF_CHANGED;
4982
4983 if (val != *pset->boolean.pvalue) {
4985 sizeof(reject_msg))
4986 && (NULL == pset->boolean.validate
4987 || pset->boolean.validate(val, NULL, reject_msg,
4988 sizeof(reject_msg)))) {
4989 *pset->boolean.pvalue = val;
4990 log_normal(_("Savegame: '%s' has been set to %s."),
4992 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4993 } else {
4994 log_error("Savegame: error restoring '%s' . (%s)",
4996 }
4997 } else {
4998 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
5000 }
5001 }
5002 }
5003 break;
5004
5005 case SST_INT:
5006 {
5007 int val;
5008
5009 if (!secfile_lookup_int(file, &val, "%s.set%d.value", section, i)) {
5010 log_verbose("Option '%s' not defined in the savegame: %s", name,
5011 secfile_error());
5012 } else {
5013 pset->setdef = SETDEF_CHANGED;
5014
5015 if (val != *pset->integer.pvalue) {
5017 sizeof(reject_msg))
5018 && (NULL == pset->integer.validate
5019 || pset->integer.validate(val, NULL, reject_msg,
5020 sizeof(reject_msg)))) {
5021 *pset->integer.pvalue = val;
5022 log_normal(_("Savegame: '%s' has been set to %s."),
5024 setting_value_name(pset, TRUE, buf, sizeof(buf)));
5025 } else {
5026 log_error("Savegame: error restoring '%s' . (%s)",
5028 }
5029 } else {
5030 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
5032 }
5033 }
5034 }
5035 break;
5036
5037 case SST_STRING:
5038 {
5039 const char *val = secfile_lookup_str(file, "%s.set%d.value",
5040 section, i);
5041
5042 if (NULL == val) {
5043 log_verbose("Option '%s' not defined in the savegame: %s", name,
5044 secfile_error());
5045 } else {
5046 pset->setdef = SETDEF_CHANGED;
5047
5048 if (0 != strcmp(val, pset->string.value)) {
5050 sizeof(reject_msg))) {
5051 log_normal(_("Savegame: '%s' has been set to %s."),
5053 setting_value_name(pset, TRUE, buf, sizeof(buf)));
5054 } else {
5055 log_error("Savegame: error restoring '%s' . (%s)",
5057 }
5058 } else {
5059 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
5061 }
5062 }
5063 }
5064 break;
5065
5066 case SST_ENUM:
5067 {
5068 int val;
5069
5070 if (!secfile_lookup_enum_data(file, &val, FALSE,
5072 "%s.set%d.value", section, i)) {
5073 log_verbose("Option '%s' not defined in the savegame: %s", name,
5074 secfile_error());
5075 } else {
5076 pset->setdef = SETDEF_CHANGED;
5077
5078 if (val != read_enum_value(pset)) {
5080 sizeof(reject_msg))
5081 && (NULL == pset->enumerator.validate
5082 || pset->enumerator.validate(val, NULL, reject_msg,
5083 sizeof(reject_msg)))) {
5084 set_enum_value(pset, val);
5085 log_normal(_("Savegame: '%s' has been set to %s."),
5087 setting_value_name(pset, TRUE, buf, sizeof(buf)));
5088 } else {
5089 log_error("Savegame: error restoring '%s' . (%s)",
5091 }
5092 } else {
5093 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
5095 }
5096 }
5097 }
5098 break;
5099
5100 case SST_BITWISE:
5101 {
5102 int val;
5103
5104 if (!secfile_lookup_enum_data(file, &val, TRUE,
5106 "%s.set%d.value", section, i)) {
5107 log_verbose("Option '%s' not defined in the savegame: %s", name,
5108 secfile_error());
5109 } else {
5110 pset->setdef = SETDEF_CHANGED;
5111
5112 if (val != *pset->bitwise.pvalue) {
5114 sizeof(reject_msg))
5115 && (NULL == pset->bitwise.validate
5116 || pset->bitwise.validate(val, NULL, reject_msg,
5117 sizeof(reject_msg)))) {
5118 *pset->bitwise.pvalue = val;
5119 log_normal(_("Savegame: '%s' has been set to %s."),
5121 setting_value_name(pset, TRUE, buf, sizeof(buf)));
5122 } else {
5123 log_error("Savegame: error restoring '%s' . (%s)",
5125 }
5126 } else {
5127 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
5129 }
5130 }
5131 }
5132 break;
5133
5134 case SST_COUNT:
5135 fc_assert(pset->stype != SST_COUNT);
5136 break;
5137 }
5138
5140 const char *sdname;
5141
5142 /* Load the value of the setting at the start of the game. */
5143 switch (pset->stype) {
5144 case SST_BOOL:
5145 pset->boolean.game_value =
5146 secfile_lookup_bool_default(file, *pset->boolean.pvalue,
5147 "%s.set%d.gamestart", section, i);
5148 break;
5149
5150 case SST_INT:
5151 pset->integer.game_value =
5152 secfile_lookup_int_default(file, *pset->integer.pvalue,
5153 "%s.set%d.gamestart", section, i);
5154 break;
5155
5156 case SST_STRING:
5157 fc_strlcpy(pset->string.game_value,
5158 secfile_lookup_str_default(file, pset->string.value,
5159 "%s.set%d.gamestart",
5160 section, i),
5161 pset->string.value_size);
5162 break;
5163
5164 case SST_ENUM:
5165 pset->enumerator.game_value =
5168 &info, "%s.set%d.gamestart", section, i);
5169 break;
5170
5171 case SST_BITWISE:
5172 pset->bitwise.game_value =
5174 *pset->bitwise.pvalue, TRUE, setting_bitwise_secfile_str,
5175 &info, "%s.set%d.gamestart", section, i);
5176 break;
5177
5178 case SST_COUNT:
5179 fc_assert(pset->stype != SST_COUNT);
5180 break;
5181 }
5182
5183 sdname
5186 "%s.set%d.gamesetdef", section, i);
5189
5190 if (!setting_default_level_is_valid(pset->game_setdef)) {
5191 log_error("Setting %s has invalid gamesetdef value %s",
5193 pset->game_setdef = SETDEF_CHANGED;
5194 }
5195 } else {
5196 pset->game_setdef = SETDEF_CHANGED;
5197 }
5199 }
5200
5201 /* Backwards compatibility for pre-2.4 savegames: citymindist=0 used to mean
5202 * take from ruleset min_dist_bw_cities, but that no longer exists.
5203 * This is here rather than in savegame2.c compat functions, as we need
5204 * to have loaded the relevant ruleset to know what to set it to (the
5205 * ruleset and any 'citymindist' setting it contains will have been loaded
5206 * before this function was called). */
5207 if (game.info.citymindist == 0) {
5209 }
5210
5212 /* Have to do this at the end due to dependencies ('aifill' and
5213 * 'maxplayer'). */
5216}
5217
5218/************************************************************************/
5222{
5224 log_debug("No saved settings from the game start available.");
5225 return FALSE;
5226 }
5227
5231
5232 return TRUE;
5233}
5234
5235/************************************************************************/
5254
5255/************************************************************************/
5267
5268/************************************************************************/
5273{
5274 /* Nothing at the moment. */
5275}
5276
5277/************************************************************************/
5288
5289/************************************************************************/
5293{
5294 return SETTINGS_NUM;
5295}
5296
5297/************************************************************************/
5301void send_server_setting(struct conn_list *dest, const struct setting *pset)
5302{
5303 if (!dest) {
5304 dest = game.est_connections;
5305 }
5306
5307#define PACKET_COMMON_INIT(packet, pset, pconn) \
5308 memset(&packet, 0, sizeof(packet)); \
5309 packet.id = setting_number(pset); \
5310 packet.is_visible = setting_is_visible(pset, pconn); \
5311 packet.is_changeable = setting_is_changeable(pset, pconn, NULL, 0); \
5312 packet.initial_setting = game.info.is_new_game; \
5313 packet.setdef = setting_get_setdef(pset);
5314
5315 switch (setting_type(pset)) {
5316 case SST_BOOL:
5317 {
5318 struct packet_server_setting_bool packet;
5319
5320 conn_list_iterate(dest, pconn) {
5321 PACKET_COMMON_INIT(packet, pset, pconn);
5322 if (packet.is_visible) {
5323 packet.val = *pset->boolean.pvalue;
5324 packet.default_val = pset->boolean.default_value;
5325 }
5328 }
5329 break;
5330 case SST_INT:
5331 {
5332 struct packet_server_setting_int packet;
5333
5334 conn_list_iterate(dest, pconn) {
5335 PACKET_COMMON_INIT(packet, pset, pconn);
5336 if (packet.is_visible) {
5337 packet.val = *pset->integer.pvalue;
5338 packet.default_val = pset->integer.default_value;
5339 packet.min_val = pset->integer.min_value;
5340 packet.max_val = pset->integer.max_value;
5341 }
5344 }
5345 break;
5346 case SST_STRING:
5347 {
5348 struct packet_server_setting_str packet;
5349
5350 conn_list_iterate(dest, pconn) {
5351 PACKET_COMMON_INIT(packet, pset, pconn);
5352 if (packet.is_visible) {
5353 sz_strlcpy(packet.val, pset->string.value);
5354 sz_strlcpy(packet.default_val, pset->string.default_value);
5355 }
5358 }
5359 break;
5360 case SST_ENUM:
5361 {
5362 struct packet_server_setting_enum packet;
5363 const struct sset_val_name *val_name;
5364 int i;
5365
5366 conn_list_iterate(dest, pconn) {
5367 PACKET_COMMON_INIT(packet, pset, pconn);
5368 if (packet.is_visible) {
5369 packet.val = read_enum_value(pset);
5370 packet.default_val = pset->enumerator.default_value;
5371 for (i = 0; (val_name = pset->enumerator.name(i)); i++) {
5372 sz_strlcpy(packet.support_names[i], val_name->support);
5373 /* Send untranslated string */
5374 sz_strlcpy(packet.pretty_names[i], val_name->pretty);
5375 }
5376 packet.values_num = i;
5377 fc_assert(i <= ARRAY_SIZE(packet.support_names));
5378 fc_assert(i <= ARRAY_SIZE(packet.pretty_names));
5379 }
5382 }
5383 break;
5384 case SST_BITWISE:
5385 {
5386 struct packet_server_setting_bitwise packet;
5387 const struct sset_val_name *val_name;
5388 int i;
5389
5390 conn_list_iterate(dest, pconn) {
5391 PACKET_COMMON_INIT(packet, pset, pconn);
5392 if (packet.is_visible) {
5393 packet.val = *pset->bitwise.pvalue;
5394 packet.default_val = pset->bitwise.default_value;
5395 for (i = 0; (val_name = pset->bitwise.name(i)); i++) {
5396 sz_strlcpy(packet.support_names[i], val_name->support);
5397 /* Send untranslated string */
5398 sz_strlcpy(packet.pretty_names[i], val_name->pretty);
5399 }
5400 packet.bits_num = i;
5401 fc_assert(i <= ARRAY_SIZE(packet.support_names));
5402 fc_assert(i <= ARRAY_SIZE(packet.pretty_names));
5403 }
5406 }
5407 break;
5408
5409 case SST_COUNT:
5411 break;
5412 }
5413
5414#undef PACKET_INIT
5415}
5416
5417/************************************************************************/
5426
5427/************************************************************************/
5433 enum cmdlevel old_level,
5434 enum cmdlevel new_level)
5435{
5436 enum cmdlevel min_level;
5437 enum cmdlevel max_level;
5438
5439 if (old_level == new_level) {
5440 return;
5441 }
5442
5443 if (old_level < new_level) {
5446 } else {
5449 }
5450
5452 if ((pset->access_level_read >= min_level
5453 && pset->access_level_read <= max_level)
5454 || (pset->access_level_write >= min_level
5455 && pset->access_level_write <= max_level)) {
5457 }
5459}
5460
5461/************************************************************************/
5465{
5466 struct packet_server_setting_control control;
5468 int i;
5469
5470 control.settings_num = SETTINGS_NUM;
5471
5472 /* Fill in the category strings. */
5475 for (i = 0; i < SSET_NUM_CATEGORIES; i++) {
5476 /* Send untranslated name */
5478 }
5479
5480 /* Send off the control packet. */
5482
5483 pconn->server.settings_sent = TRUE;
5484
5485 /* Send the constant and common part of the settings. */
5489 /* Send untranslated strings to client */
5492 setting.category = pset->scategory;
5493
5496}
5497
5498/************************************************************************/
5501static void settings_list_init(void)
5502{
5503 struct setting *pset;
5504 int i;
5505
5507
5508 /* Do it for all values of enum sset_level. */
5509 for (i = 0; i < OLEVELS_NUM; i++) {
5511 }
5512
5513 for (i = 0; (pset = setting_by_number(i)); i++) {
5514 /* Add the setting to the list of all settings. */
5516
5517 switch (setting_level(pset)) {
5518 case SSET_NONE:
5519 /* No setting should be in this level. */
5521 "No setting level defined for '%s'.", setting_name(pset));
5522 break;
5523 case SSET_ALL:
5524 /* Done above - list of all settings. */
5525 break;
5526 case SSET_VITAL:
5528 break;
5529 case SSET_SITUATIONAL:
5531 break;
5532 case SSET_RARE:
5534 break;
5535 case SSET_CHANGED:
5536 case SSET_LOCKED:
5537 /* This is done in settings_list_update. */
5538 break;
5539 case OLEVELS_NUM:
5540 /* No setting should be in this level. */
5542 "Invalid setting level for '%s' (%s).",
5544 break;
5545 }
5546 }
5547
5548 /* Sort the lists. */
5549 for (i = 0; i < OLEVELS_NUM; i++) {
5551 }
5552
5553 setting_sorted.init = TRUE;
5554}
5555
5556/************************************************************************/
5560{
5561 struct setting *pset;
5562 int i;
5563
5565
5566 /* Clear the lists for changed and locked values. */
5569
5570 /* Refill them. */
5571 for (i = 0; (pset = setting_by_number(i)); i++) {
5574 }
5575 if (setting_locked(pset)) {
5577 }
5578 }
5579
5580 /* Sort them. */
5583}
5584
5585/************************************************************************/
5588int settings_list_cmp(const struct setting *const *ppset1,
5589 const struct setting *const *ppset2)
5590{
5591 const struct setting *pset1 = *ppset1;
5592 const struct setting *pset2 = *ppset2;
5593
5595}
5596
5597/************************************************************************/
5609
5610/************************************************************************/
5613static void settings_list_free(void)
5614{
5615 int i;
5616
5618
5619 /* Free the lists. */
5620 for (i = 0; i < OLEVELS_NUM; i++) {
5622 }
5623
5624 setting_sorted.init = FALSE;
5625}
5626
5627/************************************************************************/
5631{
5632 pset->setdef = SETDEF_CHANGED;
5633}
5634
5635/************************************************************************/
5639{
5640 return pset->setdef;
5641}
struct ai_type * ai_type_by_name(const char *search)
Definition ai.c:290
bool set_default_ai_type_name(const char *name)
Definition aiiface.c:275
void astr_free(struct astring *astr)
Definition astring.c:153
const char * astr_build_and_list(struct astring *astr, const char *const *items, size_t number)
Definition astring.c:367
static const char * astr_str(const struct astring *astr) fc__attribute((nonnull(1)))
Definition astring.h:93
#define ASTRING_INIT
Definition astring.h:44
#define BV_ISSET(bv, bit)
Definition bitvector.h:78
char * incite_cost
Definition comments.c:74
#define conn_list_iterate(connlist, pconn)
Definition connection.h:108
#define conn_list_iterate_end
Definition connection.h:110
@ TDM_FIXED
Definition fc_types.h:1045
@ TDM_EVEN
Definition fc_types.h:1046
@ DIPLO_NO_MIXED
Definition fc_types.h:1055
@ DIPLO_FOR_TEAMS
Definition fc_types.h:1056
@ DIPLO_NO_AIS
Definition fc_types.h:1054
@ DIPLO_FOR_HUMANS
Definition fc_types.h:1052
@ DIPLO_FOR_ALL
Definition fc_types.h:1051
@ DIPLO_FOR_AIS
Definition fc_types.h:1053
@ DIPLO_DISABLED
Definition fc_types.h:1057
@ REVOLEN_RANDOM
Definition fc_types.h:1285
@ REVOLEN_RANDQUICK
Definition fc_types.h:1287
@ REVOLEN_FIXED
Definition fc_types.h:1284
@ REVOLEN_QUICKENING
Definition fc_types.h:1286
int Unit_Class_id
Definition fc_types.h:421
@ HB_ALLIANCE
Definition fc_types.h:1293
@ HB_DISABLED
Definition fc_types.h:1291
@ HB_NATIONAL
Definition fc_types.h:1292
@ VC_SPACERACE
Definition fc_types.h:1272
@ VC_CULTURE
Definition fc_types.h:1274
@ VC_ALLIED
Definition fc_types.h:1273
@ BORDERS_ENABLED
Definition fc_types.h:1039
@ BORDERS_DISABLED
Definition fc_types.h:1038
@ BORDERS_SEE_INSIDE
Definition fc_types.h:1040
@ BORDERS_EXPAND
Definition fc_types.h:1041
#define Q_(String)
Definition fcintl.h:70
#define _(String)
Definition fcintl.h:67
#define N_(String)
Definition fcintl.h:69
const struct ft_color ftc_server
struct civ_game game
Definition game.c:62
struct world wld
Definition game.c:63
int generate_save_name(const char *format, char *buf, int buflen, const char *reason)
Definition game.c:789
#define GAME_MIN_TOP_CITIES_COUNT
Definition game.h:698
#define GAME_DEFAULT_TECHPENALTY
Definition game.h:550
#define GAME_MAX_RAPTUREDELAY
Definition game.h:502
#define GAME_DEFAULT_START_CITY
Definition game.h:379
#define GAME_DEFAULT_SKILL_LEVEL
Definition game.h:693
#define GAME_DEFAULT_KILLSTACK
Definition game.h:543
@ 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
#define GAME_DEFAULT_INFRA
Definition game.h:374
#define GAME_MAX_DIPLCHANCE
Definition game.h:461
#define GAME_MAX_SCIENCEBOX
Definition game.h:419
#define GAME_MAX_EVENT_CACHE_MAX_SIZE
Definition game.h:710
#define GAME_DEFAULT_REVOLENTYPE
Definition game.h:734
#define GAME_DEFAULT_AUTO_AI_TOGGLE
Definition game.h:589
#define GAME_MIN_RAZECHANCE
Definition game.h:566
#define GAME_MIN_GLOBAL_WARMING_PERCENT
Definition game.h:444
#define GAME_DEFAULT_CARAVAN_BONUS_STYLE
Definition game.h:649
#define GAME_MIN_SEED
Definition game.h:367
#define GAME_MAX_TECHLOSSFG
Definition game.h:473
#define GAME_DEFAULT_TCPTIMEOUT
Definition game.h:615
#define GAME_MAX_INFRA
Definition game.h:376
#define GAME_DEFAULT_EVENT_CACHE_INFO
Definition game.h:714
#define GAME_DEFAULT_MGR_FOODNEEDED
Definition game.h:522
#define GAME_DEFAULT_TECHLOST_DONOR
Definition game.h:558
#define GAME_DEFAULT_ALLOWED_CITY_NAMES
Definition game.h:730
#define GAME_MIN_TRADEWORLDRELPCT
Definition game.h:638
#define GAME_DEFAULT_SCORELOG
Definition game.h:571
#define GAME_MAX_KILLUNHOMED
Definition game.h:548
#define GAME_MIN_TECHLOST_RECV
Definition game.h:555
#define GAME_MIN_FREECOST
Definition game.h:464
#define GAME_MAX_CONTACTTURNS
Definition game.h:496
#define GAME_MAX_TECHLOST_RECV
Definition game.h:556
#define GAME_DEFAULT_OCCUPYCHANCE
Definition game.h:663
#define GAME_DEFAULT_USER_META_MESSAGE
Definition game.h:691
#define GAME_MAX_FOODBOX
Definition game.h:411
#define GAME_DEFAULT_GLOBAL_WARMING_PERCENT
Definition game.h:443
#define GAME_DEFAULT_TRADING_TECH
Definition game.h:645
#define GAME_MIN_SCIENCEBOX
Definition game.h:418
#define GAME_MAX_PINGTIMEOUT
Definition game.h:629
#define GAME_MAX_SAVEFREQUENCY
Definition game.h:681
#define GAME_MIN_REVOLUTION_LENGTH
Definition game.h:736
#define GAME_MAX_MGR_TURNINTERVAL
Definition game.h:520
#define GAME_DEFAULT_SAVETURNS
Definition game.h:676
#define GAME_DEFAULT_IPHIDE
Definition game.h:631
#define GAME_DEFAULT_BORDERS
Definition game.h:453
#define GAME_DEFAULT_AIRLIFTINGSTYLE
Definition game.h:741
#define GAME_DEFAULT_SPACESHIP_TRAVEL_PCT
Definition game.h:583
#define GAME_MAX_CONQUERCOST
Definition game.h:469
#define GAME_MAX_TOP_CITIES_COUNT
Definition game.h:699
#define GAME_DEFAULT_TOP_CITIES_COUNT
Definition game.h:697
#define GAME_MAX_AQUEDUCTLOSS
Definition game.h:541
#define GAME_DEFAULT_KILLUNHOMED
Definition game.h:546
#define GAME_DEFAULT_SCIENCEBOX
Definition game.h:417
#define GAME_MIN_DIPLGOLDCOST
Definition game.h:426
#define GAME_DEFAULT_MGR_WORLDCHANCE
Definition game.h:535
#define GAME_MIN_PINGTIME
Definition game.h:624
#define GAME_DEFAULT_ONSETBARBARIAN
Definition game.h:659
#define GAME_MIN_ONSETBARBARIAN
Definition game.h:660
#define GAME_MAX_TECHLOSSREST
Definition game.h:477
#define GAME_DEFAULT_KILLCITIZEN
Definition game.h:544
#define GAME_MIN_INCITE_GOLD_LOSS_CHANCE
Definition game.h:430
#define GAME_MIN_MGR_NATIONCHANCE
Definition game.h:532
#define GAME_MAX_COMPRESS_LEVEL
Definition game.h:718
#define GAME_DEFAULT_NATIONSET
Definition game.h:407
#define GAME_DEFAULT_SHIELDBOX
Definition game.h:413
#define GAME_MIN_NOTRADESIZE
Definition game.h:634
#define GAME_MIN_GOLD
Definition game.h:371
#define GAME_MAX_OCCUPYCHANCE
Definition game.h:665
#define GAME_MIN_SPACESHIP_TRAVEL_PCT
Definition game.h:584
#define GAME_DEFAULT_MAXCONNECTIONSPERHOST
Definition game.h:600
#define GAME_DEFAULT_INCITE_GOLD_CAPT_CHANCE
Definition game.h:433
#define GAME_DEFAULT_DEMOGRAPHY
Definition game.h:701
#define GAME_MIN_MAXCONNECTIONSPERHOST
Definition game.h:601
#define GAME_DEFAULT_FULLTRADESIZE
Definition game.h:641
#define GAME_MAX_DISPERSION
Definition game.h:383
#define GAME_MIN_TECHLOST_DONOR
Definition game.h:559
#define GAME_DEFAULT_RAPTUREDELAY
Definition game.h:500
#define GAME_MIN_MGR_TURNINTERVAL
Definition game.h:519
#define GAME_DEFAULT_REVOLUTION_LENGTH
Definition game.h:735
#define GAME_DEFAULT_MGR_TURNINTERVAL
Definition game.h:518
scorelog_level
Definition game.h:67
@ SL_HUMANS
Definition game.h:69
@ SL_ALL
Definition game.h:68
#define GAME_DEFAULT_START_UNITS
Definition game.h:378
#define GAME_MAX_TCPTIMEOUT
Definition game.h:617
#define GAME_DEFAULT_ALLOW_TAKE
Definition game.h:702
#define GAME_DEFAULT_THREADED_SAVE
Definition game.h:689
#define GAME_MIN_INFRA
Definition game.h:375
#define GAME_MAX_TRADEWORLDRELPCT
Definition game.h:639
#define GAME_DEFAULT_MIN_PLAYERS
Definition game.h:395
#define GAME_MIN_CONQUERCOST
Definition game.h:468
#define GAME_MAX_MGR_DISTANCE
Definition game.h:529
#define GAME_MIN_TECHLOSSREST
Definition game.h:476
#define GAME_DEFAULT_AUTOATTACK
Definition game.h:667
#define GAME_DEFAULT_SAVEFREQUENCY
Definition game.h:679
#define GAME_MAX_GOLD
Definition game.h:372
#define GAME_DEFAULT_REVEALMAP
Definition game.h:569
#define GAME_DEFAULT_SCOREFILE
Definition game.h:573
#define GAME_MAX_FIRST_TIMEOUT
Definition game.h:607
#define GAME_MIN_MGR_DISTANCE
Definition game.h:528
#define GAME_MIN_DISPERSION
Definition game.h:382
#define GAME_DEFAULT_TEAM_POOLED_RESEARCH
Definition game.h:562
#define GAME_DEFAULT_SEED
Definition game.h:366
#define GAME_DEFAULT_HOMECAUGHTUNITS
Definition game.h:512
#define GAME_MAX_GLOBAL_WARMING_PERCENT
Definition game.h:445
#define GAME_MAX_MAXCONNECTIONSPERHOST
Definition game.h:602
#define GAME_DEFAULT_NETWAIT
Definition game.h:619
#define GAME_MIN_PINGTIMEOUT
Definition game.h:628
#define GAME_MIN_TECHPENALTY
Definition game.h:551
#define GAME_MIN_CONTACTTURNS
Definition game.h:495
#define GAME_MAX_INCITE_GOLD_LOSS_CHANCE
Definition game.h:431
#define GAME_DEFAULT_KICK_TIME
Definition game.h:746
#define GAME_DEFAULT_PLRCOLORMODE
Definition game.h:732
#define GAME_MAX_CITYMINDIST
Definition game.h:485
#define GAME_DEFAULT_DIPLCHANCE
Definition game.h:459
#define GAME_MAX_NUCLEAR_WINTER_PERCENT
Definition game.h:451
#define GAME_MIN_END_TURN
Definition game.h:392
#define GAME_DEFAULT_UNRPROTECTS
Definition game.h:492
#define GAME_MIN_MGR_WORLDCHANCE
Definition game.h:536
#define GAME_DEFAULT_RAZECHANCE
Definition game.h:565
#define GAME_MIN_SHIELDBOX
Definition game.h:414
#define GAME_MIN_FIRST_TIMEOUT
Definition game.h:606
#define GAME_MAX_RAZECHANCE
Definition game.h:567
#define GAME_MIN_TIMEOUT
Definition game.h:604
#define GAME_MAX_ONSETBARBARIAN
Definition game.h:661
#define GAME_MIN_FOODBOX
Definition game.h:410
#define GAME_DEFAULT_INCITE_GOLD_LOSS_CHANCE
Definition game.h:429
#define GAME_MAX_MAX_PLAYERS
Definition game.h:401
#define GAME_DEFAULT_TRADING_CITY
Definition game.h:647
#define GAME_DEFAULT_FOODBOX
Definition game.h:409
#define GAME_DEFAULT_COMPRESS_TYPE
Definition game.h:727
#define GAME_MAX_TIMEOUT
Definition game.h:605
#define GAME_MAX_SPACESHIP_TRAVEL_PCT
Definition game.h:585
#define GAME_DEFAULT_PINGTIMEOUT
Definition game.h:627
#define GAME_DEFAULT_TRADE_REVENUE_STYLE
Definition game.h:655
#define GAME_DEFAULT_SAVEPALACE
Definition game.h:510
#define GAME_MIN_EVENT_CACHE_TURNS
Definition game.h:705
#define GAME_DEFAULT_GLOBAL_WARMING
Definition game.h:441
#define GAME_MAX_SEED
Definition game.h:368
#define GAME_MAX_DIPLGOLDCOST
Definition game.h:427
#define GAME_DEFAULT_TECHLOST_RECV
Definition game.h:554
#define GAME_DEFAULT_NOTRADESIZE
Definition game.h:633
#define GAME_DEFAULT_COMPRESS_LEVEL
Definition game.h:716
#define GAME_MAX_TECHLOST_DONOR
Definition game.h:560
#define GAME_MIN_SAVETURNS
Definition game.h:677
#define GAME_MAX_UNITWAITTIME
Definition game.h:610
#define GAME_DEFAULT_FIRST_TIMEOUT
Definition game.h:592
#define GAME_DEFAULT_NUCLEAR_WINTER_PERCENT
Definition game.h:449
#define GAME_MIN_CIVILWARSIZE
Definition game.h:488
#define GAME_DEFAULT_TRADING_GOLD
Definition game.h:646
#define GAME_MIN_TECHLEAK
Definition game.h:480
#define GAME_DEFAULT_TRAIT_DIST_MODE
Definition game.h:508
#define GAME_DEFAULT_NUCLEAR_WINTER
Definition game.h:447
#define GAME_MIN_DISASTERS
Definition game.h:505
#define GAME_MIN_OCCUPYCHANCE
Definition game.h:664
#define GAME_DEFAULT_FREECOST
Definition game.h:463
#define GAME_MIN_KICK_TIME
Definition game.h:747
#define GAME_DEFAULT_MAX_PLAYERS
Definition game.h:399
#define GAME_DEFAULT_CITYMINDIST
Definition game.h:483
#define GAME_MIN_NUCLEAR_WINTER_PERCENT
Definition game.h:450
#define GAME_DEFAULT_PHASE_MODE
Definition game.h:613
#define GAME_DEFAULT_AIFILL
Definition game.h:403
#define GAME_DEFAULT_TRADEWORLDRELPCT
Definition game.h:637
#define GAME_DEFAULT_MULTIRESEARCH
Definition game.h:563
#define GAME_DEFAULT_CONQUERCOST
Definition game.h:467
#define GAME_MAX_TECHPENALTY
Definition game.h:552
#define GAME_DEFAULT_TIMEOUT
Definition game.h:591
#define GAME_MAX_DISASTERS
Definition game.h:506
#define GAME_MIN_INCITE_GOLD_CAPT_CHANCE
Definition game.h:434
#define GAME_MIN_TECHLOSSFG
Definition game.h:472
#define GAME_MAX_END_TURN
Definition game.h:393
#define GAME_MIN_COMPRESS_LEVEL
Definition game.h:717
#define GAME_DEFAULT_TECHLOSSREST
Definition game.h:475
#define GAME_MIN_KILLUNHOMED
Definition game.h:547
#define GAME_MAX_NOTRADESIZE
Definition game.h:635
#define GAME_DEFAULT_CONTACTTURNS
Definition game.h:494
#define GAME_DEFAULT_SCORELOGLEVEL
Definition game.h:572
#define GAME_DEFAULT_TECHLOSSFG
Definition game.h:471
#define GAME_DEFAULT_TECHLEVEL
Definition game.h:385
#define GAME_MIN_MAX_PLAYERS
Definition game.h:400
#define GAME_DEFAULT_DISASTERS
Definition game.h:504
#define GAME_MAX_FREECOST
Definition game.h:465
#define GAME_MAX_REVOLUTION_LENGTH
Definition game.h:737
#define GAME_MAX_AIFILL
Definition game.h:405
#define GAME_DEFAULT_GOLD
Definition game.h:370
#define GAME_MIN_AQUEDUCTLOSS
Definition game.h:540
#define GAME_MIN_DIPLBULBCOST
Definition game.h:422
#define GAME_DEFAULT_MIGRATION
Definition game.h:516
@ 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
#define GAME_MIN_EVENT_CACHE_MAX_SIZE
Definition game.h:709
#define GAME_MIN_CITYMINDIST
Definition game.h:484
#define GAME_MIN_AIFILL
Definition game.h:404
#define GAME_MIN_SAVEFREQUENCY
Definition game.h:680
#define GAME_DEFAULT_NATURALCITYNAMES
Definition game.h:514
#define GAME_DEFAULT_EVENT_CACHE_TURNS
Definition game.h:704
#define GAME_DEFAULT_VICTORY_CONDITIONS
Definition game.h:580
#define GAME_MIN_UNITWAITTIME
Definition game.h:609
#define GAME_DEFAULT_FOGGEDBORDERS
Definition game.h:439
#define GAME_DEFAULT_UNITWAITTIME
Definition game.h:611
#define GAME_DEFAULT_TIMEOUTADDEMOVE
Definition game.h:597
#define GAME_DEFAULT_DISPERSION
Definition game.h:381
#define GAME_MAX_CIVILWARSIZE
Definition game.h:489
#define GAME_DEFAULT_AUTOSAVES
Definition game.h:686
#define GAME_DEFAULT_EVENT_CACHE_CHAT
Definition game.h:712
#define GAME_DEFAULT_DIPLOMACY
Definition game.h:457
#define GAME_DEFAULT_MGR_DISTANCE
Definition game.h:527
#define GAME_MIN_DIPLCHANCE
Definition game.h:460
#define GAME_DEFAULT_TURNBLOCK
Definition game.h:587
#define GAME_MAX_SAVETURNS
Definition game.h:678
#define GAME_MAX_PINGTIME
Definition game.h:625
#define GAME_DEFAULT_PINGTIME
Definition game.h:623
@ 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
#define GAME_DEFAULT_AQUEDUCTLOSS
Definition game.h:539
#define GAME_DEFAULT_TRADEMINDIST
Definition game.h:651
#define GAME_DEFAULT_BARBARIANRATE
Definition game.h:657
#define GAME_DEFAULT_HAPPYBORDERS
Definition game.h:455
#define GAME_MAX_FULLTRADESIZE
Definition game.h:643
#define GAME_MAX_TECHLEAK
Definition game.h:481
#define GAME_MAX_MGR_NATIONCHANCE
Definition game.h:533
#define GAME_MAX_TECHLEVEL
Definition game.h:387
#define GAME_MAX_MGR_WORLDCHANCE
Definition game.h:537
#define GAME_MIN_MIN_PLAYERS
Definition game.h:396
#define GAME_MAX_TRADEMINDIST
Definition game.h:653
#define GAME_DEFAULT_END_TURN
Definition game.h:391
#define GAME_MAX_EVENT_CACHE_TURNS
Definition game.h:706
#define GAME_MAX_DIPLBULBCOST
Definition game.h:423
#define GAME_DEFAULT_DIPLGOLDCOST
Definition game.h:425
#define GAME_MAX_SHIELDBOX
Definition game.h:415
#define GAME_DEFAULT_TECHLEAK
Definition game.h:479
#define GAME_MAX_MIN_PLAYERS
Definition game.h:397
#define GAME_MAX_NETWAIT
Definition game.h:621
#define GAME_MIN_TCPTIMEOUT
Definition game.h:616
#define GAME_DEFAULT_END_SPACESHIP
Definition game.h:581
#define GAME_MIN_RAPTUREDELAY
Definition game.h:501
#define GAME_MIN_NETWAIT
Definition game.h:620
#define GAME_DEFAULT_EVENT_CACHE_MAX_SIZE
Definition game.h:708
#define GAME_DEFAULT_SAVE_NAME
Definition game.h:675
#define GAME_MIN_TRADEMINDIST
Definition game.h:652
#define GAME_DEFAULT_MGR_NATIONCHANCE
Definition game.h:531
#define GAME_MIN_TECHLEVEL
Definition game.h:386
#define GAME_MAX_INCITE_GOLD_CAPT_CHANCE
Definition game.h:435
#define GAME_DEFAULT_FOGOFWAR
Definition game.h:437
#define GAME_DEFAULT_PERSISTENTREADY
Definition game.h:742
#define GAME_MIN_FULLTRADESIZE
Definition game.h:642
#define GAME_DEFAULT_DIPLBULBCOST
Definition game.h:421
#define GAME_DEFAULT_RESTRICTINFRA
Definition game.h:491
#define GAME_MAX_KICK_TIME
Definition game.h:748
#define GAME_DEFAULT_CIVILWARSIZE
Definition game.h:487
void send_game_info(struct conn_list *dest)
Definition gamehand.c:907
enum unit_role_id crole_to_role_id(char crole)
Definition gamehand.c:87
#define enable(id)
Definition widget.h:223
const char * name
Definition inputfile.c:127
fz_method
Definition ioz.h:36
@ FZ_PLAIN
Definition ioz.h:37
static enum log_level max_level
Definition log.c:49
#define fc_assert_msg(condition, message,...)
Definition log.h:181
#define fc_assert_ret(condition)
Definition log.h:191
#define log_warn(message,...)
Definition log.h:105
#define log_verbose(message,...)
Definition log.h:109
#define fc_assert(condition)
Definition log.h:176
#define fc_assert_ret_val(condition, val)
Definition log.h:194
#define log_debug(message,...)
Definition log.h:115
#define log_normal(message,...)
Definition log.h:107
#define log_error(message,...)
Definition log.h:103
int map_startpos_count(void)
Definition map.c:1853
bool map_is_empty(void)
Definition map.c:149
#define MAP_MAX_SIZE
Definition map.h:624
#define MAP_MIN_HUTS
Definition map.h:605
#define MAP_MIN_STEEPNESS
Definition map.h:671
#define MAP_MIN_LANDMASS
Definition map.h:663
#define MAP_DEFAULT_SIZE
Definition map.h:622
#define MAP_MAX_LINEAR_SIZE
Definition map.h:640
#define MAP_MAX_TILESPERPLAYER
Definition map.h:636
#define MAP_DEFAULT_HUTS
Definition map.h:604
#define MAP_MAX_FLATPOLES
Definition map.h:692
#define MAP_MIN_TILESPERPLAYER
Definition map.h:635
#define MAP_DEFAULT_LINEAR_SIZE
Definition map.h:639
#define MAP_DEFAULT_STARTPOS
Definition map.h:680
#define MAP_DEFAULT_ANIMALS
Definition map.h:608
#define MAP_MIN_WETNESS
Definition map.h:675
#define MAP_MAX_SEED
Definition map.h:660
#define MAP_DEFAULT_TEAM_PLACEMENT
Definition map.h:698
#define MAP_DEFAULT_TOPO
Definition map.h:654
#define MAP_DEFAULT_SEED
Definition map.h:658
#define MAP_IS_ISOMETRIC
Definition map.h:42
#define MAP_MIN_TEMPERATURE
Definition map.h:695
#define MAP_DEFAULT_MAPSIZE
Definition map.h:612
#define MAP_MIN_LINEAR_SIZE
Definition map.h:641
#define MAP_MAX_STEEPNESS
Definition map.h:672
#define MAP_DEFAULT_LANDMASS
Definition map.h:662
#define MAP_MIN_FLATPOLES
Definition map.h:691
#define MAP_MAX_LANDMASS
Definition map.h:664
#define MAP_MIN_SEED
Definition map.h:659
#define MAP_MAX_ANIMALS
Definition map.h:610
#define MAP_DEFAULT_WRAP
Definition map.h:655
#define MAP_MAX_TEMPERATURE
Definition map.h:696
#define MAP_MAX_LATITUDE_BOUND
Definition map.h:576
#define MAP_MIN_SIZE
Definition map.h:623
#define MAP_MIN_RICHES
Definition map.h:667
#define MAP_DEFAULT_NORTH_LATITUDE
Definition map.h:578
#define MAP_MIN_ANIMALS
Definition map.h:609
#define MAP_DEFAULT_SEPARATE_POLES
Definition map.h:686
#define MAP_DEFAULT_RICHES
Definition map.h:666
#define MAP_DEFAULT_TINYISLES
Definition map.h:682
#define MAP_MIN_LATITUDE_BOUND
Definition map.h:577
#define MAP_DEFAULT_TILESPERPLAYER
Definition map.h:634
#define MAP_DEFAULT_TEMPERATURE
Definition map.h:694
#define MAP_DEFAULT_SOUTH_LATITUDE
Definition map.h:579
#define MAP_MAX_RICHES
Definition map.h:668
#define MAP_DEFAULT_GENERATOR
Definition map.h:678
#define MAP_MAX_HUTS
Definition map.h:606
#define MAP_DEFAULT_FLATPOLES
Definition map.h:690
#define MAP_DEFAULT_WETNESS
Definition map.h:674
#define MAP_MAX_WETNESS
Definition map.h:676
#define MAP_DEFAULT_STEEPNESS
Definition map.h:670
@ MAPSIZE_FULLSIZE
Definition map_types.h:39
@ MAPSIZE_PLAYER
Definition map_types.h:40
@ MAPSIZE_XYSIZE
Definition map_types.h:43
@ MAPGEN_SCENARIO
Definition map_types.h:47
@ MAPGEN_FRACTURE
Definition map_types.h:52
@ MAPGEN_ISLAND
Definition map_types.h:50
@ MAPGEN_FAIR
Definition map_types.h:51
@ MAPGEN_FRACTAL
Definition map_types.h:49
@ MAPGEN_RANDOM
Definition map_types.h:48
@ MAPSTARTPOS_VARIABLE
Definition map_types.h:60
@ MAPSTARTPOS_2or3
Definition map_types.h:58
@ MAPSTARTPOS_ALL
Definition map_types.h:59
@ MAPSTARTPOS_DEFAULT
Definition map_types.h:56
@ MAPSTARTPOS_SINGLE
Definition map_types.h:57
#define fc_calloc(n, esz)
Definition mem.h:38
#define FC_FREE(ptr)
Definition mem.h:41
bool is_metaserver_open(void)
Definition meta.c:483
bool send_server_info_to_metaserver(enum meta_flag flag)
Definition meta.c:491
void set_user_meta_message_string(const char *string)
Definition meta.c:188
@ META_INFO
Definition meta.h:26
const struct rgbcolor * nation_color(const struct nation_type *pnation)
Definition nation.c:682
struct nation_set * nation_set_by_rule_name(const char *name)
Definition nation.c:779
#define nations_iterate_end
Definition nation.h:336
#define nations_iterate(NAME_pnation)
Definition nation.h:333
#define NO_NATION_SELECTED
Definition nation.h:30
void notify_conn(struct conn_list *dest, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
Definition notify.c:239
int send_packet_server_setting_bitwise(struct connection *pc, const struct packet_server_setting_bitwise *packet)
int send_packet_server_setting_str(struct connection *pc, const struct packet_server_setting_str *packet)
int send_packet_server_setting_const(struct connection *pc, const struct packet_server_setting_const *packet)
int send_packet_server_setting_int(struct connection *pc, const struct packet_server_setting_int *packet)
int send_packet_server_setting_control(struct connection *pc, const struct packet_server_setting_control *packet)
int send_packet_server_setting_bool(struct connection *pc, const struct packet_server_setting_bool *packet)
int send_packet_set_topology(struct connection *pc, const struct packet_set_topology *packet)
int send_packet_server_setting_enum(struct connection *pc, const struct packet_server_setting_enum *packet)
int len
Definition packhand.c:127
int player_count(void)
Definition player.c:817
bool player_set_nation(struct player *pplayer, struct nation_type *pnation)
Definition player.c:861
#define players_iterate_end
Definition player.h:537
#define players_iterate(_pplayer)
Definition player.h:532
plrcolor_mode
Definition player.h:50
@ PLRCOL_PLR_RANDOM
Definition player.h:52
@ PLRCOL_PLR_SET
Definition player.h:53
@ PLRCOL_NATION_ORDER
Definition player.h:55
@ PLRCOL_TEAM_ORDER
Definition player.h:54
@ PLRCOL_PLR_ORDER
Definition player.h:51
#define is_human(plr)
Definition player.h:229
void send_nation_availability(struct conn_list *dest, bool nationset_change)
Definition plrhand.c:2637
int normal_player_count(void)
Definition plrhand.c:3200
void server_player_set_color(struct player *pplayer, const struct rgbcolor *prgbcolor)
Definition plrhand.c:1818
void send_player_info_c(struct player *src, struct conn_list *dest)
Definition plrhand.c:1142
void count_playable_nations(void)
Definition plrhand.c:2594
bool nation_is_in_current_set(const struct nation_type *pnation)
Definition plrhand.c:2585
const char * secfile_error(void)
bool secfile_lookup_int(const struct section_file *secfile, int *ival, const char *path,...)
bool secfile_lookup_enum_data(const struct section_file *secfile, int *pvalue, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *path,...)
int secfile_lookup_enum_default_data(const struct section_file *secfile, int defval, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *path,...)
const char * secfile_lookup_str(const struct section_file *secfile, const char *path,...)
bool secfile_lookup_bool_default(const struct section_file *secfile, bool def, const char *path,...)
int secfile_lookup_int_default(const struct section_file *secfile, int def, const char *path,...)
const char * secfile_name(const struct section_file *secfile)
struct section * secfile_section_by_name(const struct section_file *secfile, const char *name)
const char * secfile_lookup_str_default(const struct section_file *secfile, const char *def, const char *path,...)
bool secfile_lookup_bool(const struct section_file *secfile, bool *bval, const char *path,...)
#define secfile_insert_int(secfile, value, path,...)
#define secfile_insert_str(secfile, string, path,...)
#define secfile_insert_bool(secfile, value, path,...)
#define secfile_insert_enum_data(secfile, value, bitwise, name_fn, data, path,...)
const void * secfile_data_t
void log_civ_score_free(void)
Definition report.c:1434
bool is_valid_demography(const char *demography, int *error)
Definition report.c:1078
void log_civ_score_init(void)
Definition report.c:1411
void rscompat_settings_do_special_handling(struct section_file *file, const char *section, void(*setdef)(struct setting *pset))
Definition rscompat.c:632
bool rscompat_setting_needs_special_handling(const char *name)
Definition rscompat.c:618
bool autolock_settings(void)
Definition rssanity.c:1638
static struct compatibility compat[]
Definition savecompat.c:110
#define setcompat_current_val_from_previous(_set_, _old_val_)
Definition setcompat.h:22
#define setcompat_current_name_from_previous(_old_name_)
Definition setcompat.h:20
bool setting_ruleset_locked(const struct setting *pset)
Definition settings.c:4674
bool setting_int_validate(const struct setting *pset, int val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3753
static void metamessage_action(const struct setting *pset)
Definition settings.c:858
static const struct sset_val_name * phasemode_name(int phasemode)
Definition settings.c:550
void settings_init(bool act)
Definition settings.c:5238
static bool savename_validate(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:888
static const char * setting_bool_to_str(const struct setting *pset, bool value, bool pretty, char *buf, size_t buf_len)
Definition settings.c:3597
#define PACKET_COMMON_INIT(packet, pset, pconn)
static bool endturn_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1098
void setting_action(const struct setting *pset)
Definition settings.c:4359
bool(* bitwise_validate_func_t)(unsigned value, struct connection *pconn, char *reject_msg, size_t reject_msg_len)
Definition settings.c:83
static const struct sset_val_name * revealmap_name(int bit)
Definition settings.c:520
void setting_ruleset_lock_clear(struct setting *pset)
Definition settings.c:4702
void setting_admin_lock_clear(struct setting *pset)
Definition settings.c:4714
#define GEN_BOOL(name, value, sclass, scateg, slevel, al_read, al_write, short_help, extra_help, func_validate, func_action, _default)
Definition settings.c:1411
int setting_int_get(struct setting *pset)
Definition settings.c:3778
static const char * setting_bool_secfile_str(secfile_data_t data, int val)
Definition settings.c:3692
static void nationset_action(const struct setting *pset)
Definition settings.c:717
const char * setting_default_name(const struct setting *pset, bool pretty, char *buf, size_t buf_len)
Definition settings.c:4293
bool setting_enum_validate(const struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:4041
struct setting * setting_by_name(const char *name)
Definition settings.c:3299
static const struct sset_val_name * compresstype_name(enum fz_method compresstype)
Definition settings.c:578
void setting_set_to_default(struct setting *pset)
Definition settings.c:4329
static void timeout_action(const struct setting *pset)
Definition settings.c:782
static const struct sset_val_name * startpos_name(int startpos)
Definition settings.c:318
const char * setting_value_name(const struct setting *pset, bool pretty, char *buf, size_t buf_len)
Definition settings.c:4257
void settings_game_load(struct section_file *file, const char *section)
Definition settings.c:4939
const char * setting_extra_help(const struct setting *pset, bool constant)
Definition settings.c:3340
static bool setting_match_prefix(const val_name_func_t name_fn, const char *prefix, int *pvalue, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3555
const char *(* help_callback_func_t)(const struct setting *pset)
Definition settings.c:89
int setting_number(const struct setting *pset)
Definition settings.c:3314
struct setting * setting_by_number(int id)
Definition settings.c:3291
bool setting_int_set(struct setting *pset, int val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3733
enum sset_category setting_category(const struct setting *pset)
Definition settings.c:3368
static bool aitype_callback(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1356
bool setting_is_visible(const struct setting *pset, struct connection *caller)
Definition settings.c:3496
static bool first_timeout_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1199
static void setting_ruleset_setdef(struct setting *pset)
Definition settings.c:4440
bool setting_locked(const struct setting *pset)
Definition settings.c:4666
bool setting_non_default(const struct setting *pset)
Definition settings.c:4640
static bool wrap_callback(unsigned value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1372
static bool xsize_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1262
static const struct sset_val_name * airliftingstyle_name(int bit)
Definition settings.c:532
enum sset_type setting_type(const struct setting *pset)
Definition settings.c:3352
void settings_free(void)
Definition settings.c:5280
static const struct sset_val_name * caravanbonusstyle_name(int caravanbonus)
Definition settings.c:234
void setting_admin_lock_set(struct setting *pset)
Definition settings.c:4694
static void settings_list_free(void)
Definition settings.c:5613
bool setting_str_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3804
#define GEN_STRING(name, value, sclass, scateg, slevel, al_read, al_write, short_help, extra_help, func_validate, func_action, _default)
Definition settings.c:1431
static const struct sset_val_name * bool_name(int enable)
Definition settings.c:629
bool init
Definition settings.c:189
static const struct sset_val_name * revolentype_name(int revolentype)
Definition settings.c:506
int setting_int_max(const struct setting *pset)
Definition settings.c:3723
enum sset_level setting_level(const struct setting *pset)
Definition settings.c:3360
static struct setting settings[]
Definition settings.c:1473
static void first_timeout_action(const struct setting *pset)
Definition settings.c:799
static bool allowtake_callback(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:998
static void wrap_action(const struct setting *pset)
Definition settings.c:842
static const char * setting_bitwise_to_str(const struct setting *pset, unsigned value, bool pretty, char *buf, size_t buf_len)
Definition settings.c:4097
static const struct sset_val_name * topology_name(int topology_bit)
Definition settings.c:262
bool setting_bitwise_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:4213
static void topology_action(const struct setting *pset)
Definition settings.c:827
const char * setting_enum_secfile_str(secfile_data_t data, int val)
Definition settings.c:3860
void settings_game_save(struct section_file *file, const char *section)
Definition settings.c:4851
int settings_number(void)
Definition settings.c:5292
bool setting_str_validate(const struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3824
static const struct sset_val_name * traderevenuestyle_name(int revenue_style)
Definition settings.c:288
bool(* string_validate_func_t)(const char *value, struct connection *pconn, char *reject_msg, size_t reject_msg_len)
Definition settings.c:76
#define NAME_CASE(_val, _support, _pretty)
Definition settings.c:224
void settings_turn(void)
Definition settings.c:5272
#define GEN_STRING_NRS(name, value, sclass, scateg, slevel, al_read, al_write, short_help, extra_help, func_validate, func_action, _default)
Definition settings.c:1441
static bool setting_is_free_to_change(const struct setting *pset, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3378
static const char * setting_enum_to_str(const struct setting *pset, int value, bool pretty, char *buf, size_t buf_len)
Definition settings.c:3902
const char * setting_enum_val(const struct setting *pset, int val, bool pretty)
Definition settings.c:3883
struct setting_list * level[OLEVELS_NUM]
Definition settings.c:190
void setting_changed(struct setting *pset)
Definition settings.c:5630
#define GEN_ENUM(name, value, sclass, scateg, slevel, al_read, al_write, short_help, extra_help, func_help, func_validate, func_action, func_name, _default)
Definition settings.c:1451
static bool startunits_callback(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1044
static void huts_action(const struct setting *pset)
Definition settings.c:819
static bool nationset_callback(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1140
enum setting_default_level setting_get_setdef(const struct setting *pset)
Definition settings.c:5638
static bool mapsize_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1243
static const char * setting_int_to_str(const struct setting *pset, int value, bool pretty, char *buf, size_t buf_len)
Definition settings.c:3703
static bool setting_bool_validate_base(const struct setting *pset, const char *val, int *pint_val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3618
static bool setting_ruleset_one(struct section_file *file, const char *name, const char *path, bool compat)
Definition settings.c:4448
static bool demography_callback(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:952
bool(* enum_validate_func_t)(int value, struct connection *pconn, char *reject_msg, size_t reject_msg_len)
Definition settings.c:80
void settings_game_start(void)
Definition settings.c:4838
bool setting_enum_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:4012
const char * setting_short_help(const struct setting *pset)
Definition settings.c:3331
static const struct sset_val_name * citynames_name(int citynames)
Definition settings.c:477
void send_server_setting_control(struct connection *pconn)
Definition settings.c:5464
static bool plrcol_validate(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1392
static const struct sset_val_name * generator_name(int generator)
Definition settings.c:302
const char * setting_bitwise_bit(const struct setting *pset, int bit, bool pretty)
Definition settings.c:4078
static bool autosaves_callback(unsigned value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:972
static bool maxplayers_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1113
int setting_int_min(const struct setting *pset)
Definition settings.c:3714
bool(* bool_validate_func_t)(bool value, struct connection *pconn, char *reject_msg, size_t reject_msg_len)
Definition settings.c:70
static bool setting_enum_validate_base(const struct setting *pset, const char *val, int *pint_val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3924
static void autotoggle_action(const struct setting *pset)
Definition settings.c:766
bool setting_bitwise_validate(const struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:4234
void setting_ruleset_lock_set(struct setting *pset)
Definition settings.c:4682
static const struct sset_val_name * ailevel_name(enum ai_level lvl)
Definition settings.c:604
static const struct sset_val_name * victory_conditions_name(int condition_bit)
Definition settings.c:373
#define GEN_INT(name, value, sclass, scateg, slevel, al_read, al_write, short_help, extra_help, func_help, func_validate, func_action, _min, _max, _default)
Definition settings.c:1420
bool setting_bool_validate(const struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3678
struct setting_list * settings_list_get(enum sset_level level)
Definition settings.c:5601
bool setting_is_changeable(const struct setting *pset, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3450
static const struct sset_val_name * teamplacement_name(int team_placement)
Definition settings.c:338
int settings_list_cmp(const struct setting *const *pset1, const struct setting *const *pset2)
Definition settings.c:5588
static bool setting_bitwise_validate_base(const struct setting *pset, const char *val, unsigned *pint_val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:4162
static enum m_pre_result setting_match_prefix_base(const val_name_func_t name_fn, const char *prefix, int *ind_result, const char **matches, size_t max_matches, size_t *pnum_matches)
Definition settings.c:3510
static void settings_list_init(void)
Definition settings.c:5501
void settings_reset(void)
Definition settings.c:5258
const char * setting_name(const struct setting *pset)
Definition settings.c:3323
static const int SETTINGS_NUM
Definition settings.c:3286
static const char * phasemode_help(const struct setting *pset)
Definition settings.c:647
static bool ysize_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1287
bool settings_game_reset(void)
Definition settings.c:5221
static void scorelog_action(const struct setting *pset)
Definition settings.c:692
static const struct sset_val_name * happyborders_name(int happyborders)
Definition settings.c:446
int setting_bitwise_get(struct setting *pset)
Definition settings.c:4247
static const struct sset_val_name * scoreloglevel_name(enum scorelog_level sl_level)
Definition settings.c:565
static const struct sset_val_name * wrap_name(int wrap_bit)
Definition settings.c:275
void settings_list_update(void)
Definition settings.c:5559
static bool timeout_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1161
sset_class
Definition settings.c:57
@ SSET_RULES
Definition settings.c:64
@ SSET_PLAYERS
Definition settings.c:61
@ SSET_GAME_INIT
Definition settings.c:63
@ SSET_MAP_GEN
Definition settings.c:59
@ SSET_RULES_FLEXIBLE
Definition settings.c:66
@ SSET_META
Definition settings.c:67
@ SSET_MAP_ADD
Definition settings.c:60
@ SSET_PLAYERS_CHANGEABLE
Definition settings.c:62
@ SSET_MAP_SIZE
Definition settings.c:58
@ SSET_RULES_SCENARIO
Definition settings.c:65
static bool generator_validate(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:909
static const char * setting_str_to_str(const struct setting *pset, const char *value, bool pretty, char *buf, size_t buf_len)
Definition settings.c:3788
void(* action_callback_func_t)(const struct setting *pset)
Definition settings.c:88
#define settings_snprintf(_buf, _buf_len, format,...)
Definition settings.c:206
static struct @115 setting_sorted
char * setting_str_get(struct setting *pset)
Definition settings.c:3849
const struct sset_val_name *(* val_name_func_t)(int value)
Definition settings.c:90
bool settings_ruleset(struct section_file *file, const char *section, bool act, bool compat)
Definition settings.c:4369
bool setting_bool_get(struct setting *pset)
Definition settings.c:3666
static bool set_enum_value(struct setting *pset, int val)
Definition settings.c:3951
static void setting_game_set(struct setting *pset, bool init)
Definition settings.c:4726
static void setting_game_free(struct setting *pset)
Definition settings.c:4766
static bool scorefile_validate(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:935
const char * setting_bitwise_secfile_str(secfile_data_t data, int bit)
Definition settings.c:4055
static void aitype_action(const struct setting *pset)
Definition settings.c:874
static void aifill_action(const struct setting *pset)
Definition settings.c:704
static const struct sset_val_name * trait_dist_name(int trait_dist)
Definition settings.c:419
bool setting_is_visible_at_level(const struct setting *pset, enum cmdlevel plevel)
Definition settings.c:3486
static const struct sset_val_name * plrcol_name(int plrcol)
Definition settings.c:431
bool setting_bool_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3647
void send_server_setting(struct conn_list *dest, const struct setting *pset)
Definition settings.c:5301
static const char * huts_help(const struct setting *pset)
Definition settings.c:665
static const struct sset_val_name * persistentready_name(int persistent_ready)
Definition settings.c:358
void send_server_settings(struct conn_list *dest)
Definition settings.c:5420
#define GEN_BITWISE(name, value, sclass, scateg, slevel, al_read, al_write, short_help, extra_help, func_validate, func_action, func_name, _default)
Definition settings.c:1462
static const struct sset_val_name * mapsize_name(int mapsize)
Definition settings.c:249
static void plrcol_action(const struct setting *pset)
Definition settings.c:750
void send_server_access_level_settings(struct conn_list *dest, enum cmdlevel old_level, enum cmdlevel new_level)
Definition settings.c:5432
static const struct sset_val_name * diplomacy_name(int diplomacy)
Definition settings.c:459
static const struct sset_val_name * barbarians_name(int barbarians)
Definition settings.c:491
static void setting_game_restore(struct setting *pset)
Definition settings.c:4776
int read_enum_value(const struct setting *pset)
Definition settings.c:3985
static const struct sset_val_name * borders_name(int borders)
Definition settings.c:403
static const struct sset_val_name * autosaves_name(int autosaves_bit)
Definition settings.c:387
bool(* int_validate_func_t)(int value, struct connection *pconn, char *reject_msg, size_t reject_msg_len)
Definition settings.c:73
static bool unitwaittime_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1217
static bool topology_callback(unsigned value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1320
#define settings_iterate(_level, _pset)
Definition settings.h:188
#define settings_iterate_end
Definition settings.h:194
setting_lock_level
Definition settings.h:76
@ SLOCK_RULESET
Definition settings.h:76
@ SLOCK_ADMIN
Definition settings.h:76
@ SLOCK_NONE
Definition settings.h:76
bool is_safe_filename(const char *name)
Definition shared.c:253
void remove_leading_trailing_spaces(char *s)
Definition shared.c:444
#define ARRAY_SIZE(x)
Definition shared.h:85
#define MIN(x, y)
Definition shared.h:55
#define MAX_LEN_PATH
Definition shared.h:32
m_pre_result
Definition shared.h:207
@ M_PRE_EXACT
Definition shared.h:208
@ M_PRE_ONLY
Definition shared.h:209
@ M_PRE_LAST
Definition shared.h:214
@ M_PRE_LONG
Definition shared.h:212
@ M_PRE_AMBIGUOUS
Definition shared.h:210
@ M_PRE_EMPTY
Definition shared.h:211
@ M_PRE_FAIL
Definition shared.h:213
size_t size
Definition specvec.h:72
const char * aifill(int amount)
Definition srv_main.c:2464
bool game_was_started(void)
Definition srv_main.c:349
enum server_states server_state(void)
Definition srv_main.c:333
void toggle_ai_player_direct(struct connection *caller, struct player *pplayer)
Definition stdinhand.c:705
void strvec_destroy(struct strvec *psv)
void strvec_append(struct strvec *psv, const char *string)
struct strvec * strvec_new(void)
size_t strvec_size(const struct strvec *psv)
const char * strvec_to_and_list(const struct strvec *psv, struct astring *astr)
int diplgoldcost
Definition game.h:140
int contactturns
Definition game.h:137
enum city_names_mode allowed_city_names
Definition game.h:127
int unitwaittime
Definition game.h:198
bool multiresearch
Definition game.h:163
int incite_gold_capt_chance
Definition game.h:142
char scorefile[MAX_LEN_PATH]
Definition game.h:224
int mgr_worldchance
Definition game.h:162
int kick_time
Definition game.h:153
bool chat
Definition game.h:252
enum barbarians_rate barbarianrate
Definition game.h:133
int dispersion
Definition game.h:143
bool threaded_save
Definition game.h:180
int max_size
Definition game.h:251
int save_compress_level
Definition game.h:181
int tcptimeout
Definition game.h:195
char start_units[MAX_LEN_STARTUNIT]
Definition game.h:189
struct civ_game::@31::@35::@36 event_cache
int save_nturns
Definition game.h:183
int mgr_nationchance
Definition game.h:160
bool fixedlength
Definition game.h:146
int spaceship_travel_pct
Definition game.h:179
int techlost_recv
Definition game.h:194
bool mgr_foodneeded
Definition game.h:159
int diplchance
Definition game.h:138
int netwait
Definition game.h:168
int incite_gold_loss_chance
Definition game.h:141
int end_turn
Definition game.h:144
bool settings_gamestart_valid
Definition game.h:242
enum plrcolor_mode plrcolormode
Definition game.h:128
int onsetbarbarian
Definition game.h:171
char demography[MAX_LEN_DEMOGRAPHY]
Definition game.h:239
struct conn_list * est_connections
Definition game.h:97
struct packet_game_info info
Definition game.h:89
int mgr_turninterval
Definition game.h:161
char user_message[256]
Definition game.h:265
int min_players
Definition game.h:166
unsigned autosaves
Definition game.h:185
struct timer * save_timer
Definition game.h:217
bool endspaceship
Definition game.h:145
enum scorelog_level scoreloglevel
Definition game.h:223
bool migration
Definition game.h:164
bool ip_hide
Definition game.h:174
int diplbulbcost
Definition game.h:139
bool natural_city_names
Definition game.h:167
int maxconnectionsperhost
Definition game.h:155
struct packet_scenario_info scenario
Definition game.h:87
int pingtimeout
Definition game.h:173
int occupychance
Definition game.h:170
randseed seed_setting
Definition game.h:226
int killunhomed
Definition game.h:154
int nuclear_winter_percent
Definition game.h:232
int conquercost
Definition game.h:136
unsigned revealmap
Definition game.h:177
int pingtime
Definition game.h:172
int techloss_restore
Definition game.h:192
char default_ai_type_name[256]
Definition game.h:277
int civilwarsize
Definition game.h:135
bool savepalace
Definition game.h:187
int freecost
Definition game.h:148
char nationset[MAX_LEN_NAME]
Definition game.h:157
int aqueductloss
Definition game.h:129
char save_name[MAX_LEN_NAME]
Definition game.h:220
enum fz_method save_compress_type
Definition game.h:182
enum trait_dist_mode trait_dist
Definition game.h:165
bool foggedborders
Definition game.h:147
struct civ_game::@31::@35 server
bool homecaughtunits
Definition game.h:188
struct packet_timeout_info tinfo
Definition game.h:91
struct civ_game::@31::@35::@38 meta_info
char allow_take[MAX_LEN_ALLOW_TAKE]
Definition game.h:240
bool autoattack
Definition game.h:131
int phase_mode_stored
Definition game.h:216
bool start_city
Definition game.h:190
int max_players
Definition game.h:156
int revolution_length
Definition game.h:178
int turns
Definition game.h:250
bool auto_ai_toggle
Definition game.h:130
int save_frequency
Definition game.h:184
int mgr_distance
Definition game.h:158
int global_warming_percent
Definition game.h:230
int techlost_donor
Definition game.h:193
int timeoutaddenemymove
Definition game.h:208
bool scorelog
Definition game.h:222
int techpenalty
Definition game.h:196
int razechance
Definition game.h:176
bool turnblock
Definition game.h:197
int animals
Definition map_types.h:96
int xsize
Definition map_types.h:78
bool tinyisles
Definition map_types.h:100
int ysize
Definition map_types.h:78
int riches
Definition map_types.h:93
int north_latitude
Definition map_types.h:79
enum mapsize_type mapsize
Definition map_types.h:88
int south_latitude
Definition map_types.h:80
enum map_startpos startpos
Definition map_types.h:99
struct civ_map::@42::@44 server
int steepness
Definition map_types.h:105
int wetness
Definition map_types.h:104
int size
Definition map_types.h:89
int tilesperplayer
Definition map_types.h:90
randseed seed_setting
Definition map_types.h:91
int landpercent
Definition map_types.h:97
enum team_placement team_placement
Definition map_types.h:109
int topology_id
Definition map_types.h:72
int flatpoles
Definition map_types.h:102
int huts
Definition map_types.h:94
int wrap_id
Definition map_types.h:73
enum map_generator generator
Definition map_types.h:98
bool separatepoles
Definition map_types.h:101
int temperature
Definition map_types.h:103
int huts_absolute
Definition map_types.h:95
enum cmdlevel access_level
Definition connection.h:177
enum borders_mode borders
enum happyborders_type happyborders
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
enum persistent_ready persistent_ready
enum victory_condition_type victory_conditions
char support_names[64][MAX_LEN_NAME]
char pretty_names[64][MAX_LEN_ENUM]
char category_names[256][MAX_LEN_NAME]
char pretty_names[64][MAX_LEN_ENUM]
char support_names[64][MAX_LEN_NAME]
char default_val[MAX_LEN_PACKET]
char val[MAX_LEN_PACKET]
enum cmdlevel access_level_read
Definition settings.c:97
char * game_value
Definition settings.c:151
enum setting_default_level setdef
Definition settings.c:184
struct setting::@116::@121 enumerator
const char *const default_value
Definition settings.c:148
bool game_value
Definition settings.c:134
const int_validate_func_t validate
Definition settings.c:142
enum sset_class sclass
Definition settings.c:94
const int default_value
Definition settings.c:139
enum cmdlevel access_level_write
Definition settings.c:98
struct setting::@116::@118 boolean
struct setting::@116::@120 string
int *const pvalue
Definition settings.c:138
const val_name_func_t name
Definition settings.c:133
const int max_value
Definition settings.c:141
int game_value
Definition settings.c:143
unsigned game_value
Definition settings.c:168
char *const value
Definition settings.c:147
const help_callback_func_t help_func
Definition settings.c:115
const char * name
Definition settings.c:93
enum setting_default_level game_setdef
Definition settings.c:185
bool *const pvalue
Definition settings.c:130
const enum_validate_func_t validate
Definition settings.c:158
const char * extra_help
Definition settings.c:112
const char * short_help
Definition settings.c:104
const int store_size
Definition settings.c:156
const action_callback_func_t action
Definition settings.c:173
bool ruleset_settable
Definition settings.c:181
struct setting::@116::@122 bitwise
enum setting_lock_level lock
Definition settings.c:176
void *const pvalue
Definition settings.c:155
const int min_value
Definition settings.c:140
enum sset_type stype
Definition settings.c:117
struct setting::@116::@119 integer
const bool_validate_func_t validate
Definition settings.c:132
const string_validate_func_t validate
Definition settings.c:150
const size_t value_size
Definition settings.c:149
bool rslock
Definition settings.c:179
const bitwise_validate_func_t validate
Definition settings.c:166
const unsigned default_value
Definition settings.c:165
const bool default_value
Definition settings.c:131
unsigned *const pvalue
Definition settings.c:164
enum sset_level slevel
Definition settings.c:119
enum sset_category scategory
Definition settings.c:118
struct setting * set
Definition settings.h:82
bool compat
Definition settings.h:83
const char * support
Definition settings.h:29
const char * pretty
Definition settings.h:31
Definition map.c:41
char ** vec
struct civ_map map
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:974
size_t fc_strlcpy(char *dest, const char *src, size_t n)
Definition support.c:791
int fc_strcasecmp(const char *str0, const char *str1)
Definition support.c:189
size_t fc_strlcat(char *dest, const char *src, size_t n)
Definition support.c:836
int fc_strncasecmp(const char *str0, const char *str1, size_t n)
Definition support.c:238
#define sz_strlcpy(dest, src)
Definition support.h:189
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
#define bool
Definition support.h:71
#define fc__fallthrough
Definition support.h:119
#define terrain_type_iterate(_p)
Definition terrain.h:373
#define terrain_type_iterate_end
Definition terrain.h:379
#define terrain_has_flag(terr, flag)
Definition terrain.h:283
void timer_destroy(struct timer *t)
Definition timing.c:208
void timer_start(struct timer *t)
Definition timing.c:264
void timer_stop(struct timer *t)
Definition timing.c:308
struct timer * timer_renew(struct timer *t, enum timer_timetype type, enum timer_use use, const char *name)
Definition timing.c:180
@ TIMER_ACTIVE
Definition timing.h:46
@ TIMER_USER
Definition timing.h:42
struct unit_type * get_role_unit(int role, int role_index)
Definition unittype.c:2253
#define utype_class(_t_)
Definition unittype.h:749
#define uclass_index(_c_)
Definition unittype.h:742