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 existent 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 modifying the pretty name of an existent 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 preceding character was a primary label, e.g.
1011 * NHhAadb. It is false if the preceding 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 irrelevant, 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
3252 GEN_INT("luatimeout", game.lua_timeout,
3254 N_("Lua timeout"),
3255 N_("Time in seconds that a single lua script can run before it gets "
3256 "forcibly terminated."), NULL, NULL, NULL,
3258
3261 N_("Metaserver info line"),
3262 N_("User defined metaserver info line. For most of the time "
3263 "a user defined metamessage will be used instead of an "
3264 "automatically generated message. "
3265 "Set to empty (\"\", not \"empty\") to always use an "
3266 "automatically generated meta server message."),
3268
3269 GEN_ENUM("ailevel", game.info.skill_level,
3271 N_("Level of new AIs"),
3272 N_("Difficulty level of any AI players to be created now on. "
3273 "Changing value of this setting does not affect "
3274 "existing players."), NULL, NULL, NULL,
3276
3279 N_("Default AI type"),
3280 N_("Name of the default AI type. New AI players will be "
3281 "created with that type by default. Changing this "
3282 "setting does not affect existing AI players."),
3284};
3285
3286#undef GEN_BOOL
3287#undef GEN_INT
3288#undef GEN_STRING
3289#undef GEN_ENUM
3290#undef GEN_BITWISE
3291
3292/* The number of settings, not including the END. */
3294
3295/************************************************************************/
3299{
3300 return (0 <= id && id < SETTINGS_NUM ? settings + id : NULL);
3301}
3302
3303/************************************************************************/
3306struct setting *setting_by_name(const char *name)
3307{
3309
3311 if (0 == strcmp(name, pset->name)) {
3312 return pset;
3313 }
3315 return NULL;
3316}
3317
3318/************************************************************************/
3321int setting_number(const struct setting *pset)
3322{
3323 fc_assert_ret_val(pset != NULL, -1);
3324 return pset - settings;
3325}
3326
3327/************************************************************************/
3330const char *setting_name(const struct setting *pset)
3331{
3332 return pset->name;
3333}
3334
3335/************************************************************************/
3338const char *setting_short_help(const struct setting *pset)
3339{
3340 return pset->short_help;
3341}
3342
3343/************************************************************************/
3347const char *setting_extra_help(const struct setting *pset, bool constant)
3348{
3349 if (!constant && pset->help_func != NULL) {
3350 return pset->help_func(pset);
3351 }
3352
3353 return _(pset->extra_help);
3354}
3355
3356/************************************************************************/
3360{
3361 return pset->stype;
3362}
3363
3364/************************************************************************/
3368{
3369 return pset->slevel;
3370}
3371
3372/************************************************************************/
3376{
3377 return pset->scategory;
3378}
3379
3380/************************************************************************/
3385static bool setting_is_free_to_change(const struct setting *pset,
3386 char *reject_msg,
3387 size_t reject_msg_len)
3388{
3389 switch (pset->sclass) {
3390 case SSET_MAP_SIZE:
3391 case SSET_MAP_GEN:
3392 /* Only change map options if we don't yet have a map: */
3393 if (map_is_empty()) {
3394 return TRUE;
3395 }
3396
3398 _("The setting '%s' can't be modified after the map "
3399 "is fixed."), setting_name(pset));
3400 return FALSE;
3401
3403 /* Like SSET_RULES except that it can be changed before the game starts
3404 * for heavy scenarios. A heavy scenario comes with players. It can
3405 * include cities, units, diplomatic relations and other complex
3406 * state. Make sure that changing a setting can't make the state of a
3407 * heavy scenario illegal if you want to change it from SSET_RULES to
3408 * SSET_RULES_SCENARIO. */
3409
3411 && server_state() == S_S_INITIAL) {
3412 /* Special case detected. */
3413 return TRUE;
3414 }
3415
3416 /* The special case didn't make it legal to change the setting. Don't
3417 * give up. It could still be legal. Fall through so the non special
3418 * cases are checked too. */
3420
3421 case SSET_MAP_ADD:
3422 case SSET_PLAYERS:
3423 case SSET_GAME_INIT:
3424 case SSET_RULES:
3425 /* Only change start params and most rules if we don't yet have a map,
3426 * or if we do have a map but its a scenario one (ie, the game has
3427 * never actually been started).
3428 */
3429 if (map_is_empty() || game.info.is_new_game) {
3430 return TRUE;
3431 }
3432
3434 _("The setting '%s' can't be modified after the game "
3435 "has started."), setting_name(pset));
3436 return FALSE;
3437
3440 case SSET_META:
3441 /* These can always be changed: */
3442 return TRUE;
3443 }
3444
3445 log_error("Wrong class variant for setting %s (%d): %d.",
3447 settings_snprintf(reject_msg, reject_msg_len, _("Internal error."));
3448
3449 return FALSE;
3450}
3451
3452/************************************************************************/
3458 struct connection *caller, char *reject_msg,
3459 size_t reject_msg_len)
3460{
3461 if (caller
3462 && (caller->access_level < pset->access_level_write)) {
3464 _("You are not allowed to change the setting '%s'."),
3466 return FALSE;
3467 }
3468
3469 switch (pset->lock) {
3470 case SLOCK_NONE:
3471 break;
3472 case SLOCK_RULESET:
3473 /* Setting is locked by the ruleset */
3475 _("The setting '%s' is locked by the ruleset."),
3477 return FALSE;
3478 case SLOCK_ADMIN:
3479 /* Setting is locked by admin */
3481 _("The setting '%s' is locked by admin."),
3483 return FALSE;
3484 }
3485
3487}
3488
3489/************************************************************************/
3494 enum cmdlevel plevel)
3495{
3496 return (plevel >= pset->access_level_read);
3497}
3498
3499/************************************************************************/
3504 struct connection *caller)
3505{
3506 return (!caller
3508}
3509
3510/************************************************************************/
3516static enum m_pre_result
3518 const char *prefix, int *ind_result,
3519 const char **matches, size_t max_matches,
3520 size_t *pnum_matches)
3521{
3522 const struct sset_val_name *name;
3523 size_t len = strlen(prefix);
3524 size_t num_matches;
3525 int i;
3526
3527 *pnum_matches = 0;
3528
3529 if (0 == len) {
3530 return M_PRE_EMPTY;
3531 }
3532
3533 for (i = 0, num_matches = 0; (name = name_fn(i)); i++) {
3534 if (0 == fc_strncasecmp(name->support, prefix, len)) {
3535 if (strlen(name->support) == len) {
3536 *ind_result = i;
3537 return M_PRE_EXACT;
3538 }
3539 if (num_matches < max_matches) {
3540 matches[num_matches] = name->support;
3541 (*pnum_matches)++;
3542 }
3543 if (0 == num_matches++) {
3544 *ind_result = i;
3545 }
3546 }
3547 }
3548
3549 if (1 == num_matches) {
3550 return M_PRE_ONLY;
3551 } else if (1 < num_matches) {
3552 return M_PRE_AMBIGUOUS;
3553 } else {
3554 return M_PRE_FAIL;
3555 }
3556}
3557
3558/************************************************************************/
3563 const char *prefix, int *pvalue,
3564 char *reject_msg,
3565 size_t reject_msg_len)
3566{
3567 const char *matches[16];
3568 size_t num_matches;
3569
3570 switch (setting_match_prefix_base(name_fn, prefix, pvalue, matches,
3572 case M_PRE_EXACT:
3573 case M_PRE_ONLY:
3574 return TRUE; /* Ok. */
3575 case M_PRE_AMBIGUOUS:
3576 {
3577 struct astring astr = ASTRING_INIT;
3578
3579 fc_assert(2 <= num_matches);
3581 _("\"%s\" prefix is ambiguous. Candidates are: %s."),
3582 prefix,
3584 astr_free(&astr);
3585 }
3586 return FALSE;
3587 case M_PRE_EMPTY:
3588 settings_snprintf(reject_msg, reject_msg_len, _("Missing value."));
3589 return FALSE;
3590 case M_PRE_LONG:
3591 case M_PRE_FAIL:
3592 case M_PRE_LAST:
3593 break;
3594 }
3595
3597 _("No match for \"%s\"."), prefix);
3598 return FALSE;
3599}
3600
3601/************************************************************************/
3604static const char *setting_bool_to_str(const struct setting *pset,
3605 bool value, bool pretty,
3606 char *buf, size_t buf_len)
3607{
3608 const struct sset_val_name *name = pset->boolean.name(value);
3609
3610 if (pretty) {
3611 fc_snprintf(buf, buf_len, "%s", Q_(name->pretty));
3612 } else {
3613 fc_strlcpy(buf, name->support, buf_len);
3614 }
3615 return buf;
3616}
3617
3618/************************************************************************/
3625static bool setting_bool_validate_base(const struct setting *pset,
3626 const char *val, int *pint_val,
3627 struct connection *caller,
3628 char *reject_msg,
3629 size_t reject_msg_len)
3630{
3631 char buf[256];
3632
3633 if (SST_BOOL != pset->stype) {
3635 _("This setting is not a boolean."));
3636 return FALSE;
3637 }
3638
3639 sz_strlcpy(buf, val);
3641
3642 return (setting_match_prefix(pset->boolean.name, buf, pint_val,
3644 && (NULL == pset->boolean.validate
3645 || pset->boolean.validate(0 != *pint_val, caller, reject_msg,
3646 reject_msg_len)));
3647}
3648
3649/************************************************************************/
3654bool setting_bool_set(struct setting *pset, const char *val,
3655 struct connection *caller, char *reject_msg,
3656 size_t reject_msg_len)
3657{
3658 int int_val;
3659
3661 || !setting_bool_validate_base(pset, val, &int_val, caller,
3663 return FALSE;
3664 }
3665
3666 *pset->boolean.pvalue = (0 != int_val);
3667 return TRUE;
3668}
3669
3670/************************************************************************/
3674{
3676
3677 return *pset->boolean.pvalue;
3678}
3679
3680/************************************************************************/
3685bool setting_bool_validate(const struct setting *pset, const char *val,
3686 struct connection *caller, char *reject_msg,
3687 size_t reject_msg_len)
3688{
3689 int int_val;
3690
3691 return setting_bool_validate_base(pset, val, &int_val, caller,
3693}
3694
3695/************************************************************************/
3699static const char *setting_bool_secfile_str(secfile_data_t data, int val)
3700{
3701 const struct sset_val_name *name =
3702 ((const struct setting *) data)->boolean.name(val);
3703
3704 return (NULL != name ? name->support : NULL);
3705}
3706
3707/************************************************************************/
3710static const char *setting_int_to_str(const struct setting *pset,
3711 int value, bool pretty,
3712 char *buf, size_t buf_len)
3713{
3714 fc_snprintf(buf, buf_len, "%d", value);
3715 return buf;
3716}
3717
3718/************************************************************************/
3721int setting_int_min(const struct setting *pset)
3722{
3723 fc_assert_ret_val(pset->stype == SST_INT, 0);
3724 return pset->integer.min_value;
3725}
3726
3727/************************************************************************/
3730int setting_int_max(const struct setting *pset)
3731{
3732 fc_assert_ret_val(pset->stype == SST_INT, 0);
3733 return pset->integer.max_value;
3734}
3735
3736/************************************************************************/
3740bool setting_int_set(struct setting *pset, int val,
3741 struct connection *caller, char *reject_msg,
3742 size_t reject_msg_len)
3743{
3745 || !setting_int_validate(pset, val, caller, reject_msg,
3746 reject_msg_len)) {
3747 return FALSE;
3748 }
3749
3750 *pset->integer.pvalue = val;
3751 return TRUE;
3752}
3753
3754/************************************************************************/
3760bool setting_int_validate(const struct setting *pset, int val,
3761 struct connection *caller, char *reject_msg,
3762 size_t reject_msg_len)
3763{
3764 if (SST_INT != pset->stype) {
3766 _("This setting is not an integer."));
3767 return FALSE;
3768 }
3769
3770 if (val < pset->integer.min_value || val > pset->integer.max_value) {
3772 _("Value out of range: %d (min: %d; max: %d)."),
3773 val, pset->integer.min_value, pset->integer.max_value);
3774 return FALSE;
3775 }
3776
3777 return (!pset->integer.validate
3778 || pset->integer.validate(val, caller, reject_msg,
3780}
3781
3782/************************************************************************/
3786{
3788
3789 return *pset->integer.pvalue;
3790}
3791
3792/************************************************************************/
3795static const char *setting_str_to_str(const struct setting *pset,
3796 const char *value, bool pretty,
3797 char *buf, size_t buf_len)
3798{
3799 if (pretty) {
3800 fc_snprintf(buf, buf_len, "\"%s\"", value);
3801 } else {
3803 }
3804 return buf;
3805}
3806
3807/************************************************************************/
3811bool setting_str_set(struct setting *pset, const char *val,
3812 struct connection *caller, char *reject_msg,
3813 size_t reject_msg_len)
3814{
3816 || !setting_str_validate(pset, val, caller, reject_msg,
3817 reject_msg_len)) {
3818 return FALSE;
3819 }
3820
3821 fc_strlcpy(pset->string.value, val, pset->string.value_size);
3822 return TRUE;
3823}
3824
3825/************************************************************************/
3831bool setting_str_validate(const struct setting *pset, const char *val,
3832 struct connection *caller, char *reject_msg,
3833 size_t reject_msg_len)
3834{
3835 if (SST_STRING != pset->stype) {
3837 _("This setting is not a string."));
3838 return FALSE;
3839 }
3840
3841 if (strlen(val) >= pset->string.value_size) {
3843 _("String value too long (max length: %lu)."),
3844 (unsigned long) pset->string.value_size);
3845 return FALSE;
3846 }
3847
3848 return (!pset->string.validate
3849 || pset->string.validate(val, caller, reject_msg,
3851}
3852
3853/************************************************************************/
3857{
3859
3860 return pset->string.value;
3861}
3862
3863/************************************************************************/
3868{
3869 struct sf_cb_data *info = (struct sf_cb_data *)data;
3870 const struct sset_val_name *name;
3871
3872 name = info->set->enumerator.name(val);
3873
3874 if (info->compat && name != NULL) {
3875 const char *ret = setcompat_current_val_from_previous(info->set,
3876 name->support);
3877
3878 if (ret != NULL) {
3879 return ret;
3880 }
3881 }
3882
3883 return (NULL != name ? name->support : NULL);
3884}
3885
3886/************************************************************************/
3890const char *setting_enum_val(const struct setting *pset, int val, bool pretty)
3891{
3892 const struct sset_val_name *name;
3893
3894 fc_assert_ret_val(SST_ENUM == pset->stype, NULL);
3895 name = pset->enumerator.name(val);
3896 if (NULL == name) {
3897 return NULL;
3898 } else if (pretty) {
3899 return _(name->pretty);
3900 } else {
3901 return name->support;
3902 }
3903}
3904
3905/************************************************************************/
3909static const char *setting_enum_to_str(const struct setting *pset,
3910 int value, bool pretty,
3911 char *buf, size_t buf_len)
3912{
3913 const struct sset_val_name *name = pset->enumerator.name(value);
3914
3915 if (pretty) {
3916 fc_snprintf(buf, buf_len, "\"%s\" (%s)",
3917 Q_(name->pretty), name->support);
3918 } else {
3919 fc_strlcpy(buf, name->support, buf_len);
3920 }
3921 return buf;
3922}
3923
3924/************************************************************************/
3931static bool setting_enum_validate_base(const struct setting *pset,
3932 const char *val, int *pint_val,
3933 struct connection *caller,
3934 char *reject_msg,
3935 size_t reject_msg_len)
3936{
3937 char buf[256];
3938
3939 if (SST_ENUM != pset->stype) {
3941 _("This setting is not an enumerator."));
3942 return FALSE;
3943 }
3944
3945 sz_strlcpy(buf, val);
3947
3948 return (setting_match_prefix(pset->enumerator.name, buf, pint_val,
3950 && (NULL == pset->enumerator.validate
3951 || pset->enumerator.validate(*pint_val, caller, reject_msg,
3952 reject_msg_len)));
3953}
3954
3955/************************************************************************/
3958static bool set_enum_value(struct setting *pset, int val)
3959{
3960 switch (pset->enumerator.store_size) {
3961 case sizeof(int):
3962 {
3963 int *to_int = pset->enumerator.pvalue;
3964
3965 *to_int = val;
3966 }
3967 break;
3968 case sizeof(char):
3969 {
3970 char *to_char = pset->enumerator.pvalue;
3971
3972 *to_char = (char) val;
3973 }
3974 break;
3975 case sizeof(short):
3976 {
3977 short *to_short = pset->enumerator.pvalue;
3978
3979 *to_short = (short) val;
3980 }
3981 break;
3982 default:
3983 return FALSE;
3984 }
3985
3986 return TRUE;
3987}
3988
3989/************************************************************************/
3992int read_enum_value(const struct setting *pset)
3993{
3994 int val;
3995
3996 switch (pset->enumerator.store_size) {
3997 case sizeof(int):
3998 val = *((int *)pset->enumerator.pvalue);
3999 break;
4000 case sizeof(char):
4001 val = *((char *)pset->enumerator.pvalue);
4002 break;
4003 case sizeof(short):
4004 val = *((short *)pset->enumerator.pvalue);
4005 break;
4006 default:
4007 log_error("Illegal enum store size %d, can't read value", pset->enumerator.store_size);
4008 return 0;
4009 }
4010
4011 return val;
4012}
4013
4014/************************************************************************/
4019bool setting_enum_set(struct setting *pset, const char *val,
4020 struct connection *caller, char *reject_msg,
4021 size_t reject_msg_len)
4022{
4023 int int_val;
4024
4026 return FALSE;
4027 }
4028
4029 if (!setting_enum_validate_base(pset, val, &int_val, caller,
4031 return FALSE;
4032 }
4033
4034 if (!set_enum_value(pset, int_val)) {
4035 log_error("Illegal enumerator value size %d for %s",
4036 pset->enumerator.store_size, val);
4037 return FALSE;
4038 }
4039
4040 return TRUE;
4041}
4042
4043/************************************************************************/
4048bool setting_enum_validate(const struct setting *pset, const char *val,
4049 struct connection *caller, char *reject_msg,
4050 size_t reject_msg_len)
4051{
4052 int int_val;
4053
4054 return setting_enum_validate_base(pset, val, &int_val, caller,
4056}
4057
4058/************************************************************************/
4063{
4064 struct sf_cb_data *info = (struct sf_cb_data *)data;
4065 const struct sset_val_name *name = info->set->bitwise.name(bit);
4066
4067 if (info->compat && name == NULL) {
4068 if (!fc_strcasecmp("topology", setting_name(info->set))) {
4069 if ((1 << bit) == TF_OLD_WRAPX) {
4070 return "WrapX";
4071 }
4072 if ((1 << bit) == TF_OLD_WRAPY) {
4073 return "WrapY";
4074 }
4075 }
4076 }
4077
4078 return (NULL != name ? name->support : NULL);
4079}
4080
4081/************************************************************************/
4085const char *setting_bitwise_bit(const struct setting *pset,
4086 int bit, bool pretty)
4087{
4088 const struct sset_val_name *name;
4089
4091 name = pset->bitwise.name(bit);
4092 if (NULL == name) {
4093 return NULL;
4094 } else if (pretty) {
4095 return _(name->pretty);
4096 } else {
4097 return name->support;
4098 }
4099}
4100
4101/************************************************************************/
4104static const char *setting_bitwise_to_str(const struct setting *pset,
4105 unsigned value, bool pretty,
4106 char *buf, size_t buf_len)
4107{
4108 const struct sset_val_name *name;
4109 char *old_buf = buf;
4110 int bit;
4111
4112 if (pretty) {
4113 char buf2[256];
4114 struct astring astr = ASTRING_INIT;
4115 struct strvec *vec = strvec_new();
4116 size_t len;
4117
4118 for (bit = 0; (name = pset->bitwise.name(bit)); bit++) {
4119 if ((1 << bit) & value) {
4120 /* TRANS: only emphasizing a string. */
4121 fc_snprintf(buf2, sizeof(buf2), _("\"%s\""), Q_(name->pretty));
4123 }
4124 }
4125
4126 if (0 == strvec_size(vec)) {
4127 /* No value. */
4128 fc_assert(0 == value);
4129 /* TRANS: Bitwise setting has no bits set. */
4130 fc_strlcpy(buf, _("empty value"), buf_len);
4132 return buf;
4133 }
4134
4138 astr_free(&astr);
4139 fc_strlcat(buf, " (", buf_len);
4140 len = strlen(buf);
4141 buf += len;
4142 buf_len -= len;
4143 }
4144
4145 /* Long support part. */
4146 buf[0] = '\0';
4147 for (bit = 0; (name = pset->bitwise.name(bit)); bit++) {
4148 if ((1 << bit) & value) {
4149 if ('\0' != buf[0]) {
4150 fc_strlcat(buf, "|", buf_len);
4151 }
4152 fc_strlcat(buf, name->support, buf_len);
4153 }
4154 }
4155
4156 if (pretty) {
4157 fc_strlcat(buf, ")", buf_len);
4158 }
4159 return old_buf;
4160}
4161
4162/************************************************************************/
4170 const char *val,
4171 unsigned *pint_val,
4172 struct connection *caller,
4173 char *reject_msg,
4174 size_t reject_msg_len)
4175{
4176 char buf[256];
4177 const char *p;
4178 int bit;
4179
4180 if (SST_BITWISE != pset->stype) {
4182 _("This setting is not a bitwise."));
4183 return FALSE;
4184 }
4185
4186 *pint_val = 0;
4187
4188 /* Value names are separated by '|'. */
4189 do {
4190 p = strchr(val, '|');
4191 if (NULL != p) {
4192 p++;
4193 fc_strlcpy(buf, val, MIN(p - val, sizeof(buf)));
4194 } else {
4195 /* Last segment, full copy. */
4196 sz_strlcpy(buf, val);
4197 }
4199 if (NULL == p && '\0' == buf[0] && 0 == *pint_val) {
4200 /* Empty string = value 0. */
4201 break;
4202 } else if (!setting_match_prefix(pset->bitwise.name, buf, &bit,
4204 return FALSE;
4205 }
4206 *pint_val |= 1 << bit;
4207 val = p;
4208 } while (NULL != p);
4209
4210 return (NULL == pset->bitwise.validate
4211 || pset->bitwise.validate(*pint_val, caller,
4213}
4214
4215/************************************************************************/
4220bool setting_bitwise_set(struct setting *pset, const char *val,
4221 struct connection *caller, char *reject_msg,
4222 size_t reject_msg_len)
4223{
4224 unsigned int_val;
4225
4227 || !setting_bitwise_validate_base(pset, val, &int_val, caller,
4229 return FALSE;
4230 }
4231
4232 *pset->bitwise.pvalue = int_val;
4233 return TRUE;
4234}
4235
4236/************************************************************************/
4241bool setting_bitwise_validate(const struct setting *pset, const char *val,
4242 struct connection *caller, char *reject_msg,
4243 size_t reject_msg_len)
4244{
4245 unsigned int_val;
4246
4247 return setting_bitwise_validate_base(pset, val, &int_val, caller,
4249}
4250
4251/************************************************************************/
4255{
4257
4258 return *pset->bitwise.pvalue;
4259}
4260
4261/************************************************************************/
4264const char *setting_value_name(const struct setting *pset, bool pretty,
4265 char *buf, size_t buf_len)
4266{
4270
4271 switch (pset->stype) {
4272 case SST_BOOL:
4273 return setting_bool_to_str(pset, *pset->boolean.pvalue,
4274 pretty, buf, buf_len);
4275 case SST_INT:
4276 return setting_int_to_str(pset, *pset->integer.pvalue,
4277 pretty, buf, buf_len);
4278 case SST_STRING:
4279 return setting_str_to_str(pset, pset->string.value,
4280 pretty, buf, buf_len);
4281 case SST_ENUM:
4283 pretty, buf, buf_len);
4284 case SST_BITWISE:
4285 return setting_bitwise_to_str(pset, *pset->bitwise.pvalue,
4286 pretty, buf, buf_len);
4287 case SST_COUNT:
4288 /* Error logged below. */
4289 break;
4290 }
4291
4292 log_error("%s(): Setting \"%s\" (nb %d) not handled in switch statement.",
4294 return NULL;
4295}
4296
4297/************************************************************************/
4300const char *setting_default_name(const struct setting *pset, bool pretty,
4301 char *buf, size_t buf_len)
4302{
4306
4307 switch (pset->stype) {
4308 case SST_BOOL:
4309 return setting_bool_to_str(pset, pset->boolean.default_value,
4310 pretty, buf, buf_len);
4311 case SST_INT:
4312 return setting_int_to_str(pset, pset->integer.default_value,
4313 pretty, buf, buf_len);
4314 case SST_STRING:
4315 return setting_str_to_str(pset, pset->string.default_value,
4316 pretty, buf, buf_len);
4317 case SST_ENUM:
4318 return setting_enum_to_str(pset, pset->enumerator.default_value,
4319 pretty, buf, buf_len);
4320 case SST_BITWISE:
4321 return setting_bitwise_to_str(pset, pset->bitwise.default_value,
4322 pretty, buf, buf_len);
4323 case SST_COUNT:
4324 /* Error logged below. */
4325 break;
4326 }
4327
4328 log_error("%s(): Setting \"%s\" (nb %d) not handled in switch statement.",
4330 return NULL;
4331}
4332
4333/************************************************************************/
4337{
4338 switch (pset->stype) {
4339 case SST_BOOL:
4340 (*pset->boolean.pvalue) = pset->boolean.default_value;
4341 break;
4342 case SST_INT:
4343 (*pset->integer.pvalue) = pset->integer.default_value;
4344 break;
4345 case SST_STRING:
4346 fc_strlcpy(pset->string.value, pset->string.default_value,
4347 pset->string.value_size);
4348 break;
4349 case SST_ENUM:
4350 set_enum_value(pset, pset->enumerator.default_value);
4351 break;
4352 case SST_BITWISE:
4353 (*pset->bitwise.pvalue) = pset->bitwise.default_value;
4354 break;
4355 case SST_COUNT:
4356 fc_assert(pset->stype != SST_COUNT);
4357 break;
4358 }
4359
4360 pset->setdef = SETDEF_INTERNAL;
4361}
4362
4363/************************************************************************/
4366void setting_action(const struct setting *pset)
4367{
4368 if (pset->action != NULL) {
4369 pset->action(pset);
4370 }
4371}
4372
4373/************************************************************************/
4376bool settings_ruleset(struct section_file *file, const char *section,
4377 bool act, bool compat)
4378{
4379 const char *name;
4380 int j;
4381
4382 /* Unlock all settings. */
4385 if (pset->ruleset_settable && !setting_locked(pset)) {
4387 }
4389
4390 /* Settings */
4391 if (NULL == secfile_section_by_name(file, section)) {
4392 /* No settings in ruleset file */
4393 log_verbose("no [%s] section for game settings in %s", section,
4394 secfile_name(file));
4395 } else {
4397
4398 for (j = 0; (name = secfile_lookup_str_default(file, NULL, "%s.set%d.name",
4399 section, j)); j++) {
4400 char path[256];
4401
4403 /* Skip this setting for now; handle it later */
4405 continue;
4406 }
4407
4408 fc_snprintf(path, sizeof(path), "%s.set%d", section, j);
4409
4410 if (compat) {
4412 }
4413
4414 if (!setting_ruleset_one(file, name, path, compat)) {
4415 log_error("unknown unsettable setting in '%s': %s",
4416 secfile_name(file), name);
4417 }
4418 }
4419
4423 }
4424 }
4425
4426 /* Execute all setting actions to consider actions due to the
4427 * default values. */
4428 if (act) {
4430 if (pset->ruleset_settable) {
4432 }
4434 }
4435
4437
4438 /* send game settings */
4440
4441 return TRUE;
4442}
4443
4444/***********************************************************************/
4447static inline void setting_ruleset_setdef(struct setting *pset)
4448{
4449 pset->setdef = SETDEF_RULESET;
4450}
4451
4452/************************************************************************/
4455static bool setting_ruleset_one(struct section_file *file,
4456 const char *name, const char *path,
4457 bool compat)
4458{
4459 struct setting *pset = NULL;
4460 char reject_msg[256], buf[256];
4461 bool lock;
4462 struct sf_cb_data info = { pset, compat };
4463
4466 pset = pset_check;
4467 break;
4468 }
4470
4471 if (pset == NULL || !pset->ruleset_settable) {
4472 /* No setting found or it's not settable by ruleset */
4473 return FALSE;
4474 }
4475
4476 if (!setting_locked(pset)) {
4477 info.set = pset;
4478 info.compat = compat;
4479
4480 switch (pset->stype) {
4481 case SST_BOOL:
4482 {
4483 int ival;
4484 bool val;
4485
4486 /* Allow string with same boolean representation as accepted on
4487 * server command line */
4490 "%s.value", path)) {
4491 val = (ival != 0);
4492 } else if (!secfile_lookup_bool(file, &val, "%s.value", path)) {
4493 log_error("Can't read value for setting '%s': %s", name,
4494 secfile_error());
4495 break;
4496 }
4497 if (val != *pset->boolean.pvalue) {
4498 if (NULL == pset->boolean.validate
4499 || pset->boolean.validate(val, NULL, reject_msg,
4500 sizeof(reject_msg))) {
4501 *pset->boolean.pvalue = val;
4502 log_normal(_("Ruleset: '%s' has been set to %s."),
4504 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4505 } else {
4506 log_error("%s", reject_msg);
4507 }
4508 }
4509 }
4510 break;
4511
4512 case SST_INT:
4513 {
4514 int val;
4515
4516 if (!secfile_lookup_int(file, &val, "%s.value", path)) {
4517 log_error("Can't read value for setting '%s': %s", name,
4518 secfile_error());
4519 } else if (val != *pset->integer.pvalue) {
4521 sizeof(reject_msg))) {
4522 log_normal(_("Ruleset: '%s' has been set to %s."),
4524 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4525 } else {
4526 log_error("%s", reject_msg);
4527 }
4528 }
4529 }
4530 break;
4531
4532 case SST_STRING:
4533 {
4534 const char *val = secfile_lookup_str(file, "%s.value", path);
4535
4536 if (NULL == val) {
4537 log_error("Can't read value for setting '%s': %s", name,
4538 secfile_error());
4539 } else if (0 != strcmp(val, pset->string.value)) {
4541 sizeof(reject_msg))) {
4542 log_normal(_("Ruleset: '%s' has been set to %s."),
4544 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4545 } else {
4546 log_error("%s", reject_msg);
4547 }
4548 }
4549 }
4550 break;
4551
4552 case SST_ENUM:
4553 {
4554 int val;
4555
4556 if (!secfile_lookup_enum_data(file, &val, FALSE,
4558 "%s.value", path)) {
4559 log_error("Can't read value for setting '%s': %s",
4560 name, secfile_error());
4561 } else if (val != read_enum_value(pset)) {
4562 if (NULL == pset->enumerator.validate
4563 || pset->enumerator.validate(val, NULL, reject_msg,
4564 sizeof(reject_msg))) {
4565 set_enum_value(pset, val);
4566 log_normal(_("Ruleset: '%s' has been set to %s."),
4568 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4569 } else {
4570 log_error("%s", reject_msg);
4571 }
4572 }
4573 }
4574 break;
4575
4576 case SST_BITWISE:
4577 {
4578 int val;
4579
4580 if (!secfile_lookup_enum_data(file, &val, TRUE,
4582 "%s.value", path)) {
4583 log_error("Can't read value for setting '%s': %s",
4584 name, secfile_error());
4585 } else if (val != *pset->bitwise.pvalue) {
4586 /* RSFORMAT_3_1 */
4587 if (compat && !fc_strcasecmp("topology", name)) {
4588 struct setting *wrap = setting_by_name("wrap");
4589
4590 if (val & TF_OLD_WRAPX) {
4591 if (val & TF_OLD_WRAPY) {
4592 setting_bitwise_set(wrap, "WrapX|WrapY", NULL, NULL, 0);
4593 } else {
4594 setting_bitwise_set(wrap, "WrapX", NULL, NULL, 0);
4595 }
4596 } else if (val & TF_OLD_WRAPY) {
4597 setting_bitwise_set(wrap, "WrapY", NULL, NULL, 0);
4598 } else {
4600 }
4601
4602 val &= ~(TF_OLD_WRAPX | TF_OLD_WRAPY);
4603
4604 log_normal(_("Ruleset: '%s' has been set to %s."),
4606 setting_value_name(wrap, TRUE, buf, sizeof(buf)));
4607 }
4608
4609 if (NULL == pset->bitwise.validate
4610 || pset->bitwise.validate((unsigned) val, NULL,
4611 reject_msg, sizeof(reject_msg))) {
4612 *pset->bitwise.pvalue = val;
4613 log_normal(_("Ruleset: '%s' has been set to %s."),
4615 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4616 } else {
4617 log_error("%s", reject_msg);
4618 }
4619 }
4620 }
4621 break;
4622
4623 case SST_COUNT:
4624 fc_assert(pset->stype != SST_COUNT);
4625 break;
4626 }
4627
4629 }
4630
4631 /* set lock */
4632 lock = secfile_lookup_bool_default(file, FALSE, "%s.lock", path);
4633
4634 if (lock) {
4635 /* Set lock */
4637 log_normal(_("Ruleset: '%s' has been locked by the ruleset."),
4639 }
4640
4641 return TRUE;
4642}
4643
4644/************************************************************************/
4648{
4649 switch (setting_type(pset)) {
4650 case SST_BOOL:
4651 return (*pset->boolean.pvalue != pset->boolean.default_value);
4652 case SST_INT:
4653 return (*pset->integer.pvalue != pset->integer.default_value);
4654 case SST_STRING:
4655 return (0 != strcmp(pset->string.value, pset->string.default_value));
4656 case SST_ENUM:
4657 return (read_enum_value(pset) != pset->enumerator.default_value);
4658 case SST_BITWISE:
4659 return (*pset->bitwise.pvalue != pset->bitwise.default_value);
4660 case SST_COUNT:
4661 /* Error logged below. */
4662 break;
4663 }
4664
4665 log_error("%s(): Setting \"%s\" (nb %d) not handled in switch statement.",
4667 return FALSE;
4668}
4669
4670/************************************************************************/
4673bool setting_locked(const struct setting *pset)
4674{
4675 return pset->lock != SLOCK_NONE;
4676}
4677
4678/************************************************************************/
4682{
4683 return pset->rslock;
4684}
4685
4686/************************************************************************/
4690{
4691 if (pset->lock < SLOCK_RULESET) {
4692 /* No downgrading the lock */
4693 pset->lock = SLOCK_RULESET;
4694 }
4695 pset->rslock = TRUE;
4696}
4697
4698/************************************************************************/
4702{
4703 pset->lock = SLOCK_ADMIN;
4704}
4705
4706/************************************************************************/
4710{
4711 if (pset->lock == SLOCK_RULESET) {
4712 /* No clearing upper level locks */
4713 pset->lock = SLOCK_RULESET;
4714 }
4715 pset->rslock = FALSE;
4716}
4717
4718/************************************************************************/
4722{
4723 if (pset->rslock) {
4724 pset->lock = SLOCK_RULESET;
4725 } else {
4726 pset->lock = SLOCK_NONE;
4727 }
4728}
4729
4730/************************************************************************/
4733static void setting_game_set(struct setting *pset, bool init)
4734{
4735 switch (setting_type(pset)) {
4736 case SST_BOOL:
4737 pset->boolean.game_value = *pset->boolean.pvalue;
4738 break;
4739
4740 case SST_INT:
4741 pset->integer.game_value = *pset->integer.pvalue;
4742 break;
4743
4744 case SST_STRING:
4745 if (init) {
4746 pset->string.game_value
4747 = fc_calloc(1, pset->string.value_size
4748 * sizeof(pset->string.game_value));
4749 }
4750 fc_strlcpy(pset->string.game_value, pset->string.value,
4751 pset->string.value_size);
4752 break;
4753
4754 case SST_ENUM:
4755 pset->enumerator.game_value = read_enum_value(pset);
4756 break;
4757
4758 case SST_BITWISE:
4759 pset->bitwise.game_value = *pset->bitwise.pvalue;
4760 break;
4761
4762 case SST_COUNT:
4764 break;
4765 }
4766
4767 pset->game_setdef = pset->setdef;
4768}
4769
4770/************************************************************************/
4773static void setting_game_free(struct setting *pset)
4774{
4775 if (setting_type(pset) == SST_STRING) {
4776 FC_FREE(pset->string.game_value);
4777 }
4778}
4779
4780/************************************************************************/
4784{
4785 char reject_msg[256] = "", buf[256];
4786 bool res = FALSE;
4787
4789 log_debug("Can't restore '%s': %s", setting_name(pset),
4790 reject_msg);
4791 return;
4792 }
4793
4794 if (pset->game_setdef == SETDEF_INTERNAL) {
4796 return;
4797 }
4798
4799 switch (setting_type(pset)) {
4800 case SST_BOOL:
4801 res = (NULL != setting_bool_to_str(pset, pset->boolean.game_value,
4802 FALSE, buf, sizeof(buf))
4804 sizeof(reject_msg)));
4805 break;
4806
4807 case SST_INT:
4808 res = setting_int_set(pset, pset->integer.game_value, NULL, reject_msg,
4809 sizeof(reject_msg));
4810 break;
4811
4812 case SST_STRING:
4813 res = setting_str_set(pset, pset->string.game_value, NULL, reject_msg,
4814 sizeof(reject_msg));
4815 break;
4816
4817 case SST_ENUM:
4818 res = (NULL != setting_enum_to_str(pset, pset->enumerator.game_value,
4819 FALSE, buf, sizeof(buf))
4821 sizeof(reject_msg)));
4822 break;
4823
4824 case SST_BITWISE:
4825 res = (NULL != setting_bitwise_to_str(pset, pset->bitwise.game_value,
4826 FALSE, buf, sizeof(buf))
4828 sizeof(reject_msg)));
4829 break;
4830
4831 case SST_COUNT:
4832 res = FALSE;
4833 break;
4834 }
4835
4836 if (!res) {
4837 log_error("Error restoring setting '%s' to the value from game start: "
4838 "%s", setting_name(pset), reject_msg);
4839 }
4840}
4841
4842/************************************************************************/
4846{
4850
4851 /* Settings from the start of the game are saved. */
4853}
4854
4855/************************************************************************/
4858void settings_game_save(struct section_file *file, const char *section)
4859{
4860 int set_count = 0;
4861
4863 char errbuf[200];
4864 struct sf_cb_data info = { pset, FALSE };
4865
4866 if (/* It's explicitly set to some value to save */
4868 /* It must be same at loading time as it was saving time, even if
4869 * freeciv's default has changed. */
4872
4874 "%s.set%d.name", section, set_count);
4875 switch (setting_type(pset)) {
4876 case SST_BOOL:
4877 secfile_insert_bool(file, *pset->boolean.pvalue,
4878 "%s.set%d.value", section, set_count);
4879 if (gamestart) {
4880 secfile_insert_bool(file, pset->boolean.game_value,
4881 "%s.set%d.gamestart", section, set_count);
4882 }
4883 break;
4884 case SST_INT:
4885 secfile_insert_int(file, *pset->integer.pvalue,
4886 "%s.set%d.value", section, set_count);
4887 if (gamestart) {
4888 secfile_insert_int(file, pset->integer.game_value,
4889 "%s.set%d.gamestart", section, set_count);
4890 }
4891 break;
4892 case SST_STRING:
4893 secfile_insert_str(file, pset->string.value,
4894 "%s.set%d.value", section, set_count);
4895 if (gamestart) {
4896 secfile_insert_str(file, pset->string.game_value,
4897 "%s.set%d.gamestart", section, set_count);
4898 }
4899 break;
4900 case SST_ENUM:
4903 "%s.set%d.value", section, set_count);
4904 if (gamestart) {
4905 secfile_insert_enum_data(file, pset->enumerator.game_value, FALSE,
4907 "%s.set%d.gamestart", section, set_count);
4908 }
4909 break;
4910 case SST_BITWISE:
4911 secfile_insert_enum_data(file, *pset->bitwise.pvalue, TRUE,
4913 "%s.set%d.value", section, set_count);
4914 if (gamestart) {
4915 secfile_insert_enum_data(file, pset->bitwise.game_value, TRUE,
4917 "%s.set%d.gamestart", section, set_count);
4918 }
4919 break;
4920 case SST_COUNT:
4922 secfile_insert_str(file, "Unknown setting type",
4923 "%s.set%d.value", section, set_count);
4924 if (gamestart) {
4925 secfile_insert_str(file, "Unknown setting type",
4926 "%s.set%d.gamestart", section, set_count);
4927 }
4928 break;
4929 }
4930 if (gamestart) {
4932 "%s.set%d.gamesetdef", section, set_count);
4933 }
4934 set_count++;
4935 }
4937
4938 secfile_insert_int(file, set_count, "%s.set_count", section);
4940 "%s.gamestart_valid", section);
4941}
4942
4943/************************************************************************/
4946void settings_game_load(struct section_file *file, const char *section)
4947{
4948 const char *name;
4949 char reject_msg[256], buf[256];
4950 int i, set_count;
4951 int oldcitymindist = game.info.citymindist; /* backwards compat, see below */
4952
4953 /* Compatibility with savegames created with older versions is usually
4954 * handled as conversions in savecompat.c compat_load_<version>() */
4955
4956 if (!secfile_lookup_int(file, &set_count, "%s.set_count", section)) {
4957 /* Old savegames and scenarios doesn't contain this, not an error. */
4958 log_verbose("Can't read the number of settings in the save file.");
4959 return;
4960 }
4961
4962 /* Check if the saved settings are valid settings from game start. */
4964 = secfile_lookup_bool_default(file, FALSE, "%s.gamestart_valid",
4965 section);
4966
4967 for (i = 0; i < set_count; i++) {
4968 name = secfile_lookup_str(file, "%s.set%d.name", section, i);
4969
4971 struct sf_cb_data info = { pset, FALSE };
4972
4973 if (fc_strcasecmp(setting_name(pset), name) != 0) {
4974 continue;
4975 }
4976
4977 /* Load the current value of the setting. */
4978 switch (pset->stype) {
4979 case SST_BOOL:
4980 {
4981 bool val;
4982
4983 if (!secfile_lookup_bool(file, &val, "%s.set%d.value", section,
4984 i)) {
4985 log_verbose("Option '%s' not defined in the savegame: %s", name,
4986 secfile_error());
4987 } else {
4988 pset->setdef = SETDEF_CHANGED;
4989
4990 if (val != *pset->boolean.pvalue) {
4992 sizeof(reject_msg))
4993 && (NULL == pset->boolean.validate
4994 || pset->boolean.validate(val, NULL, reject_msg,
4995 sizeof(reject_msg)))) {
4996 *pset->boolean.pvalue = val;
4997 log_normal(_("Savegame: '%s' has been set to %s."),
4999 setting_value_name(pset, TRUE, buf, sizeof(buf)));
5000 } else {
5001 log_error("Savegame: error restoring '%s' . (%s)",
5003 }
5004 } else {
5005 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
5007 }
5008 }
5009 }
5010 break;
5011
5012 case SST_INT:
5013 {
5014 int val;
5015
5016 if (!secfile_lookup_int(file, &val, "%s.set%d.value", section, i)) {
5017 log_verbose("Option '%s' not defined in the savegame: %s", name,
5018 secfile_error());
5019 } else {
5020 pset->setdef = SETDEF_CHANGED;
5021
5022 if (val != *pset->integer.pvalue) {
5024 sizeof(reject_msg))
5025 && (NULL == pset->integer.validate
5026 || pset->integer.validate(val, NULL, reject_msg,
5027 sizeof(reject_msg)))) {
5028 *pset->integer.pvalue = val;
5029 log_normal(_("Savegame: '%s' has been set to %s."),
5031 setting_value_name(pset, TRUE, buf, sizeof(buf)));
5032 } else {
5033 log_error("Savegame: error restoring '%s' . (%s)",
5035 }
5036 } else {
5037 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
5039 }
5040 }
5041 }
5042 break;
5043
5044 case SST_STRING:
5045 {
5046 const char *val = secfile_lookup_str(file, "%s.set%d.value",
5047 section, i);
5048
5049 if (NULL == val) {
5050 log_verbose("Option '%s' not defined in the savegame: %s", name,
5051 secfile_error());
5052 } else {
5053 pset->setdef = SETDEF_CHANGED;
5054
5055 if (0 != strcmp(val, pset->string.value)) {
5057 sizeof(reject_msg))) {
5058 log_normal(_("Savegame: '%s' has been set to %s."),
5060 setting_value_name(pset, TRUE, buf, sizeof(buf)));
5061 } else {
5062 log_error("Savegame: error restoring '%s' . (%s)",
5064 }
5065 } else {
5066 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
5068 }
5069 }
5070 }
5071 break;
5072
5073 case SST_ENUM:
5074 {
5075 int val;
5076
5077 if (!secfile_lookup_enum_data(file, &val, FALSE,
5079 "%s.set%d.value", section, i)) {
5080 log_verbose("Option '%s' not defined in the savegame: %s", name,
5081 secfile_error());
5082 } else {
5083 pset->setdef = SETDEF_CHANGED;
5084
5085 if (val != read_enum_value(pset)) {
5087 sizeof(reject_msg))
5088 && (NULL == pset->enumerator.validate
5089 || pset->enumerator.validate(val, NULL, reject_msg,
5090 sizeof(reject_msg)))) {
5091 set_enum_value(pset, val);
5092 log_normal(_("Savegame: '%s' has been set to %s."),
5094 setting_value_name(pset, TRUE, buf, sizeof(buf)));
5095 } else {
5096 log_error("Savegame: error restoring '%s' . (%s)",
5098 }
5099 } else {
5100 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
5102 }
5103 }
5104 }
5105 break;
5106
5107 case SST_BITWISE:
5108 {
5109 int val;
5110
5111 if (!secfile_lookup_enum_data(file, &val, TRUE,
5113 "%s.set%d.value", section, i)) {
5114 log_verbose("Option '%s' not defined in the savegame: %s", name,
5115 secfile_error());
5116 } else {
5117 pset->setdef = SETDEF_CHANGED;
5118
5119 if (val != *pset->bitwise.pvalue) {
5121 sizeof(reject_msg))
5122 && (NULL == pset->bitwise.validate
5123 || pset->bitwise.validate(val, NULL, reject_msg,
5124 sizeof(reject_msg)))) {
5125 *pset->bitwise.pvalue = val;
5126 log_normal(_("Savegame: '%s' has been set to %s."),
5128 setting_value_name(pset, TRUE, buf, sizeof(buf)));
5129 } else {
5130 log_error("Savegame: error restoring '%s' . (%s)",
5132 }
5133 } else {
5134 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
5136 }
5137 }
5138 }
5139 break;
5140
5141 case SST_COUNT:
5142 fc_assert(pset->stype != SST_COUNT);
5143 break;
5144 }
5145
5147 const char *sdname;
5148
5149 /* Load the value of the setting at the start of the game. */
5150 switch (pset->stype) {
5151 case SST_BOOL:
5152 pset->boolean.game_value =
5153 secfile_lookup_bool_default(file, *pset->boolean.pvalue,
5154 "%s.set%d.gamestart", section, i);
5155 break;
5156
5157 case SST_INT:
5158 pset->integer.game_value =
5159 secfile_lookup_int_default(file, *pset->integer.pvalue,
5160 "%s.set%d.gamestart", section, i);
5161 break;
5162
5163 case SST_STRING:
5164 fc_strlcpy(pset->string.game_value,
5165 secfile_lookup_str_default(file, pset->string.value,
5166 "%s.set%d.gamestart",
5167 section, i),
5168 pset->string.value_size);
5169 break;
5170
5171 case SST_ENUM:
5172 pset->enumerator.game_value =
5175 &info, "%s.set%d.gamestart", section, i);
5176 break;
5177
5178 case SST_BITWISE:
5179 pset->bitwise.game_value =
5181 *pset->bitwise.pvalue, TRUE, setting_bitwise_secfile_str,
5182 &info, "%s.set%d.gamestart", section, i);
5183 break;
5184
5185 case SST_COUNT:
5186 fc_assert(pset->stype != SST_COUNT);
5187 break;
5188 }
5189
5190 sdname
5193 "%s.set%d.gamesetdef", section, i);
5196
5197 if (!setting_default_level_is_valid(pset->game_setdef)) {
5198 log_error("Setting %s has invalid gamesetdef value %s",
5200 pset->game_setdef = SETDEF_CHANGED;
5201 }
5202 } else {
5203 pset->game_setdef = SETDEF_CHANGED;
5204 }
5206 }
5207
5208 /* Backwards compatibility for pre-2.4 savegames: citymindist=0 used to mean
5209 * take from ruleset min_dist_bw_cities, but that no longer exists.
5210 * This is here rather than in savegame2.c compat functions, as we need
5211 * to have loaded the relevant ruleset to know what to set it to (the
5212 * ruleset and any 'citymindist' setting it contains will have been loaded
5213 * before this function was called). */
5214 if (game.info.citymindist == 0) {
5216 }
5217
5219 /* Have to do this at the end due to dependencies ('aifill' and
5220 * 'maxplayer'). */
5223}
5224
5225/************************************************************************/
5229{
5231 log_debug("No saved settings from the game start available.");
5232 return FALSE;
5233 }
5234
5238
5239 return TRUE;
5240}
5241
5242/************************************************************************/
5261
5262/************************************************************************/
5274
5275/************************************************************************/
5280{
5281 /* Nothing at the moment. */
5282}
5283
5284/************************************************************************/
5295
5296/************************************************************************/
5300{
5301 return SETTINGS_NUM;
5302}
5303
5304/************************************************************************/
5308void send_server_setting(struct conn_list *dest, const struct setting *pset)
5309{
5310 if (!dest) {
5311 dest = game.est_connections;
5312 }
5313
5314#define PACKET_COMMON_INIT(packet, pset, pconn) \
5315 memset(&packet, 0, sizeof(packet)); \
5316 packet.id = setting_number(pset); \
5317 packet.is_visible = setting_is_visible(pset, pconn); \
5318 packet.is_changeable = setting_is_changeable(pset, pconn, NULL, 0); \
5319 packet.initial_setting = game.info.is_new_game; \
5320 packet.setdef = setting_get_setdef(pset);
5321
5322 switch (setting_type(pset)) {
5323 case SST_BOOL:
5324 {
5325 struct packet_server_setting_bool packet;
5326
5327 conn_list_iterate(dest, pconn) {
5328 PACKET_COMMON_INIT(packet, pset, pconn);
5329 if (packet.is_visible) {
5330 packet.val = *pset->boolean.pvalue;
5331 packet.default_val = pset->boolean.default_value;
5332 }
5335 }
5336 break;
5337 case SST_INT:
5338 {
5339 struct packet_server_setting_int packet;
5340
5341 conn_list_iterate(dest, pconn) {
5342 PACKET_COMMON_INIT(packet, pset, pconn);
5343 if (packet.is_visible) {
5344 packet.val = *pset->integer.pvalue;
5345 packet.default_val = pset->integer.default_value;
5346 packet.min_val = pset->integer.min_value;
5347 packet.max_val = pset->integer.max_value;
5348 }
5351 }
5352 break;
5353 case SST_STRING:
5354 {
5355 struct packet_server_setting_str packet;
5356
5357 conn_list_iterate(dest, pconn) {
5358 PACKET_COMMON_INIT(packet, pset, pconn);
5359 if (packet.is_visible) {
5360 sz_strlcpy(packet.val, pset->string.value);
5361 sz_strlcpy(packet.default_val, pset->string.default_value);
5362 }
5365 }
5366 break;
5367 case SST_ENUM:
5368 {
5369 struct packet_server_setting_enum packet;
5370 const struct sset_val_name *val_name;
5371 int i;
5372
5373 conn_list_iterate(dest, pconn) {
5374 PACKET_COMMON_INIT(packet, pset, pconn);
5375 if (packet.is_visible) {
5376 packet.val = read_enum_value(pset);
5377 packet.default_val = pset->enumerator.default_value;
5378 for (i = 0; (val_name = pset->enumerator.name(i)); i++) {
5379 sz_strlcpy(packet.support_names[i], val_name->support);
5380 /* Send untranslated string */
5381 sz_strlcpy(packet.pretty_names[i], val_name->pretty);
5382 }
5383 packet.values_num = i;
5384 fc_assert(i <= ARRAY_SIZE(packet.support_names));
5385 fc_assert(i <= ARRAY_SIZE(packet.pretty_names));
5386 }
5389 }
5390 break;
5391 case SST_BITWISE:
5392 {
5393 struct packet_server_setting_bitwise packet;
5394 const struct sset_val_name *val_name;
5395 int i;
5396
5397 conn_list_iterate(dest, pconn) {
5398 PACKET_COMMON_INIT(packet, pset, pconn);
5399 if (packet.is_visible) {
5400 packet.val = *pset->bitwise.pvalue;
5401 packet.default_val = pset->bitwise.default_value;
5402 for (i = 0; (val_name = pset->bitwise.name(i)); i++) {
5403 sz_strlcpy(packet.support_names[i], val_name->support);
5404 /* Send untranslated string */
5405 sz_strlcpy(packet.pretty_names[i], val_name->pretty);
5406 }
5407 packet.bits_num = i;
5408 fc_assert(i <= ARRAY_SIZE(packet.support_names));
5409 fc_assert(i <= ARRAY_SIZE(packet.pretty_names));
5410 }
5413 }
5414 break;
5415
5416 case SST_COUNT:
5418 break;
5419 }
5420
5421#undef PACKET_INIT
5422}
5423
5424/************************************************************************/
5433
5434/************************************************************************/
5440 enum cmdlevel old_level,
5441 enum cmdlevel new_level)
5442{
5443 enum cmdlevel min_level;
5444 enum cmdlevel max_level;
5445
5446 if (old_level == new_level) {
5447 return;
5448 }
5449
5450 if (old_level < new_level) {
5453 } else {
5456 }
5457
5459 if ((pset->access_level_read >= min_level
5460 && pset->access_level_read <= max_level)
5461 || (pset->access_level_write >= min_level
5462 && pset->access_level_write <= max_level)) {
5464 }
5466}
5467
5468/************************************************************************/
5472{
5473 struct packet_server_setting_control control;
5475 int i;
5476
5477 control.settings_num = SETTINGS_NUM;
5478
5479 /* Fill in the category strings. */
5482 for (i = 0; i < SSET_NUM_CATEGORIES; i++) {
5483 /* Send untranslated name */
5485 }
5486
5487 /* Send off the control packet. */
5489
5490 pconn->server.settings_sent = TRUE;
5491
5492 /* Send the constant and common part of the settings. */
5496 /* Send untranslated strings to client */
5499 setting.category = pset->scategory;
5500
5503}
5504
5505/************************************************************************/
5508static void settings_list_init(void)
5509{
5510 struct setting *pset;
5511 int i;
5512
5514
5515 /* Do it for all values of enum sset_level. */
5516 for (i = 0; i < OLEVELS_NUM; i++) {
5518 }
5519
5520 for (i = 0; (pset = setting_by_number(i)); i++) {
5521 /* Add the setting to the list of all settings. */
5523
5524 switch (setting_level(pset)) {
5525 case SSET_NONE:
5526 /* No setting should be in this level. */
5528 "No setting level defined for '%s'.", setting_name(pset));
5529 break;
5530 case SSET_ALL:
5531 /* Done above - list of all settings. */
5532 break;
5533 case SSET_VITAL:
5535 break;
5536 case SSET_SITUATIONAL:
5538 break;
5539 case SSET_RARE:
5541 break;
5542 case SSET_CHANGED:
5543 case SSET_LOCKED:
5544 /* This is done in settings_list_update. */
5545 break;
5546 case OLEVELS_NUM:
5547 /* No setting should be in this level. */
5549 "Invalid setting level for '%s' (%s).",
5551 break;
5552 }
5553 }
5554
5555 /* Sort the lists. */
5556 for (i = 0; i < OLEVELS_NUM; i++) {
5558 }
5559
5560 setting_sorted.init = TRUE;
5561}
5562
5563/************************************************************************/
5567{
5568 struct setting *pset;
5569 int i;
5570
5572
5573 /* Clear the lists for changed and locked values. */
5576
5577 /* Refill them. */
5578 for (i = 0; (pset = setting_by_number(i)); i++) {
5581 }
5582 if (setting_locked(pset)) {
5584 }
5585 }
5586
5587 /* Sort them. */
5590}
5591
5592/************************************************************************/
5595int settings_list_cmp(const struct setting *const *ppset1,
5596 const struct setting *const *ppset2)
5597{
5598 const struct setting *pset1 = *ppset1;
5599 const struct setting *pset2 = *ppset2;
5600
5602}
5603
5604/************************************************************************/
5616
5617/************************************************************************/
5620static void settings_list_free(void)
5621{
5622 int i;
5623
5625
5626 /* Free the lists. */
5627 for (i = 0; i < OLEVELS_NUM; i++) {
5629 }
5630
5631 setting_sorted.init = FALSE;
5632}
5633
5634/************************************************************************/
5638{
5639 pset->setdef = SETDEF_CHANGED;
5640}
5641
5642/************************************************************************/
5646{
5647 return pset->setdef;
5648}
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:75
#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:1044
@ TDM_EVEN
Definition fc_types.h:1045
@ DIPLO_NO_MIXED
Definition fc_types.h:1054
@ DIPLO_FOR_TEAMS
Definition fc_types.h:1055
@ DIPLO_NO_AIS
Definition fc_types.h:1053
@ DIPLO_FOR_HUMANS
Definition fc_types.h:1051
@ DIPLO_FOR_ALL
Definition fc_types.h:1050
@ DIPLO_FOR_AIS
Definition fc_types.h:1052
@ DIPLO_DISABLED
Definition fc_types.h:1056
@ REVOLEN_RANDOM
Definition fc_types.h:1284
@ REVOLEN_RANDQUICK
Definition fc_types.h:1286
@ REVOLEN_FIXED
Definition fc_types.h:1283
@ REVOLEN_QUICKENING
Definition fc_types.h:1285
int Unit_Class_id
Definition fc_types.h:418
@ HB_ALLIANCE
Definition fc_types.h:1292
@ HB_DISABLED
Definition fc_types.h:1290
@ HB_NATIONAL
Definition fc_types.h:1291
@ VC_SPACERACE
Definition fc_types.h:1271
@ VC_CULTURE
Definition fc_types.h:1273
@ VC_ALLIED
Definition fc_types.h:1272
@ BORDERS_ENABLED
Definition fc_types.h:1038
@ BORDERS_DISABLED
Definition fc_types.h:1037
@ BORDERS_SEE_INSIDE
Definition fc_types.h:1039
@ BORDERS_EXPAND
Definition fc_types.h:1040
#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:791
#define GAME_MIN_TOP_CITIES_COUNT
Definition game.h:702
#define GAME_DEFAULT_TECHPENALTY
Definition game.h:554
#define GAME_MAX_RAPTUREDELAY
Definition game.h:506
#define GAME_DEFAULT_START_CITY
Definition game.h:383
#define GAME_DEFAULT_SKILL_LEVEL
Definition game.h:697
#define GAME_DEFAULT_KILLSTACK
Definition game.h:547
@ 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:378
#define GAME_MAX_DIPLCHANCE
Definition game.h:465
#define GAME_MAX_SCIENCEBOX
Definition game.h:423
#define GAME_DEFAULT_LUA_TIMEOUT
Definition game.h:754
#define GAME_MAX_EVENT_CACHE_MAX_SIZE
Definition game.h:714
#define GAME_DEFAULT_REVOLENTYPE
Definition game.h:738
#define GAME_DEFAULT_AUTO_AI_TOGGLE
Definition game.h:593
#define GAME_MIN_RAZECHANCE
Definition game.h:570
#define GAME_MIN_GLOBAL_WARMING_PERCENT
Definition game.h:448
#define GAME_DEFAULT_CARAVAN_BONUS_STYLE
Definition game.h:653
#define GAME_MIN_SEED
Definition game.h:371
#define GAME_MAX_TECHLOSSFG
Definition game.h:477
#define GAME_DEFAULT_TCPTIMEOUT
Definition game.h:619
#define GAME_MAX_INFRA
Definition game.h:380
#define GAME_DEFAULT_EVENT_CACHE_INFO
Definition game.h:718
#define GAME_DEFAULT_MGR_FOODNEEDED
Definition game.h:526
#define GAME_DEFAULT_TECHLOST_DONOR
Definition game.h:562
#define GAME_DEFAULT_ALLOWED_CITY_NAMES
Definition game.h:734
#define GAME_MIN_TRADEWORLDRELPCT
Definition game.h:642
#define GAME_DEFAULT_SCORELOG
Definition game.h:575
#define GAME_MAX_KILLUNHOMED
Definition game.h:552
#define GAME_MIN_TECHLOST_RECV
Definition game.h:559
#define GAME_MIN_FREECOST
Definition game.h:468
#define GAME_MAX_CONTACTTURNS
Definition game.h:500
#define GAME_MAX_TECHLOST_RECV
Definition game.h:560
#define GAME_DEFAULT_OCCUPYCHANCE
Definition game.h:667
#define GAME_DEFAULT_USER_META_MESSAGE
Definition game.h:695
#define GAME_MAX_FOODBOX
Definition game.h:415
#define GAME_DEFAULT_GLOBAL_WARMING_PERCENT
Definition game.h:447
#define GAME_DEFAULT_TRADING_TECH
Definition game.h:649
#define GAME_MIN_SCIENCEBOX
Definition game.h:422
#define GAME_MAX_PINGTIMEOUT
Definition game.h:633
#define GAME_MAX_SAVEFREQUENCY
Definition game.h:685
#define GAME_MIN_REVOLUTION_LENGTH
Definition game.h:740
#define GAME_MAX_MGR_TURNINTERVAL
Definition game.h:524
#define GAME_DEFAULT_SAVETURNS
Definition game.h:680
#define GAME_DEFAULT_IPHIDE
Definition game.h:635
#define GAME_DEFAULT_BORDERS
Definition game.h:457
#define GAME_DEFAULT_AIRLIFTINGSTYLE
Definition game.h:745
#define GAME_DEFAULT_SPACESHIP_TRAVEL_PCT
Definition game.h:587
#define GAME_MAX_CONQUERCOST
Definition game.h:473
#define GAME_MAX_TOP_CITIES_COUNT
Definition game.h:703
#define GAME_DEFAULT_TOP_CITIES_COUNT
Definition game.h:701
#define GAME_MAX_AQUEDUCTLOSS
Definition game.h:545
#define GAME_DEFAULT_KILLUNHOMED
Definition game.h:550
#define GAME_DEFAULT_SCIENCEBOX
Definition game.h:421
#define GAME_MIN_DIPLGOLDCOST
Definition game.h:430
#define GAME_DEFAULT_MGR_WORLDCHANCE
Definition game.h:539
#define GAME_MIN_PINGTIME
Definition game.h:628
#define GAME_DEFAULT_ONSETBARBARIAN
Definition game.h:663
#define GAME_MIN_ONSETBARBARIAN
Definition game.h:664
#define GAME_MAX_TECHLOSSREST
Definition game.h:481
#define GAME_DEFAULT_KILLCITIZEN
Definition game.h:548
#define GAME_MIN_INCITE_GOLD_LOSS_CHANCE
Definition game.h:434
#define GAME_MIN_MGR_NATIONCHANCE
Definition game.h:536
#define GAME_MAX_COMPRESS_LEVEL
Definition game.h:722
#define GAME_DEFAULT_NATIONSET
Definition game.h:411
#define GAME_DEFAULT_SHIELDBOX
Definition game.h:417
#define GAME_MIN_NOTRADESIZE
Definition game.h:638
#define GAME_MIN_GOLD
Definition game.h:375
#define GAME_MAX_OCCUPYCHANCE
Definition game.h:669
#define GAME_MIN_SPACESHIP_TRAVEL_PCT
Definition game.h:588
#define GAME_DEFAULT_MAXCONNECTIONSPERHOST
Definition game.h:604
#define GAME_DEFAULT_INCITE_GOLD_CAPT_CHANCE
Definition game.h:437
#define GAME_DEFAULT_DEMOGRAPHY
Definition game.h:705
#define GAME_MIN_MAXCONNECTIONSPERHOST
Definition game.h:605
#define GAME_DEFAULT_FULLTRADESIZE
Definition game.h:645
#define GAME_MAX_DISPERSION
Definition game.h:387
#define GAME_MIN_TECHLOST_DONOR
Definition game.h:563
#define GAME_DEFAULT_RAPTUREDELAY
Definition game.h:504
#define GAME_MIN_MGR_TURNINTERVAL
Definition game.h:523
#define GAME_DEFAULT_REVOLUTION_LENGTH
Definition game.h:739
#define GAME_DEFAULT_MGR_TURNINTERVAL
Definition game.h:522
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:382
#define GAME_MAX_TCPTIMEOUT
Definition game.h:621
#define GAME_DEFAULT_ALLOW_TAKE
Definition game.h:706
#define GAME_DEFAULT_THREADED_SAVE
Definition game.h:693
#define GAME_MIN_INFRA
Definition game.h:379
#define GAME_MAX_TRADEWORLDRELPCT
Definition game.h:643
#define GAME_DEFAULT_MIN_PLAYERS
Definition game.h:399
#define GAME_MIN_CONQUERCOST
Definition game.h:472
#define GAME_MAX_MGR_DISTANCE
Definition game.h:533
#define GAME_MIN_TECHLOSSREST
Definition game.h:480
#define GAME_DEFAULT_AUTOATTACK
Definition game.h:671
#define GAME_DEFAULT_SAVEFREQUENCY
Definition game.h:683
#define GAME_MAX_GOLD
Definition game.h:376
#define GAME_DEFAULT_REVEALMAP
Definition game.h:573
#define GAME_DEFAULT_SCOREFILE
Definition game.h:577
#define GAME_MAX_FIRST_TIMEOUT
Definition game.h:611
#define GAME_MIN_MGR_DISTANCE
Definition game.h:532
#define GAME_MIN_DISPERSION
Definition game.h:386
#define GAME_DEFAULT_TEAM_POOLED_RESEARCH
Definition game.h:566
#define GAME_DEFAULT_SEED
Definition game.h:370
#define GAME_DEFAULT_HOMECAUGHTUNITS
Definition game.h:516
#define GAME_MAX_GLOBAL_WARMING_PERCENT
Definition game.h:449
#define GAME_MAX_MAXCONNECTIONSPERHOST
Definition game.h:606
#define GAME_DEFAULT_NETWAIT
Definition game.h:623
#define GAME_MIN_PINGTIMEOUT
Definition game.h:632
#define GAME_MIN_TECHPENALTY
Definition game.h:555
#define GAME_MIN_CONTACTTURNS
Definition game.h:499
#define GAME_MAX_INCITE_GOLD_LOSS_CHANCE
Definition game.h:435
#define GAME_DEFAULT_KICK_TIME
Definition game.h:750
#define GAME_DEFAULT_PLRCOLORMODE
Definition game.h:736
#define GAME_MAX_CITYMINDIST
Definition game.h:489
#define GAME_DEFAULT_DIPLCHANCE
Definition game.h:463
#define GAME_MAX_NUCLEAR_WINTER_PERCENT
Definition game.h:455
#define GAME_MIN_LUA_TIMEOUT
Definition game.h:755
#define GAME_MIN_END_TURN
Definition game.h:396
#define GAME_DEFAULT_UNRPROTECTS
Definition game.h:496
#define GAME_MIN_MGR_WORLDCHANCE
Definition game.h:540
#define GAME_DEFAULT_RAZECHANCE
Definition game.h:569
#define GAME_MIN_SHIELDBOX
Definition game.h:418
#define GAME_MIN_FIRST_TIMEOUT
Definition game.h:610
#define GAME_MAX_RAZECHANCE
Definition game.h:571
#define GAME_MIN_TIMEOUT
Definition game.h:608
#define GAME_MAX_ONSETBARBARIAN
Definition game.h:665
#define GAME_MIN_FOODBOX
Definition game.h:414
#define GAME_DEFAULT_INCITE_GOLD_LOSS_CHANCE
Definition game.h:433
#define GAME_MAX_MAX_PLAYERS
Definition game.h:405
#define GAME_DEFAULT_TRADING_CITY
Definition game.h:651
#define GAME_DEFAULT_FOODBOX
Definition game.h:413
#define GAME_DEFAULT_COMPRESS_TYPE
Definition game.h:731
#define GAME_MAX_TIMEOUT
Definition game.h:609
#define GAME_MAX_SPACESHIP_TRAVEL_PCT
Definition game.h:589
#define GAME_DEFAULT_PINGTIMEOUT
Definition game.h:631
#define GAME_DEFAULT_TRADE_REVENUE_STYLE
Definition game.h:659
#define GAME_DEFAULT_SAVEPALACE
Definition game.h:514
#define GAME_MIN_EVENT_CACHE_TURNS
Definition game.h:709
#define GAME_DEFAULT_GLOBAL_WARMING
Definition game.h:445
#define GAME_MAX_SEED
Definition game.h:372
#define GAME_MAX_DIPLGOLDCOST
Definition game.h:431
#define GAME_DEFAULT_TECHLOST_RECV
Definition game.h:558
#define GAME_DEFAULT_NOTRADESIZE
Definition game.h:637
#define GAME_DEFAULT_COMPRESS_LEVEL
Definition game.h:720
#define GAME_MAX_TECHLOST_DONOR
Definition game.h:564
#define GAME_MIN_SAVETURNS
Definition game.h:681
#define GAME_MAX_UNITWAITTIME
Definition game.h:614
#define GAME_DEFAULT_FIRST_TIMEOUT
Definition game.h:596
#define GAME_DEFAULT_NUCLEAR_WINTER_PERCENT
Definition game.h:453
#define GAME_MIN_CIVILWARSIZE
Definition game.h:492
#define GAME_DEFAULT_TRADING_GOLD
Definition game.h:650
#define GAME_MIN_TECHLEAK
Definition game.h:484
#define GAME_DEFAULT_TRAIT_DIST_MODE
Definition game.h:512
#define GAME_DEFAULT_NUCLEAR_WINTER
Definition game.h:451
#define GAME_MIN_DISASTERS
Definition game.h:509
#define GAME_MIN_OCCUPYCHANCE
Definition game.h:668
#define GAME_DEFAULT_FREECOST
Definition game.h:467
#define GAME_MIN_KICK_TIME
Definition game.h:751
#define GAME_DEFAULT_MAX_PLAYERS
Definition game.h:403
#define GAME_DEFAULT_CITYMINDIST
Definition game.h:487
#define GAME_MIN_NUCLEAR_WINTER_PERCENT
Definition game.h:454
#define GAME_DEFAULT_PHASE_MODE
Definition game.h:617
#define GAME_DEFAULT_AIFILL
Definition game.h:407
#define GAME_DEFAULT_TRADEWORLDRELPCT
Definition game.h:641
#define GAME_DEFAULT_MULTIRESEARCH
Definition game.h:567
#define GAME_DEFAULT_CONQUERCOST
Definition game.h:471
#define GAME_MAX_TECHPENALTY
Definition game.h:556
#define GAME_DEFAULT_TIMEOUT
Definition game.h:595
#define GAME_MAX_DISASTERS
Definition game.h:510
#define GAME_MIN_INCITE_GOLD_CAPT_CHANCE
Definition game.h:438
#define GAME_MIN_TECHLOSSFG
Definition game.h:476
#define GAME_MAX_END_TURN
Definition game.h:397
#define GAME_MIN_COMPRESS_LEVEL
Definition game.h:721
#define GAME_DEFAULT_TECHLOSSREST
Definition game.h:479
#define GAME_MIN_KILLUNHOMED
Definition game.h:551
#define GAME_MAX_NOTRADESIZE
Definition game.h:639
#define GAME_DEFAULT_CONTACTTURNS
Definition game.h:498
#define GAME_DEFAULT_SCORELOGLEVEL
Definition game.h:576
#define GAME_DEFAULT_TECHLOSSFG
Definition game.h:475
#define GAME_DEFAULT_TECHLEVEL
Definition game.h:389
#define GAME_MIN_MAX_PLAYERS
Definition game.h:404
#define GAME_DEFAULT_DISASTERS
Definition game.h:508
#define GAME_MAX_FREECOST
Definition game.h:469
#define GAME_MAX_REVOLUTION_LENGTH
Definition game.h:741
#define GAME_MAX_AIFILL
Definition game.h:409
#define GAME_DEFAULT_GOLD
Definition game.h:374
#define GAME_MIN_AQUEDUCTLOSS
Definition game.h:544
#define GAME_MIN_DIPLBULBCOST
Definition game.h:426
#define GAME_DEFAULT_MIGRATION
Definition game.h:520
@ 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:713
#define GAME_MIN_CITYMINDIST
Definition game.h:488
#define GAME_MIN_AIFILL
Definition game.h:408
#define GAME_MIN_SAVEFREQUENCY
Definition game.h:684
#define GAME_DEFAULT_NATURALCITYNAMES
Definition game.h:518
#define GAME_DEFAULT_EVENT_CACHE_TURNS
Definition game.h:708
#define GAME_DEFAULT_VICTORY_CONDITIONS
Definition game.h:584
#define GAME_MIN_UNITWAITTIME
Definition game.h:613
#define GAME_DEFAULT_FOGGEDBORDERS
Definition game.h:443
#define GAME_DEFAULT_UNITWAITTIME
Definition game.h:615
#define GAME_DEFAULT_TIMEOUTADDEMOVE
Definition game.h:601
#define GAME_DEFAULT_DISPERSION
Definition game.h:385
#define GAME_MAX_CIVILWARSIZE
Definition game.h:493
#define GAME_DEFAULT_AUTOSAVES
Definition game.h:690
#define GAME_DEFAULT_EVENT_CACHE_CHAT
Definition game.h:716
#define GAME_DEFAULT_DIPLOMACY
Definition game.h:461
#define GAME_DEFAULT_MGR_DISTANCE
Definition game.h:531
#define GAME_MIN_DIPLCHANCE
Definition game.h:464
#define GAME_DEFAULT_TURNBLOCK
Definition game.h:591
#define GAME_MAX_SAVETURNS
Definition game.h:682
#define GAME_MAX_PINGTIME
Definition game.h:629
#define GAME_DEFAULT_PINGTIME
Definition game.h:627
@ 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:543
#define GAME_DEFAULT_TRADEMINDIST
Definition game.h:655
#define GAME_DEFAULT_BARBARIANRATE
Definition game.h:661
#define GAME_DEFAULT_HAPPYBORDERS
Definition game.h:459
#define GAME_MAX_FULLTRADESIZE
Definition game.h:647
#define GAME_MAX_TECHLEAK
Definition game.h:485
#define GAME_MAX_MGR_NATIONCHANCE
Definition game.h:537
#define GAME_MAX_TECHLEVEL
Definition game.h:391
#define GAME_MAX_MGR_WORLDCHANCE
Definition game.h:541
#define GAME_MIN_MIN_PLAYERS
Definition game.h:400
#define GAME_MAX_TRADEMINDIST
Definition game.h:657
#define GAME_DEFAULT_END_TURN
Definition game.h:395
#define GAME_MAX_EVENT_CACHE_TURNS
Definition game.h:710
#define GAME_MAX_DIPLBULBCOST
Definition game.h:427
#define GAME_DEFAULT_DIPLGOLDCOST
Definition game.h:429
#define GAME_MAX_SHIELDBOX
Definition game.h:419
#define GAME_DEFAULT_TECHLEAK
Definition game.h:483
#define GAME_MAX_MIN_PLAYERS
Definition game.h:401
#define GAME_MAX_NETWAIT
Definition game.h:625
#define GAME_MIN_TCPTIMEOUT
Definition game.h:620
#define GAME_DEFAULT_END_SPACESHIP
Definition game.h:585
#define GAME_MIN_RAPTUREDELAY
Definition game.h:505
#define GAME_MIN_NETWAIT
Definition game.h:624
#define GAME_DEFAULT_EVENT_CACHE_MAX_SIZE
Definition game.h:712
#define GAME_DEFAULT_SAVE_NAME
Definition game.h:679
#define GAME_MAX_LUA_TIMEOUT
Definition game.h:756
#define GAME_MIN_TRADEMINDIST
Definition game.h:656
#define GAME_DEFAULT_MGR_NATIONCHANCE
Definition game.h:535
#define GAME_MIN_TECHLEVEL
Definition game.h:390
#define GAME_MAX_INCITE_GOLD_CAPT_CHANCE
Definition game.h:439
#define GAME_DEFAULT_FOGOFWAR
Definition game.h:441
#define GAME_DEFAULT_PERSISTENTREADY
Definition game.h:746
#define GAME_MIN_FULLTRADESIZE
Definition game.h:646
#define GAME_DEFAULT_DIPLBULBCOST
Definition game.h:425
#define GAME_DEFAULT_RESTRICTINFRA
Definition game.h:495
#define GAME_MAX_KICK_TIME
Definition game.h:752
#define GAME_DEFAULT_CIVILWARSIZE
Definition game.h:491
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:238
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:2641
int normal_player_count(void)
Definition plrhand.c:3204
void server_player_set_color(struct player *pplayer, const struct rgbcolor *prgbcolor)
Definition plrhand.c:1822
void send_player_info_c(struct player *src, struct conn_list *dest)
Definition plrhand.c:1146
void count_playable_nations(void)
Definition plrhand.c:2598
bool nation_is_in_current_set(const struct nation_type *pnation)
Definition plrhand.c:2589
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:637
bool rscompat_setting_needs_special_handling(const char *name)
Definition rscompat.c:623
bool autolock_settings(void)
Definition rssanity.c:1673
static struct compatibility compat[]
Definition savecompat.c:105
#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:4681
bool setting_int_validate(const struct setting *pset, int val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3760
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:5245
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:3604
#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:4366
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:4709
void setting_admin_lock_clear(struct setting *pset)
Definition settings.c:4721
#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:3785
static const char * setting_bool_secfile_str(secfile_data_t data, int val)
Definition settings.c:3699
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:4300
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:4048
struct setting * setting_by_name(const char *name)
Definition settings.c:3306
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:4336
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:4264
void settings_game_load(struct section_file *file, const char *section)
Definition settings.c:4946
const char * setting_extra_help(const struct setting *pset, bool constant)
Definition settings.c:3347
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:3562
const char *(* help_callback_func_t)(const struct setting *pset)
Definition settings.c:89
int setting_number(const struct setting *pset)
Definition settings.c:3321
struct setting * setting_by_number(int id)
Definition settings.c:3298
bool setting_int_set(struct setting *pset, int val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3740
enum sset_category setting_category(const struct setting *pset)
Definition settings.c:3375
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:3503
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:4447
bool setting_locked(const struct setting *pset)
Definition settings.c:4673
bool setting_non_default(const struct setting *pset)
Definition settings.c:4647
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:3359
void settings_free(void)
Definition settings.c:5287
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:4701
static void settings_list_free(void)
Definition settings.c:5620
bool setting_str_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3811
#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:3730
enum sset_level setting_level(const struct setting *pset)
Definition settings.c:3367
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:4104
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:4220
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:3867
void settings_game_save(struct section_file *file, const char *section)
Definition settings.c:4858
int settings_number(void)
Definition settings.c:5299
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:3831
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:5279
#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:3385
static const char * setting_enum_to_str(const struct setting *pset, int value, bool pretty, char *buf, size_t buf_len)
Definition settings.c:3909
const char * setting_enum_val(const struct setting *pset, int val, bool pretty)
Definition settings.c:3890
struct setting_list * level[OLEVELS_NUM]
Definition settings.c:190
void setting_changed(struct setting *pset)
Definition settings.c:5637
#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:5645
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:3710
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:3625
static bool setting_ruleset_one(struct section_file *file, const char *name, const char *path, bool compat)
Definition settings.c:4455
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:4845
bool setting_enum_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:4019
const char * setting_short_help(const struct setting *pset)
Definition settings.c:3338
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:5471
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:4085
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:3721
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:3931
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:4241
void setting_ruleset_lock_set(struct setting *pset)
Definition settings.c:4689
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:3685
struct setting_list * settings_list_get(enum sset_level level)
Definition settings.c:5608
bool setting_is_changeable(const struct setting *pset, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3457
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:5595
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:4169
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:3517
static void settings_list_init(void)
Definition settings.c:5508
void settings_reset(void)
Definition settings.c:5265
const char * setting_name(const struct setting *pset)
Definition settings.c:3330
static const int SETTINGS_NUM
Definition settings.c:3293
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:5228
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:4254
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:5566
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:3795
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:3856
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:4376
bool setting_bool_get(struct setting *pset)
Definition settings.c:3673
static bool set_enum_value(struct setting *pset, int val)
Definition settings.c:3958
static void setting_game_set(struct setting *pset, bool init)
Definition settings.c:4733
static void setting_game_free(struct setting *pset)
Definition settings.c:4773
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:4062
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:3493
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:3654
void send_server_setting(struct conn_list *dest, const struct setting *pset)
Definition settings.c:5308
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:5427
#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:5439
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:4783
int read_enum_value(const struct setting *pset)
Definition settings.c:3992
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:2465
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:706
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:144
int contactturns
Definition game.h:141
enum city_names_mode allowed_city_names
Definition game.h:131
int unitwaittime
Definition game.h:202
bool multiresearch
Definition game.h:167
int incite_gold_capt_chance
Definition game.h:146
char scorefile[MAX_LEN_PATH]
Definition game.h:228
int mgr_worldchance
Definition game.h:166
int kick_time
Definition game.h:157
bool chat
Definition game.h:256
enum barbarians_rate barbarianrate
Definition game.h:137
int dispersion
Definition game.h:147
bool threaded_save
Definition game.h:184
int max_size
Definition game.h:255
int save_compress_level
Definition game.h:185
int tcptimeout
Definition game.h:199
char start_units[MAX_LEN_STARTUNIT]
Definition game.h:193
struct civ_game::@31::@35::@36 event_cache
int save_nturns
Definition game.h:187
int mgr_nationchance
Definition game.h:164
bool fixedlength
Definition game.h:150
int spaceship_travel_pct
Definition game.h:183
int techlost_recv
Definition game.h:198
bool mgr_foodneeded
Definition game.h:163
int diplchance
Definition game.h:142
int netwait
Definition game.h:172
int incite_gold_loss_chance
Definition game.h:145
int end_turn
Definition game.h:148
bool settings_gamestart_valid
Definition game.h:246
enum plrcolor_mode plrcolormode
Definition game.h:132
int onsetbarbarian
Definition game.h:175
char demography[MAX_LEN_DEMOGRAPHY]
Definition game.h:243
struct conn_list * est_connections
Definition game.h:97
struct packet_game_info info
Definition game.h:89
int mgr_turninterval
Definition game.h:165
char user_message[256]
Definition game.h:269
int min_players
Definition game.h:170
unsigned autosaves
Definition game.h:189
struct timer * save_timer
Definition game.h:221
bool endspaceship
Definition game.h:149
enum scorelog_level scoreloglevel
Definition game.h:227
int lua_timeout
Definition game.h:105
bool migration
Definition game.h:168
bool ip_hide
Definition game.h:178
int diplbulbcost
Definition game.h:143
bool natural_city_names
Definition game.h:171
int maxconnectionsperhost
Definition game.h:159
struct packet_scenario_info scenario
Definition game.h:87
int pingtimeout
Definition game.h:177
int occupychance
Definition game.h:174
randseed seed_setting
Definition game.h:230
int killunhomed
Definition game.h:158
int nuclear_winter_percent
Definition game.h:236
int conquercost
Definition game.h:140
unsigned revealmap
Definition game.h:181
int pingtime
Definition game.h:176
int techloss_restore
Definition game.h:196
char default_ai_type_name[256]
Definition game.h:281
int civilwarsize
Definition game.h:139
bool savepalace
Definition game.h:191
int freecost
Definition game.h:152
char nationset[MAX_LEN_NAME]
Definition game.h:161
int aqueductloss
Definition game.h:133
char save_name[MAX_LEN_NAME]
Definition game.h:224
enum fz_method save_compress_type
Definition game.h:186
enum trait_dist_mode trait_dist
Definition game.h:169
bool foggedborders
Definition game.h:151
struct civ_game::@31::@35 server
bool homecaughtunits
Definition game.h:192
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:244
bool autoattack
Definition game.h:135
int phase_mode_stored
Definition game.h:220
bool start_city
Definition game.h:194
int max_players
Definition game.h:160
int revolution_length
Definition game.h:182
int turns
Definition game.h:254
bool auto_ai_toggle
Definition game.h:134
int save_frequency
Definition game.h:188
int mgr_distance
Definition game.h:162
int global_warming_percent
Definition game.h:234
int techlost_donor
Definition game.h:197
int timeoutaddenemymove
Definition game.h:212
bool scorelog
Definition game.h:226
int techpenalty
Definition game.h:200
int razechance
Definition game.h:180
bool turnblock
Definition game.h:201
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:195
#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