Freeciv-3.3
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 NAME_CASE(VC_WORLDPEACE, "WORLDPEACE", N_("World Peace victory"));
380 };
381
382 return nullptr;
383}
384
385/************************************************************************/
389{
390 switch (autosaves_bit) {
391 NAME_CASE(AS_TURN, "TURN", N_("New turn"));
392 NAME_CASE(AS_GAME_OVER, "GAMEOVER", N_("Game over"));
393 NAME_CASE(AS_QUITIDLE, "QUITIDLE", N_("No player connections"));
394 NAME_CASE(AS_INTERRUPT, "INTERRUPT", N_("Server interrupted"));
395 NAME_CASE(AS_TIMER, "TIMER", N_("Timer"));
396 };
397
398 return NULL;
399}
400
401/************************************************************************/
404static const struct sset_val_name *borders_name(int borders)
405{
406 switch (borders) {
407 NAME_CASE(BORDERS_DISABLED, "DISABLED", N_("Disabled"));
408 NAME_CASE(BORDERS_ENABLED, "ENABLED", N_("Enabled"));
409 NAME_CASE(BORDERS_SEE_INSIDE, "SEE_INSIDE",
410 N_("See everything inside borders"));
411 NAME_CASE(BORDERS_EXPAND, "EXPAND",
412 N_("Borders expand to unknown, revealing tiles"));
413 }
414 return NULL;
415}
416
417/************************************************************************/
420static const struct sset_val_name *trait_dist_name(int trait_dist)
421{
422 switch (trait_dist) {
423 NAME_CASE(TDM_FIXED, "FIXED", N_("Fixed"));
424 NAME_CASE(TDM_EVEN, "EVEN", N_("Even"));
425 }
426 return NULL;
427}
428
429/************************************************************************/
432static const struct sset_val_name *plrcol_name(int plrcol)
433{
434 switch (plrcol) {
435 NAME_CASE(PLRCOL_PLR_ORDER, "PLR_ORDER", N_("Per-player, in order"));
436 NAME_CASE(PLRCOL_PLR_RANDOM, "PLR_RANDOM", N_("Per-player, random"));
437 NAME_CASE(PLRCOL_PLR_SET, "PLR_SET", N_("Set manually"));
438 NAME_CASE(PLRCOL_TEAM_ORDER, "TEAM_ORDER", N_("Per-team, in order"));
439 NAME_CASE(PLRCOL_NATION_ORDER, "NATION_ORDER", N_("Per-nation, in order"));
440 }
441 return NULL;
442}
443
444/************************************************************************/
447static const struct sset_val_name *happyborders_name(int happyborders)
448{
449 switch (happyborders) {
450 NAME_CASE(HB_DISABLED, "DISABLED", N_("Borders are not helping"));
451 NAME_CASE(HB_NATIONAL, "NATIONAL", N_("Happy within own borders"));
452 NAME_CASE(HB_ALLIANCE, "ALLIED", N_("Happy within allied borders"));
453 }
454 return NULL;
455}
456
457/************************************************************************/
460static const struct sset_val_name *diplomacy_name(int diplomacy)
461{
462 switch (diplomacy) {
463 NAME_CASE(DIPLO_FOR_ALL, "ALL", N_("Enabled for everyone"));
465 N_("Only allowed between human players"));
466 NAME_CASE(DIPLO_FOR_AIS, "AI", N_("Only allowed between AI players"));
467 NAME_CASE(DIPLO_NO_AIS, "NOAI", N_("Only allowed when human involved"));
468 NAME_CASE(DIPLO_NO_MIXED, "NOMIXED", N_("Only allowed between two humans, or two AI players"));
469 NAME_CASE(DIPLO_FOR_TEAMS, "TEAM", N_("Restricted to teams"));
470 NAME_CASE(DIPLO_DISABLED, "DISABLED", N_("Disabled for everyone"));
471 }
472 return NULL;
473}
474
475/************************************************************************/
478static const struct sset_val_name *citynames_name(int citynames)
479{
480 switch (citynames) {
481 NAME_CASE(CNM_NO_RESTRICTIONS, "NO_RESTRICTIONS", N_("No restrictions"));
482 NAME_CASE(CNM_PLAYER_UNIQUE, "PLAYER_UNIQUE", N_("Unique to a player"));
483 NAME_CASE(CNM_GLOBAL_UNIQUE, "GLOBAL_UNIQUE", N_("Globally unique"));
484 NAME_CASE(CNM_NO_STEALING, "NO_STEALING", N_("No city name stealing"));
485 }
486 return NULL;
487}
488
489/************************************************************************/
492static const struct sset_val_name *barbarians_name(int barbarians)
493{
494 switch (barbarians) {
495 NAME_CASE(BARBS_DISABLED, "DISABLED", N_("No barbarians"));
496 NAME_CASE(BARBS_HUTS_ONLY, "HUTS_ONLY", N_("Only in huts"));
497 NAME_CASE(BARBS_NORMAL, "NORMAL", N_("Normal rate of appearance"));
498 NAME_CASE(BARBS_FREQUENT, "FREQUENT", N_("Frequent barbarian uprising"));
499 NAME_CASE(BARBS_HORDES, "HORDES", N_("Raging hordes"));
500 }
501 return NULL;
502}
503
504/************************************************************************/
507static const struct sset_val_name *revolentype_name(int revolentype)
508{
509 switch (revolentype) {
510 NAME_CASE(REVOLEN_FIXED, "FIXED", N_("Fixed to 'revolen' turns"));
511 NAME_CASE(REVOLEN_RANDOM, "RANDOM", N_("Randomly 1-'revolen' turns"));
512 NAME_CASE(REVOLEN_QUICKENING, "QUICKENING", N_("First time 'revolen', then always quicker"));
513 NAME_CASE(REVOLEN_RANDQUICK, "RANDQUICK", N_("Random, max always quicker"));
514 }
515 return NULL;
516}
517
518/************************************************************************/
521static const struct sset_val_name *revealmap_name(int bit)
522{
523 switch (1 << bit) {
524 NAME_CASE(REVEAL_MAP_START, "START", N_("Reveal map at game start"));
525 NAME_CASE(REVEAL_MAP_DEAD, "DEAD", N_("Unfog map for dead players"));
526 }
527 return NULL;
528}
529
530/************************************************************************/
533static const struct sset_val_name *airliftingstyle_name(int bit)
534{
535 switch (1 << bit) {
536 NAME_CASE(AIRLIFTING_ALLIED_SRC, "FROM_ALLIES",
537 N_("Allows units to be airlifted from allied cities"));
539 N_("Allows units to be airlifted to allied cities"));
540 NAME_CASE(AIRLIFTING_UNLIMITED_SRC, "SRC_UNLIMITED",
541 N_("Unlimited units from source city"));
542 NAME_CASE(AIRLIFTING_UNLIMITED_DEST, "DEST_UNLIMITED",
543 N_("Unlimited units to destination city"));
544 }
545 return NULL;
546}
547
548/************************************************************************/
551static const struct sset_val_name *phasemode_name(int phasemode)
552{
553 switch (phasemode) {
554 NAME_CASE(PMT_CONCURRENT, "ALL", N_("All players move concurrently"));
556 "PLAYER", N_("All players alternate movement"));
557 NAME_CASE(PMT_TEAMS_ALTERNATE, "TEAM", N_("Team alternate movement"));
558 }
559 return NULL;
560}
561
562/************************************************************************/
565static const struct sset_val_name *
567{
568 switch (sl_level) {
569 NAME_CASE(SL_ALL, "ALL", N_("All players"));
570 NAME_CASE(SL_HUMANS, "HUMANS", N_("Human players only"));
571 }
572 return NULL;
573}
574
575/************************************************************************/
578static const struct sset_val_name *
580{
581 switch (compresstype) {
582 NAME_CASE(FZ_PLAIN, "PLAIN", N_("No compression"));
583#ifdef FREECIV_HAVE_LIBZ
584 NAME_CASE(FZ_ZLIB, "LIBZ", N_("Using zlib (gzip format)"));
585#endif
586#ifdef FREECIV_HAVE_LIBBZ2
587 case FZ_BZIP2:
588 break;
589#endif
590#ifdef FREECIV_HAVE_LIBLZMA
591 NAME_CASE(FZ_XZ, "XZ", N_("Using xz"));
592#endif
593#ifdef FREECIV_HAVE_LIBZSTD
594 NAME_CASE(FZ_ZSTD, "ZSTD", N_("Using zstd"));
595#endif
596 }
597
598 return NULL;
599}
600
601/************************************************************************/
604static const struct sset_val_name *
605ailevel_name(enum ai_level lvl)
606{
607 const char *lvlname;
608
609 if (lvl >= AI_LEVEL_AWAY) {
610 return NULL;
611 }
612
614
615 if (lvlname != NULL) {
616 static struct sset_val_name name[AI_LEVEL_COUNT];
617
620
621 return &name[lvl];
622 }
623
624 return NULL;
625}
626
627/************************************************************************/
630static const struct sset_val_name *bool_name(int enable)
631{
632 switch (enable) {
633 NAME_CASE(FALSE, "DISABLED", N_("disabled"));
634 NAME_CASE(TRUE, "ENABLED", N_("enabled"));
635 }
636 return NULL;
637}
638
639#undef NAME_CASE
640
641/****************************************************************************
642 Help callback functions.
643****************************************************************************/
644
645/************************************************************************/
648static const char *phasemode_help(const struct setting *pset)
649{
650 static char pmhelp[512];
651
652 /* Translated here */
653 fc_snprintf(pmhelp, sizeof(pmhelp),
654 _("This setting controls whether players may make "
655 "moves at the same time during a turn. Change "
656 "in setting takes effect next turn. Currently, at least "
657 "to the end of this turn, mode is \"%s\"."),
659
660 return pmhelp;
661}
662
663/************************************************************************/
666static const char *huts_help(const struct setting *pset)
667{
668 if (wld.map.server.huts_absolute >= 0) {
669 static char hutshelp[512];
670
671 /* Translated here */
673 _("%s\n"
674 "Currently this setting is being overridden by an "
675 "old scenario or savegame, which has set the absolute "
676 "number of huts to %d. Explicitly set this setting "
677 "again to make it take effect instead."),
678 _(pset->extra_help), wld.map.server.huts_absolute);
679
680 return hutshelp;
681 }
682
683 return pset->extra_help;
684}
685
686/****************************************************************************
687 Action callback functions.
688****************************************************************************/
689
690/************************************************************************/
693static void scorelog_action(const struct setting *pset)
694{
695 if (*pset->boolean.pvalue) {
697 } else {
699 }
700}
701
702/************************************************************************/
705static void aifill_action(const struct setting *pset)
706{
707 const char *msg = aifill(*pset->integer.pvalue);
708 if (msg) {
709 log_normal(_("Warning: aifill not met: %s."), msg);
711 _("Warning: aifill not met: %s."), msg);
712 }
713}
714
715/************************************************************************/
718static void nationset_action(const struct setting *pset)
719{
720 /* If any player's existing selection is invalid, abort it */
721 players_iterate(pplayer) {
722 if (pplayer->nation != NULL) {
723 if (!nation_is_in_current_set(pplayer->nation)) {
726 }
727 }
731
732 /* There might now be too many players for the available nations.
733 * Rather than getting rid of some players arbitrarily, we let the
734 * situation persist for all already-connected players; the server
735 * will simply refuse to start until someone reduces the number of
736 * players. This policy also avoids annoyance if nationset is
737 * accidentally and transiently set to an unintended value.
738 * (However, new connections will start out detached.) */
739 if (normal_player_count() > server.playable_nations) {
741 _("Warning: not enough nations in this nation set "
742 "for all current players."));
743 }
744
746}
747
748/************************************************************************/
751static void plrcol_action(const struct setting *pset)
752{
753 if (!game_was_started()) {
755 players_iterate(pplayer) {
758 }
759 /* Update clients with new color scheme. */
761 }
762}
763
764/************************************************************************/
767static void autotoggle_action(const struct setting *pset)
768{
769 if (*pset->boolean.pvalue) {
770 players_iterate(pplayer) {
771 if (is_human(pplayer) && !pplayer->is_connected) {
774 }
776 }
777}
778
779/************************************************************************/
783static void timeout_action(const struct setting *pset)
784{
785 if (S_S_RUNNING == server_state()) {
786 int timeout = *pset->integer.pvalue;
787
788 if (game.info.turn != 1 || game.info.first_timeout == -1) {
789 /* This may cause the current turn to end immediately. */
791 }
793 }
794}
795
796/************************************************************************/
800static void first_timeout_action(const struct setting *pset)
801{
802 if (S_S_RUNNING == server_state()) {
803 int timeout = *pset->integer.pvalue;
804
805 if (game.info.turn == 1) {
806 /* This may cause the current turn to end immediately. */
807 if (timeout != -1) {
809 } else {
811 }
812 }
814 }
815}
816
817/************************************************************************/
820static void huts_action(const struct setting *pset)
821{
823}
824
825/************************************************************************/
828static void topology_action(const struct setting *pset)
829{
830 struct packet_set_topology packet;
831
832 packet.topology_id = *pset->integer.pvalue;
833 packet.wrap_id = wld.map.wrap_id;
834
838}
839
840/************************************************************************/
843static void wrap_action(const struct setting *pset)
844{
845 struct packet_set_topology packet;
846
848 packet.wrap_id = *pset->integer.pvalue;
849
853}
854
855/************************************************************************/
859static void metamessage_action(const struct setting *pset)
860{
861 /* Set the metaserver message based on the new meta server user message.
862 * An empty user metaserver message results in an automatic meta message.
863 * A non empty user meta message results in the user meta message. */
864 set_user_meta_message_string(pset->string.value);
865
866 if (is_metaserver_open()) {
867 /* Update the meta server. */
869 }
870}
871
872/************************************************************************/
875static void aitype_action(const struct setting *pset)
876{
877 if (!set_default_ai_type_name(pset->string.value)) {
878 log_warn(_("Failed to update default AI type."));
879 }
880}
881
882/****************************************************************************
883 Validation callback functions.
884****************************************************************************/
885
886/************************************************************************/
889static bool savename_validate(const char *value, struct connection *caller,
890 char *reject_msg, size_t reject_msg_len)
891{
892 char buf[MAX_LEN_PATH];
893
894 generate_save_name(value, buf, sizeof(buf), NULL);
895
896 if (!is_safe_filename(buf)) {
898 _("Invalid save name definition: '%s' "
899 "(resolves to '%s')."), value, buf);
900 return FALSE;
901 }
902
903 return TRUE;
904}
905
906/************************************************************************/
910static bool generator_validate(int value, struct connection *caller,
911 char *reject_msg, size_t reject_msg_len)
912{
913 if (map_is_empty()) {
914 if (MAPGEN_SCENARIO == value
915 && (NULL != caller || !game.scenario.is_scenario)) {
917 _("You cannot disable the map generator."));
918 return FALSE;
919 }
920 return TRUE;
921 } else {
922 if (MAPGEN_SCENARIO != value) {
924 _("You cannot require a map generator "
925 "when a map is loaded."));
926 return FALSE;
927 }
928 }
929 return TRUE;
930}
931
932/************************************************************************/
935#ifndef FREECIV_WEB
936static bool scorefile_validate(const char *value, struct connection *caller,
937 char *reject_msg, size_t reject_msg_len)
938{
939 if (!is_safe_filename(value)) {
941 _("Invalid score name definition: '%s'."), value);
942 return FALSE;
943 }
944
945 return TRUE;
946}
947#endif /* !FREECIV_WEB */
948
949/************************************************************************/
953static bool demography_callback(const char *value,
954 struct connection *caller,
955 char *reject_msg,
956 size_t reject_msg_len)
957{
958 int error;
959
960 if (is_valid_demography(value, &error)) {
961 return TRUE;
962 } else {
964 _("Demography string validation failed at character: "
965 "'%c'. Try \"/help demography\"."), value[error]);
966 return FALSE;
967 }
968}
969
970/************************************************************************/
973static bool autosaves_callback(unsigned value, struct connection *caller,
974 char *reject_msg, size_t reject_msg_len)
975{
976 if (S_S_RUNNING == server_state()) {
977 if ((value & (1 << AS_TIMER))
978 && !(game.server.autosaves & (1 << AS_TIMER))) {
982 ? NULL : "save interval");
984 } else if (!(value & (1 << AS_TIMER))
985 && (game.server.autosaves & (1 << AS_TIMER))) {
989 }
990 }
991
992 return TRUE;
993}
994
995/************************************************************************/
999static bool allowtake_callback(const char *value,
1000 struct connection *caller,
1001 char *reject_msg,
1002 size_t reject_msg_len)
1003{
1004 int len = strlen(value), i;
1006
1007 /* We check each character individually to see if it's valid. This
1008 * does not check for duplicate entries.
1009 *
1010 * We also track the state of the machine. havecharacter_state is
1011 * true if the preceding character was a primary label, e.g.
1012 * NHhAadb. It is false if the preceding character was a modifier
1013 * or if this is the first character. */
1014
1015 for (i = 0; i < len; i++) {
1016 /* Check to see if the character is a primary label. */
1017 if (strchr("HhAadbOo", value[i])) {
1019 continue;
1020 }
1021
1022 /* If we've already passed a primary label, check to see if the
1023 * character is a modifier. */
1024 if (havecharacter_state && strchr("1234", value[i])) {
1026 continue;
1027 }
1028
1029 /* Looks like the character was invalid. */
1031 _("Allowed take string validation failed at "
1032 "character: '%c'. Try \"/help allowtake\"."),
1033 value[i]);
1034 return FALSE;
1035 }
1036
1037 /* All characters were valid. */
1038 return TRUE;
1039}
1040
1041/************************************************************************/
1045static bool startunits_callback(const char *value,
1046 struct connection *caller,
1047 char *reject_msg,
1048 size_t reject_msg_len)
1049{
1050 int len = strlen(value), i;
1052 bool firstnative = FALSE;
1053
1054 if (len == 0) {
1055 return TRUE;
1056 }
1057
1058 /* We check each character individually to see if it's valid. */
1059 for (i = 0; i < len; i++) {
1060 if (strchr("cwxksfdDaA", value[i])) {
1061 continue;
1062 }
1063
1064 /* Looks like the character was invalid. */
1066 _("Starting units string validation failed at "
1067 "character '%c'. Try \"/help startunits\"."),
1068 value[i]);
1069 return FALSE;
1070 }
1071
1072 /* Check the first character to make sure it can use a startpos. */
1074 crole_to_role_id(value[0]), 0)));
1075 terrain_type_iterate(pterrain) {
1076 if (terrain_has_flag(pterrain, TER_STARTER)
1077 && BV_ISSET(pterrain->native_to, first_role)) {
1078 firstnative = TRUE;
1079 break;
1080 }
1082
1083 if (!firstnative) {
1084 /* Loading would cause an infinite loop hunting for a valid startpos. */
1086 _("The first starting unit must be native to at "
1087 "least one \"Starter\" terrain. "
1088 "Try \"/help startunits\"."));
1089 return FALSE;
1090 }
1091
1092 /* Everything seems fine. */
1093 return TRUE;
1094}
1095
1096/************************************************************************/
1099static bool endturn_callback(int value, struct connection *caller,
1100 char *reject_msg, size_t reject_msg_len)
1101{
1102 if (value < game.info.turn) {
1103 /* Tried to set endturn earlier than current turn */
1105 _("Cannot set endturn earlier than current turn."));
1106 return FALSE;
1107 }
1108 return TRUE;
1109}
1110
1111/************************************************************************/
1114static bool maxplayers_callback(int value, struct connection *caller,
1115 char *reject_msg, size_t reject_msg_len)
1116{
1117 if (value < player_count()) {
1119 _("Number of players (%d) is higher than requested "
1120 "value (%d). Keeping old value."), player_count(),
1121 value);
1122 return FALSE;
1123 }
1124 /* If any start positions are defined by a scenario, we can only
1125 * accommodate as many players as we have start positions. */
1127 && 0 < map_startpos_count() && value > map_startpos_count()) {
1129 _("Requested value (%d) is greater than number of "
1130 "available start positions (%d). Keeping old value."),
1131 value, map_startpos_count());
1132 return FALSE;
1133 }
1134
1135 return TRUE;
1136}
1137
1138/************************************************************************/
1141static bool nationset_callback(const char *value,
1142 struct connection *caller,
1143 char *reject_msg,
1144 size_t reject_msg_len)
1145{
1146 if (strlen(value) == 0) {
1147 return TRUE;
1148 } else if (nation_set_by_rule_name(value)) {
1149 return TRUE;
1150 } else {
1152 /* TRANS: do not translate 'list nationsets' */
1153 _("Unknown nation set \"%s\". See '%slist nationsets' "
1154 "for possible values."), value, caller ? "/" : "");
1155 return FALSE;
1156 }
1157}
1158
1159/************************************************************************/
1162static bool timeout_callback(int value, struct connection *caller,
1163 char *reject_msg, size_t reject_msg_len)
1164{
1165 /* Disallow low timeout values for non-hack connections. */
1166 if (caller && caller->access_level < ALLOW_HACK
1167 && value < 30 && value != 0) {
1169 _("You are not allowed to set timeout values less "
1170 "than 30 seconds."));
1171 return FALSE;
1172 }
1173
1174 if (value == -1 && game.server.unitwaittime != 0) {
1175 /* autogame only with 'unitwaittime' = 0 */
1177 /* TRANS: Do not translate setting names in ''. */
1178 _("For autogames ('timeout' = -1) 'unitwaittime' "
1179 "should be deactivated (= 0)."));
1180 return FALSE;
1181 }
1182
1183 if (value > 0 && value < game.server.unitwaittime * 3 / 2) {
1184 /* for normal games 'timeout' should be at least 3/2 times the value
1185 * of 'unitwaittime' */
1187 /* TRANS: Do not translate setting names in ''. */
1188 _("'timeout' can not be lower than 3/2 of the "
1189 "'unitwaittime' setting (= %d). Please change "
1190 "'unitwaittime' first."), game.server.unitwaittime);
1191 return FALSE;
1192 }
1193
1194 return TRUE;
1195}
1196
1197/************************************************************************/
1200static bool first_timeout_callback(int value, struct connection *caller,
1201 char *reject_msg, size_t reject_msg_len)
1202{
1203 /* Disallow low timeout values for non-hack connections. */
1204 if (caller && caller->access_level < ALLOW_HACK
1205 && value < 30 && value != 0) {
1207 _("You are not allowed to set timeout values less "
1208 "than 30 seconds."));
1209 return FALSE;
1210 }
1211
1212 return TRUE;
1213}
1214
1215/************************************************************************/
1218static bool unitwaittime_callback(int value, struct connection *caller,
1219 char *reject_msg, size_t reject_msg_len)
1220{
1221 if (game.info.timeout == -1 && value != 0) {
1223 /* TRANS: Do not translate setting names in ''. */
1224 _("For autogames ('timeout' = -1) 'unitwaittime' "
1225 "should be deactivated (= 0)."));
1226 return FALSE;
1227 }
1228
1229 if (game.info.timeout > 0 && value > game.info.timeout * 2 / 3) {
1231 /* TRANS: Do not translate setting names in ''. */
1232 _("'unitwaittime' has to be lower than 2/3 of the "
1233 "'timeout' setting (= %d). Please change 'timeout' "
1234 "first."), game.info.timeout);
1235 return FALSE;
1236 }
1237
1238 return TRUE;
1239}
1240
1241/************************************************************************/
1244static bool mapsize_callback(int value, struct connection *caller,
1245 char *reject_msg, size_t reject_msg_len)
1246{
1247 if (value == MAPSIZE_XYSIZE && MAP_IS_ISOMETRIC
1248 && MAP_NATIVE_HEIGHT % 2 != 0) {
1249 /* An isometric map needs a even ysize. It is calculated automatically
1250 * for all settings but mapsize=XYSIZE. */
1252 _("For an isometric or hexagonal map the ysize must be "
1253 "even."));
1254 return FALSE;
1255 }
1256
1257 return TRUE;
1258}
1259
1260/************************************************************************/
1263static bool xsize_callback(int value, struct connection *caller,
1264 char *reject_msg, size_t reject_msg_len)
1265{
1266 int size = value * MAP_NATIVE_HEIGHT;
1267
1268 if (size < MAP_MIN_SIZE * 1000) {
1270 _("The map size (%d * %d = %d) must be larger than "
1271 "%d tiles."), value, MAP_NATIVE_HEIGHT, size,
1272 MAP_MIN_SIZE * 1000);
1273 return FALSE;
1274 } else if (size > MAP_MAX_SIZE * 1000) {
1276 _("The map size (%d * %d = %d) must be lower than "
1277 "%d tiles."), value, MAP_NATIVE_HEIGHT, size,
1278 MAP_MAX_SIZE * 1000);
1279 return FALSE;
1280 }
1281
1282 return TRUE;
1283}
1284
1285/************************************************************************/
1288static bool ysize_callback(int value, struct connection *caller,
1289 char *reject_msg, size_t reject_msg_len)
1290{
1291 int size = MAP_NATIVE_WIDTH * value;
1292
1293 if (size < MAP_MIN_SIZE * 1000) {
1295 _("The map size (%d * %d = %d) must be larger than "
1296 "%d tiles."), MAP_NATIVE_WIDTH, value, size,
1297 MAP_MIN_SIZE * 1000);
1298 return FALSE;
1299 } else if (size > MAP_MAX_SIZE * 1000) {
1301 _("The map size (%d * %d = %d) must be lower than "
1302 "%d tiles."), MAP_NATIVE_WIDTH, value, size,
1303 MAP_MAX_SIZE * 1000);
1304 return FALSE;
1306 && value % 2 != 0) {
1307 /* An isometric map needs a even ysize. It is calculated automatically
1308 * for all settings but mapsize=XYSIZE. */
1310 _("For an isometric or hexagonal map the ysize must be "
1311 "even."));
1312 return FALSE;
1313 }
1314
1315 return TRUE;
1316}
1317
1318/************************************************************************/
1321static bool topology_callback(unsigned value, struct connection *caller,
1322 char *reject_msg, size_t reject_msg_len)
1323{
1325 && ((value & (TF_ISO)) != 0 || (value & (TF_HEX)) != 0)
1326 && MAP_NATIVE_HEIGHT % 2 != 0) {
1327 /* An isometric map needs a even ysize. It is calculated automatically
1328 * for all settings but mapsize=XYSIZE. */
1330 _("For an isometric or hexagonal map the ysize must be "
1331 "even."));
1332 return FALSE;
1333 }
1334
1335#ifdef FREECIV_WEB
1336 /* Remember to update the help text too if Freeciv-web gets the ability
1337 * to display other map topologies. */
1338
1339 /* Are you removing this because Freeciv-web gained the ability to
1340 * display isometric maps? Why don't you remove the Freeciv-web
1341 * specific MAP_DEFAULT_TOPO too? */
1342 if ((value & (TF_ISO)) != 0
1343 || (value & (TF_HEX)) != 0) {
1344 /* The Freeciv-web client can't display these topologies yet. */
1346 _("Freeciv-web doesn't support this topology."));
1347 return FALSE;
1348 }
1349#endif /* FREECIV_WEB */
1350
1351 return TRUE;
1352}
1353
1354/************************************************************************/
1357static bool aitype_callback(const char *value, struct connection *caller,
1358 char *reject_msg, size_t reject_msg_len)
1359{
1360 if (ai_type_by_name(value) == NULL) {
1362 _("No such AI type loaded."));
1363
1364 return FALSE;
1365 }
1366
1367 return TRUE;
1368}
1369
1370/************************************************************************/
1373static bool wrap_callback(unsigned value, struct connection *caller,
1374 char *reject_msg, size_t reject_msg_len)
1375{
1376#ifdef FREECIV_WEB
1377 /* Remember to update the help text too if Freeciv-web gets the ability
1378 * to display other map wraps. */
1379 if ((value & (WRAP_Y)) != 0) {
1380 /* The Freeciv-web client can't display wraps mapped this way. */
1382 _("Freeciv-web doesn't support this map wrap."));
1383 return FALSE;
1384 }
1385#endif /* FREECIV_WEB */
1386
1387 return TRUE;
1388}
1389
1390/************************************************************************/
1393static bool plrcol_validate(int value, struct connection *caller,
1394 char *reject_msg, size_t reject_msg_len)
1395{
1396 enum plrcolor_mode mode = value;
1397 if (mode == PLRCOL_NATION_ORDER) {
1398 nations_iterate(pnation) {
1399 if (nation_color(pnation)) {
1400 /* At least one nation has a color. Allow this mode. */
1401 return TRUE;
1402 }
1405 _("No nations in the currently loaded ruleset have "
1406 "associated colors."));
1407 return FALSE;
1408 }
1409 return TRUE;
1410}
1411
1412#define GEN_BOOL(name, value, sclass, scateg, slevel, al_read, al_write, \
1413 short_help, extra_help, func_validate, func_action, \
1414 _default) \
1415 {name, sclass, al_read, al_write, short_help, extra_help, NULL, SST_BOOL, \
1416 scateg, slevel, \
1417 INIT_BRACE_BEGIN \
1418 .boolean = {&value, _default, func_validate, bool_name, \
1419 FALSE} INIT_BRACE_END , func_action, FALSE, .ruleset_settable = TRUE},
1420
1421#define GEN_INT(name, value, sclass, scateg, slevel, al_read, al_write, \
1422 short_help, extra_help, func_help, \
1423 func_validate, func_action, \
1424 _min, _max, _default) \
1425 {name, sclass, al_read, al_write, short_help, extra_help, func_help, \
1426 SST_INT, scateg, slevel, \
1427 INIT_BRACE_BEGIN \
1428 .integer = {(int *) &value, _default, _min, _max, func_validate, \
1429 0} INIT_BRACE_END, \
1430 func_action, FALSE, .ruleset_settable = TRUE},
1431
1432#define GEN_STRING(name, value, sclass, scateg, slevel, al_read, al_write, \
1433 short_help, extra_help, func_validate, func_action, \
1434 _default) \
1435 {name, sclass, al_read, al_write, short_help, extra_help, NULL, \
1436 SST_STRING, scateg, slevel, \
1437 INIT_BRACE_BEGIN \
1438 .string = {value, _default, sizeof(value), func_validate, ""} \
1439 INIT_BRACE_END, \
1440 func_action, FALSE, .ruleset_settable = TRUE},
1441
1442#define GEN_STRING_NRS(name, value, sclass, scateg, slevel, al_read, al_write, \
1443 short_help, extra_help, func_validate, func_action, \
1444 _default) \
1445 {name, sclass, al_read, al_write, short_help, extra_help, NULL, \
1446 SST_STRING, scateg, slevel, \
1447 INIT_BRACE_BEGIN \
1448 .string = {value, _default, sizeof(value), func_validate, ""} \
1449 INIT_BRACE_END, \
1450 func_action, FALSE, .ruleset_settable = FALSE},
1451
1452#define GEN_ENUM(name, value, sclass, scateg, slevel, al_read, al_write, \
1453 short_help, extra_help, func_help, func_validate, \
1454 func_action, func_name, _default) \
1455 { name, sclass, al_read, al_write, short_help, extra_help, func_help, \
1456 SST_ENUM, scateg, slevel, \
1457 INIT_BRACE_BEGIN \
1458 .enumerator = { &value, sizeof(value), _default, \
1459 func_validate, \
1460 (val_name_func_t) func_name, 0 } INIT_BRACE_END, \
1461 func_action, FALSE, .ruleset_settable = TRUE},
1462
1463#define GEN_BITWISE(name, value, sclass, scateg, slevel, al_read, al_write, \
1464 short_help, extra_help, func_validate, func_action, \
1465 func_name, _default) \
1466 { name, sclass, al_read, al_write, short_help, extra_help, NULL, \
1467 SST_BITWISE, scateg, slevel, \
1468 INIT_BRACE_BEGIN \
1469 .bitwise = { (unsigned *) (void *) &value, _default, func_validate, \
1470 func_name, 0 } INIT_BRACE_END, \
1471 func_action, FALSE, .ruleset_settable = TRUE},
1472
1473/* game settings */
1474static struct setting settings[] = {
1475
1476 /* These should be grouped by sclass */
1477
1478 /* Map size parameters: adjustable if we don't yet have a map */
1481 N_("Map size definition"),
1482 /* TRANS: The strings between double quotes are also translated
1483 * separately (they must match!). The strings between single
1484 * quotes are setting names and shouldn't be translated. The
1485 * strings between parentheses and in uppercase must stay as
1486 * untranslated. */
1487 N_("Chooses the method used to define the map size. Other options "
1488 "specify the parameters for each method.\n"
1489 "- \"Number of tiles\" (FULLSIZE): Map area (option 'size').\n"
1490 "- \"Tiles per player\" (PLAYER): Number of (land) tiles per "
1491 "player (option 'tilesperplayer').\n"
1492 "- \"Width and height\" (XYSIZE): Map width and height in "
1493 "tiles (options 'xsize' and 'ysize')."), NULL,
1495
1498 N_("Map area (in thousands of tiles)"),
1499 /* TRANS: The strings between double quotes are also translated
1500 * separately (they must match!). The strings between single
1501 * quotes are setting names and shouldn't be translated. The
1502 * strings between parentheses and in uppercase must stay as
1503 * untranslated. */
1504 N_("This value is used to determine the map area.\n"
1505 " size = 4 is a normal map of 4,000 tiles (default)\n"
1506 " size = 20 is a huge map of 20,000 tiles\n"
1507 "For this option to take effect, the \"Map size definition\" "
1508 "option ('mapsize') must be set to \"Number of tiles\" "
1509 "(FULLSIZE)."), NULL, NULL, NULL,
1511
1512 GEN_INT("tilesperplayer", wld.map.server.tilesperplayer, SSET_MAP_SIZE,
1514 N_("Number of (land) tiles per player"),
1515 /* TRANS: The strings between double quotes are also translated
1516 * separately (they must match!). The strings between single
1517 * quotes are setting names and shouldn't be translated. The
1518 * strings between parentheses and in uppercase must stay as
1519 * untranslated. */
1520 N_("This value is used to determine the map dimensions. It "
1521 "calculates the map size at game start based on the number "
1522 "of players and the value of the setting 'landmass'.\n"
1523 "For this option to take effect, the \"Map size definition\" "
1524 "option ('mapsize') must be set to \"Tiles per player\" "
1525 "(PLAYER)."),
1528
1529 GEN_INT("xsize", wld.map.xsize, SSET_MAP_SIZE,
1531 N_("Map width in tiles"),
1532 /* TRANS: The strings between double quotes are also translated
1533 * separately (they must match!). The strings between single
1534 * quotes are setting names and shouldn't be translated. The
1535 * strings between parentheses and in uppercase must stay as
1536 * untranslated. */
1537 N_("Defines the map width.\n"
1538 "For this option to take effect, the \"Map size definition\" "
1539 "option ('mapsize') must be set to \"Width and height\" "
1540 "(XYSIZE)."),
1543 GEN_INT("ysize", wld.map.ysize, SSET_MAP_SIZE,
1545 N_("Map height in tiles"),
1546 /* TRANS: The strings between double quotes are also translated
1547 * separately (they must match!). The strings between single
1548 * quotes are setting names and shouldn't be translated. The
1549 * strings between parentheses and in uppercase must stay as
1550 * untranslated. */
1551 N_("Defines the map height.\n"
1552 "For this option to take effect, the \"Map size definition\" "
1553 "option ('mapsize') must be set to \"Width and height\" "
1554 "(XYSIZE)."),
1557
1560 N_("Map topology"),
1562 /* TRANS: Freeciv-web version of the help text. */
1563 N_("Freeciv-web maps are always two-dimensional.\n"),
1564#else /* FREECIV_WEB */
1565 /* TRANS: do not edit the ugly ASCII art */
1566 N_("Freeciv maps are always two-dimensional. "
1567 "Individual tiles may "
1568 "be rectangular or hexagonal, with either an overhead "
1569 "(\"classic\") or isometric alignment.\n"
1570 "To play with a particular topology, clients will need a "
1571 "matching tileset.\n"
1572 "Overhead rectangular: Isometric rectangular:\n"
1573 " _________ /\\/\\/\\/\\/\\\n"
1574 " |_|_|_|_|_| /\\/\\/\\/\\/\\/\n"
1575 " |_|_|_|_|_| \\/\\/\\/\\/\\/\\\n"
1576 " |_|_|_|_|_| /\\/\\/\\/\\/\\/\n"
1577 " \\/\\/\\/\\/\\/\n"
1578 "Hex: Iso-hex:\n"
1579 " /\\/\\/\\/\\/\\/\\ _ _ _ _ _\n"
1580 " | | | | | | | / \\_/ \\_/ \\_/ \\_/ \\\n"
1581 " \\/\\/\\/\\/\\/\\/\\"
1582 " \\_/ \\_/ \\_/ \\_/ \\_/\n"
1583 " | | | | | | | / \\_/ \\_/ \\_/ \\_/ \\\n"
1584 " \\/\\/\\/\\/\\/\\/"
1585 " \\_/ \\_/ \\_/ \\_/ \\_/\n"),
1586#endif /* FREECIV_WEB */
1588
1591 N_("Map wrap"),
1593 /* TRANS: Freeciv-web version of the help text. */
1594 N_("Freeciv-web maps may wrap "
1595 "at the east-west directions to form a flat map or a "
1596 "cylinder.\n"),
1597#else /* FREECIV_WEB */
1598 /* TRANS: do not edit the ugly ASCII art */
1599 N_("Freeciv maps may wrap at "
1600 "the north-south and east-west directions to form a flat "
1601 "map, a cylinder, or a torus (donut)."),
1602#endif /* FREECIV_WEB */
1604
1605 GEN_ENUM("generator", wld.map.server.generator,
1607 N_("Method used to generate map"),
1608 /* TRANS: The strings between double quotes are also translated
1609 * separately (they must match!). The strings between single
1610 * quotes (except 'fair') are setting names and shouldn't be
1611 * translated. The strings between parentheses and in uppercase
1612 * must stay as untranslated. */
1613 N_("Specifies the algorithm used to generate the map. If the "
1614 "default value of the 'startpos' option is used, then the "
1615 "chosen generator chooses an appropriate 'startpos' setting; "
1616 "otherwise, the generated map tries to accommodate the "
1617 "chosen 'startpos' setting.\n"
1618 "- \"Scenario map\" (SCENARIO): indicates a pre-generated map. "
1619 "By default, if the scenario does not specify start positions, "
1620 "they will be allocated depending on the size of continents.\n"
1621 "- \"Fully random height\" (RANDOM): generates maps with a "
1622 "number of equally spaced, relatively small islands. By default, "
1623 "start positions are allocated depending on continent size.\n"
1624 "- \"Pseudo-fractal height\" (FRACTAL): generates Earthlike "
1625 "worlds with one or more large continents and a scattering of "
1626 "smaller islands. By default, players are all placed on a "
1627 "single continent.\n"
1628 "- \"Island-based\" (ISLAND): generates 'fair' maps with a "
1629 "number of similarly-sized and -shaped islands, each with "
1630 "approximately the same ratios of terrain types. By default, "
1631 "each player gets their own island.\n"
1632 "- \"Fair islands\" (FAIR): generates the exact copy of the "
1633 "same island for every player or every team.\n"
1634 "- \"Fracture map\" (FRACTURE): generates maps from a fracture "
1635 "pattern. Tends to place hills and mountains along the edges "
1636 "of the continents.\n"
1637 "If the requested generator is incompatible with other server "
1638 "settings, the server may fall back to another generator."),
1640
1641 GEN_ENUM("startpos", wld.map.server.startpos,
1643 N_("Method used to choose start positions"),
1644 /* TRANS: The strings between double quotes are also translated
1645 * separately (they must match!). The strings between single
1646 * quotes (except 'best') are setting names and shouldn't be
1647 * translated. The strings between parentheses and in uppercase
1648 * must stay as untranslated. */
1649 N_("The method used to choose where each player's initial units "
1650 "start on the map. (For scenarios which include pre-set "
1651 "start positions, this setting is ignored.)\n"
1652 "- \"Generator's choice\" (DEFAULT): the start position "
1653 "placement will depend on the map generator chosen. See the "
1654 "'generator' setting.\n"
1655 "- \"One player per continent\" (SINGLE): one player is "
1656 "placed on each of a set of continents of approximately "
1657 "equivalent value (if possible).\n"
1658 "- \"Two or three players per continent\" (2or3): similar "
1659 "to SINGLE except that two players will be placed on each "
1660 "continent, with three on the 'best' continent if there is an "
1661 "odd number of players.\n"
1662 "- \"All players on a single continent\" (ALL): all players "
1663 "will start on the 'best' available continent.\n"
1664 "- \"Depending on size of continents\" (VARIABLE): players "
1665 "will be placed on the 'best' available continents such that, "
1666 "as far as possible, the number of players on each continent "
1667 "is proportional to its value.\n"
1668 "If the server cannot satisfy the requested setting due to "
1669 "there being too many players for continents, it may fall "
1670 "back to one of the others. (However, map generators try to "
1671 "create the right number of continents for the choice of this "
1672 "'startpos' setting and the number of players, so this is "
1673 "unlikely to occur.)"),
1675
1676 GEN_ENUM("teamplacement", wld.map.server.team_placement,
1678 N_("Method used for placement of team mates"),
1679 /* TRANS: The strings between double quotes are also translated
1680 * separately (they must match!). The strings between single
1681 * quotes are setting names and shouldn't be translated. The
1682 * strings between parentheses and in uppercase must stay as
1683 * untranslated. */
1684 N_("After start positions have been generated thanks to the "
1685 "'startpos' setting, this setting controls how the start "
1686 "positions will be assigned to the different players of the "
1687 "same team.\n"
1688 "- \"Disabled\" (DISABLED): the start positions will be "
1689 "randomly assigned to players, regardless of teams.\n"
1690 "- \"As close as possible\" (CLOSEST): players will be "
1691 "placed as close as possible, regardless of continents.\n"
1692 "- \"On the same continent\" (CONTINENT): if possible, place "
1693 "all players of the same team onto the same "
1694 "island/continent.\n"
1695 "- \"Horizontal placement\" (HORIZONTAL): players of the same "
1696 "team will be placed horizontally.\n"
1697 "- \"Vertical placement\" (VERTICAL): players of the same "
1698 "team will be placed vertically."),
1700
1701 GEN_BOOL("tinyisles", wld.map.server.tinyisles,
1703 N_("Presence of 1x1 islands"),
1704 N_("This setting controls whether the map generator is allowed "
1705 "to make islands of one only tile size."), NULL, NULL,
1707
1708 GEN_BOOL("separatepoles", wld.map.server.separatepoles,
1711 N_("Whether the poles are separate continents"),
1712 N_("If this setting is disabled, the continents may attach to "
1714
1715 GEN_INT("flatpoles", wld.map.server.flatpoles,
1717 N_("How much the land at the poles is flattened"),
1718 /* TRANS: The strings in quotes shouldn't be translated. */
1719 N_("Controls how much the height of the poles is flattened "
1720 "during map generation, preventing a diversity of land "
1721 "terrain there. 0 is no flattening, 100 is maximum "
1722 "flattening. Only affects the 'RANDOM' and 'FRACTAL' "
1723 "map generators."), NULL,
1724 NULL, NULL,
1726
1727 GEN_INT("northlatitude", wld.map.north_latitude,
1730 N_("Northernmost latitude"),
1731 /* TRANS: The string between single quotes is a setting name
1732 * and should not be translated. */
1733 N_("Combined with 'southlatitude', controls what climatic "
1734 "zones exist on the map. Higher values are further north, "
1735 "lower values are further south.\n"
1736 "\n"
1737 "1000 and -1000 gives a full planetary map.\n"
1738 "1000 and 0 gives only a northern hemisphere.\n"
1739 " 500 and 500 gives a map with the same middle-latitude "
1740 "climate everywhere.\n"
1741 " 300 and -300 gives an equatorial map.\n"
1742 "\n"
1743 "In rulesets that support it, latitude may also have certain "
1744 "effects during gameplay."), NULL,
1745 NULL, NULL,
1748 GEN_INT("southlatitude", wld.map.south_latitude,
1751 N_("Southernmost latitude"),
1752 /* TRANS: The string between single quotes is a setting name
1753 * and should not be translated. */
1754 N_("Combined with 'northlatitude', controls what climatic "
1755 "zones exist on the map. Higher values are further north, "
1756 "lower values are further south.\n"
1757 "\n"
1758 "1000 and -1000 gives a full planetary map.\n"
1759 "1000 and 0 gives only a northern hemisphere.\n"
1760 " 500 and 500 gives a map with the same middle-latitude "
1761 "climate everywhere.\n"
1762 " 300 and -300 gives an equatorial map.\n"
1763 "\n"
1764 "In rulesets that support it, latitude may also have certain "
1765 "effects during gameplay."), NULL,
1766 NULL, NULL,
1769
1770 GEN_INT("temperature", wld.map.server.temperature,
1773 N_("Average temperature of the planet"),
1774 N_("Small values will give a cold map, while larger values will "
1775 "give a hotter map.\n"
1776 "\n"
1777 "100 means a very dry and hot planet with no polar arctic "
1778 "zones, only tropical and dry zones.\n"
1779 " 70 means a hot planet with little polar ice.\n"
1780 " 50 means a temperate planet with normal polar, cold, "
1781 "temperate, and tropical zones; a desert zone overlaps "
1782 "tropical and temperate zones.\n"
1783 " 30 means a cold planet with small tropical zones.\n"
1784 " 0 means a very cold planet with large polar zones and no "
1785 "tropics."),
1786 NULL, NULL, NULL,
1788
1789 GEN_INT("landmass", wld.map.server.landpercent,
1792 N_("Percentage of the map that is land"),
1793 N_("This setting gives the approximate percentage of the map "
1794 "that will be made into land."), NULL, NULL, NULL,
1796
1797 GEN_INT("steepness", wld.map.server.steepness,
1800 N_("Amount of hills/mountains"),
1801 N_("Small values give flat maps, while higher values give a "
1802 "steeper map with more hills and mountains."),
1803 NULL, NULL, NULL,
1805
1806 GEN_INT("wetness", wld.map.server.wetness,
1809 N_("Amount of water on landmasses"),
1810 N_("Small values mean lots of dry, desert-like land; "
1811 "higher values give a wetter map with more swamps, "
1812 "jungles, and rivers."), NULL, NULL, NULL,
1814
1815 GEN_BOOL("globalwarming", game.info.global_warming,
1817 N_("Global warming"),
1818 N_("If turned off, global warming will not occur "
1819 "as a result of pollution. This setting does not "
1820 "affect pollution."), NULL, NULL,
1822
1823 GEN_INT("globalwarming_percent", game.server.global_warming_percent,
1825 N_("Global warming percent"),
1826 N_("This is a multiplier for the rate of accumulation of global "
1827 "warming."), NULL, NULL, NULL,
1831
1832 GEN_BOOL("nuclearwinter", game.info.nuclear_winter,
1834 N_("Nuclear winter"),
1835 N_("If turned off, nuclear winter will not occur "
1836 "as a result of nuclear war."), NULL, NULL,
1838
1839 GEN_INT("nuclearwinter_percent", game.server.nuclear_winter_percent,
1841 N_("Nuclear winter percent"),
1842 N_("This is a multiplier for the rate of accumulation of nuclear "
1843 "winter."), NULL, NULL, NULL,
1847
1848 GEN_INT("mapseed", wld.map.server.seed_setting,
1852#else /* FREECIV_WEB */
1854#endif /* FREECIV_WEB */
1855 N_("Map generation random seed"),
1856 N_("The same seed will always produce the same map; "
1857 "for zero (the default) a seed will be generated randomly, "
1858 "based on gameseed. If also gameseed is zero, "
1859 "the map will be completely random."),
1860 NULL, NULL, NULL,
1862
1863 /* Map additional stuff: huts and specials. gameseed also goes here
1864 * because huts and specials are the first time the gameseed gets used (?)
1865 * These are done when the game starts, so these are historical and
1866 * fixed after the game has started.
1867 */
1868 GEN_INT("gameseed", game.server.seed_setting,
1872#else /* FREECIV_WEB */
1874#endif /* FREECIV_WEB */
1875 N_("Game random seed"),
1876 N_("For zero (the default) a seed will be chosen based "
1877 "on system entropy or, failing that, the current time."),
1878 NULL, NULL, NULL,
1880
1881 GEN_INT("specials", wld.map.server.riches,
1883 N_("Amount of \"special\" resource tiles"),
1884 N_("Special resources improve the basic terrain type they "
1885 "are on. The server variable's scale is parts per "
1886 "thousand."), NULL, NULL, NULL,
1888
1889 GEN_INT("huts", wld.map.server.huts,
1891 N_("Amount of huts (bonus extras)"),
1892 N_("Huts are tile extras that usually may be investigated by "
1893 "units. "
1894 "The server variable's scale is huts per thousand tiles."),
1897
1898 GEN_INT("animals", wld.map.server.animals,
1900 N_("Amount of animals"),
1901 N_("Number of animals initially created on terrains "
1902 "defined for them in the ruleset (if the ruleset supports it). "
1903 "The server variable's scale is animals per "
1904 "thousand tiles."), NULL, NULL, NULL,
1906
1907 /* Options affecting numbers of players and AI players. These only
1908 * affect the start of the game and can not be adjusted after that.
1909 */
1910 GEN_INT("minplayers", game.server.min_players,
1913 N_("Minimum number of players"),
1914 N_("There must be at least this many players (connected "
1915 "human players) before the game can start."),
1916 NULL, NULL, NULL,
1918
1919 GEN_INT("maxplayers", game.server.max_players,
1921 N_("Maximum number of players"),
1922 N_("The maximal number of human and AI players who can be in "
1923 "the game. When this number of players are connected in "
1924 "the pregame state, any new players who try to connect "
1925 "will be rejected.\n"
1926 "When playing a scenario which defines player start positions, "
1927 "this setting cannot be set to greater than the number of "
1928 "defined start positions."),
1931
1932 GEN_INT("aifill", game.info.aifill,
1934 N_("Limited number of AI players"),
1935 N_("If set to a positive value, then AI players will be "
1936 "automatically created or removed to keep the total "
1937 "number of players at this amount. As more players join, "
1938 "these AI players will be replaced. When set to zero, "
1939 "all AI players will be removed."),
1942
1943 GEN_ENUM("persistentready", game.info.persistent_ready,
1945 N_("When the Readiness of a player gets autotoggled off"),
1946 N_("In pre-game, usually when new players join or old ones leave, "
1947 "those who have already accepted game to start by toggling \"Ready\" "
1948 "get that autotoggled off in the changed situation. This setting "
1949 "can be used to make readiness more persistent."),
1951
1952 GEN_STRING("nationset", game.server.nationset,
1955 N_("Set of nations to choose from"),
1956 /* TRANS: do not translate '/list nationsets' */
1957 N_("Controls the set of nations allowed in the game. The "
1958 "choices are defined by the ruleset.\n"
1959 "Only nations in the set selected here will be allowed in "
1960 "any circumstances, including new players and civil war; "
1961 "small sets may thus limit the number of players in a game.\n"
1962 "If this is left blank, the ruleset's default nation set is "
1963 "used.\n"
1964 "See '/list nationsets' for possible choices for the "
1965 "currently loaded ruleset."),
1967
1968 GEN_INT("ec_turns", game.server.event_cache.turns,
1971 N_("Event cache for this number of turns"),
1972 N_("Event messages are saved for this number of turns. A value of "
1973 "0 deactivates the event cache."),
1976
1977 GEN_INT("ec_max_size", game.server.event_cache.max_size,
1980 N_("Size of the event cache"),
1981 N_("This defines the maximal number of events in the event cache."),
1984
1985 GEN_BOOL("ec_chat", game.server.event_cache.chat,
1988 N_("Save chat messages in the event cache"),
1989 N_("If turned on, chat messages will be saved in the event "
1991
1992 GEN_BOOL("ec_info", game.server.event_cache.info,
1995 N_("Print turn and time for each cached event"),
1996 /* TRANS: Don't translate the text between single quotes. */
1997 N_("If turned on, all cached events will be marked by the turn "
1998 "and time of the event like '(T2 - 15:29:52)'."),
2000
2001 /* Game initialization parameters (only affect the first start of the game,
2002 * and not reloads). Can not be changed after first start of game.
2003 */
2004 GEN_STRING("startunits", game.server.start_units,
2007 N_("List of players' initial units"),
2008 N_("This should be a string of characters, each of which "
2009 "specifies a unit role. The first character must be native to "
2010 "at least one \"Starter\" terrain. The characters and their "
2011 "meanings are:\n"
2012 " c = City founder (eg., Settlers)\n"
2013 " w = Terrain worker (eg., Engineers)\n"
2014 " x = Explorer (eg., Explorer)\n"
2015 " k = Gameloss (eg., King)\n"
2016 " s = Diplomat (eg., Diplomat)\n"
2017 " f = Ferryboat (eg., Trireme)\n"
2018 " d = Ok defense unit (eg., Warriors)\n"
2019 " D = Good defense unit (eg., Phalanx)\n"
2020 " a = Fast attack unit (eg., Horsemen)\n"
2021 " A = Strong attack unit (eg., Catapult)\n"),
2023
2024 GEN_BOOL("startcity", game.server.start_city,
2027 N_("Whether player starts with a city"),
2028 N_("If this is set, game will start with player's first "
2029 "city already founded to starting location."),
2031
2032 GEN_INT("dispersion", game.server.dispersion,
2035 N_("Area where initial units are located"),
2036 N_("This is the radius within "
2037 "which the initial units are dispersed."),
2038 NULL, NULL, NULL,
2040
2041 GEN_INT("gold", game.info.gold,
2044 N_("Starting gold per player"),
2045 N_("At the beginning of the game, each player is given this "
2046 "much gold."), NULL, NULL, NULL,
2048
2049 GEN_INT("infrapoints", game.info.infrapoints,
2052 N_("Starting infrapoints per player"),
2053 N_("At the beginning of the game, each player is given this "
2054 "many infrapoints."), NULL, NULL, NULL,
2056
2057 GEN_INT("techlevel", game.info.tech,
2060 N_("Number of initial techs per player"),
2061 /* TRANS: The string between single quotes is a setting name and
2062 * should not be translated. */
2063 N_("At the beginning of the game, each player is given this "
2064 "many technologies. The technologies chosen are random for "
2065 "each player. Depending on the value of tech_cost_style in "
2066 "the ruleset, a big value for 'techlevel' can make the next "
2067 "techs really expensive."), NULL, NULL, NULL,
2069
2070 GEN_INT("sciencebox", game.info.sciencebox,
2073 N_("Technology cost multiplier percentage"),
2074 N_("This affects how quickly players can research new "
2075 "technology. All tech costs are multiplied by this amount "
2076 "(as a percentage). The base tech costs are determined by "
2077 "the ruleset or other game settings."),
2080
2081 GEN_BOOL("multiresearch", game.server.multiresearch,
2083 N_("Allow researching multiple technologies"),
2084 N_("Allows switching to any technology without wasting old "
2085 "research. Bulbs are never transferred to new technology. "
2086 "Techpenalty options are ineffective after enabling that "
2087 "option."), NULL, NULL,
2089
2090 GEN_INT("techpenalty", game.server.techpenalty,
2092 N_("Percentage penalty when changing tech"),
2093 N_("If you change your current research technology, and you have "
2094 "positive research points, you lose this percentage of those "
2095 "research points. This does not apply when you have just gained "
2096 "a technology this turn."), NULL, NULL, NULL,
2099
2100 GEN_INT("techlost_recv", game.server.techlost_recv,
2102 N_("Chance to lose a technology while receiving it"),
2103 N_("The chance that learning a technology by treaty or theft "
2104 "will fail."),
2107
2108 GEN_INT("techlost_donor", game.server.techlost_donor,
2110 N_("Chance to lose a technology while giving it"),
2111 N_("The chance that your civilization will lose a technology if "
2112 "you teach it to someone else by treaty, or if it is stolen "
2113 "from you."),
2116
2117 GEN_INT("techleak", game.info.tech_leak_pct,
2119 N_("Tech leakage percent"),
2120 N_("The rate of the tech leakage. This multiplied by the "
2121 "percentage of players who know the tech tell which "
2122 "percentage of tech's bulb cost gets leaked each turn. "
2123 "This setting has no effect if the ruleset has disabled "
2124 "tech leakage."),
2127
2128 GEN_BOOL("team_pooled_research", game.info.team_pooled_research,
2130 N_("Team pooled research"),
2131 N_("If this setting is turned on, then the team mates will share "
2132 "the science research. Else, every player of the team will "
2133 "have to make its own."),
2135
2136 GEN_INT("diplbulbcost", game.server.diplbulbcost,
2138 N_("Penalty when getting tech from treaty"),
2139 N_("For each technology you gain from a diplomatic treaty, you "
2140 "lose research points equal to this percentage of the cost to "
2141 "research a new technology. If this is non-zero, you can end up "
2142 "with negative research points."),
2143 NULL, NULL, NULL,
2145
2146 GEN_INT("diplgoldcost", game.server.diplgoldcost,
2148 N_("Penalty when getting gold from treaty"),
2149 N_("When transferring gold in diplomatic treaties, this percentage "
2150 "of the agreed sum is lost to both parties; it is deducted from "
2151 "the donor but not received by the recipient."),
2152 NULL, NULL, NULL,
2154
2155 GEN_INT("incite_gold_loss_chance", game.server.incite_gold_loss_chance,
2157 N_("Probability of gold loss during inciting revolt"),
2158 N_("When unit trying to incite revolt is eliminated, half of the gold "
2159 "(or quarter, if unit was caught), prepared to bribe citizens, "
2160 "can be lost or captured by enemy."),
2161 NULL, NULL, NULL,
2164
2165 GEN_INT("incite_gold_capt_chance", game.server.incite_gold_capt_chance,
2167 N_("Probability of gold capture during inciting revolt"),
2168 N_("When unit trying to incite revolt is eliminated and lose its "
2169 "gold, there is chance that this gold would be captured by "
2170 "city defender. Transfer tax would be applied, though. "
2171 "This setting is irrelevant, if incite_gold_loss_chance is zero."),
2172 NULL, NULL, NULL,
2175
2176 GEN_INT("conquercost", game.server.conquercost,
2178 N_("Penalty when getting tech from conquering"),
2179 N_("For each technology you gain by conquering an enemy city, you "
2180 "lose research points equal to this percentage of the cost to "
2181 "research a new technology. If this is non-zero, you can end up "
2182 "with negative research points."),
2183 NULL, NULL, NULL,
2186
2187 GEN_INT("freecost", game.server.freecost,
2189 N_("Penalty when getting a free tech"),
2190 /* TRANS: The strings between single quotes are setting names and
2191 * shouldn't be translated. */
2192 N_("For each technology you gain \"for free\" (other than "
2193 "covered by 'diplcost' or 'conquercost': for instance, from huts "
2194 "or from Great Library effects), you lose research points "
2195 "equal to this percentage of the cost to research a new "
2196 "technology. If this is non-zero, you can end up "
2197 "with negative research points."),
2198 NULL, NULL, NULL,
2200
2201 GEN_INT("techlossforgiveness", game.info.techloss_forgiveness,
2203 N_("Research point debt threshold for losing tech"),
2204 N_("When you have negative research points, and your shortfall is "
2205 "greater than this percentage of the cost of your current "
2206 "research, you forget a technology you already knew.\n"
2207 "The special value -1 prevents loss of technology regardless of "
2208 "research points."),
2209 NULL, NULL, NULL,
2212
2213 GEN_INT("techlossrestore", game.server.techloss_restore,
2215 N_("Research points restored after losing a tech"),
2216 N_("When you lose a technology due to a negative research balance "
2217 "(see 'techlossforgiveness'), this percentage of its research "
2218 "cost is credited to your research balance (this may not be "
2219 "sufficient to make it positive).\n"
2220 "The special value -1 means that your research balance is always "
2221 "restored to zero, regardless of your previous shortfall."),
2222 NULL, NULL, NULL,
2225
2226 GEN_INT("foodbox", game.info.foodbox,
2229 N_("Food required for a city to grow"),
2230 N_("This is the base amount of food required to grow a city. "
2231 "This value is multiplied by another factor that comes from "
2232 "the ruleset and is dependent on the size of the city."),
2233 NULL, NULL, NULL,
2235
2236 GEN_INT("aqueductloss", game.server.aqueductloss,
2238 N_("Percentage food lost when city can't grow"),
2239 N_("If a city would expand, but it can't because it lacks some "
2240 "prerequisite (traditionally an Aqueduct or Sewer System), "
2241 "this is the base percentage of its foodbox that is lost "
2242 "each turn; the penalty may be reduced by buildings or other "
2243 "circumstances, depending on the ruleset."),
2244 NULL, NULL, NULL,
2247
2248 GEN_INT("shieldbox", game.info.shieldbox,
2251 N_("Multiplier percentage for production costs"),
2252 N_("This affects how quickly units and buildings can be "
2253 "produced. The base costs are multiplied by this value (as "
2254 "a percentage)."),
2255 NULL, NULL, NULL,
2257
2258 /* Notradesize and fulltradesize used to have callbacks to prevent them
2259 * from being set illegally (notradesize > fulltradesize). However this
2260 * provided a problem when setting them both through the client's settings
2261 * dialog, since they cannot both be set atomically. So the callbacks were
2262 * removed and instead the game now knows how to deal with invalid
2263 * settings. */
2264 GEN_INT("fulltradesize", game.info.fulltradesize,
2266 N_("Minimum city size to get full trade"),
2267 /* TRANS: The strings between single quotes are setting names and
2268 * shouldn't be translated. */
2269 N_("There is a trade penalty in all cities smaller than this. "
2270 "The penalty is 100% (no trade at all) for sizes up to "
2271 "'notradesize', and decreases gradually to 0% (no penalty "
2272 "except the normal corruption) for size='fulltradesize'. "
2273 "See also 'notradesize'."), NULL, NULL, NULL,
2276
2277 GEN_INT("notradesize", game.info.notradesize,
2279 N_("Maximum size of a city without trade"),
2280 /* TRANS: The strings between single quotes are setting names and
2281 * shouldn't be translated. */
2282 N_("Cities do not produce any trade at all unless their size "
2283 "is larger than this amount. The produced trade increases "
2284 "gradually for cities larger than 'notradesize' and smaller "
2285 "than 'fulltradesize'. See also 'fulltradesize'."),
2286 NULL, NULL, NULL,
2289
2290 GEN_INT("tradeworldrelpct", game.info.trade_world_rel_pct,
2292 N_("How largely trade distance is relative to world size"),
2293 /* TRANS: The strings between single quotes are setting names and
2294 * shouldn't be translated. */
2295 N_("When determining trade between cities, the distance factor "
2296 "can be partly or fully relative to world size. This setting "
2297 "determines how big percentage of the bonus calculation is "
2298 "relative to world size, and how much only absolute distance "
2299 "matters."),
2300 NULL, NULL, NULL,
2303
2304 GEN_INT("citymindist", game.info.citymindist,
2307 N_("Minimum distance between cities"),
2308 N_("When a player attempts to found a new city, it is prevented "
2309 "if the distance from any existing city is less than this "
2310 "setting. For example, when this setting is 3, there must be "
2311 "at least two clear tiles in any direction between all existing "
2312 "cities and the new city site. A value of 1 removes any such "
2313 "restriction on city placement."),
2314 NULL, NULL, NULL,
2317
2318 GEN_BOOL("trading_tech", game.info.trading_tech,
2320 N_("Technology trading"),
2321 N_("If turned off, trading technologies in the diplomacy dialog "
2322 "is not allowed."), NULL, NULL,
2324
2325 GEN_BOOL("trading_gold", game.info.trading_gold,
2327 N_("Gold trading"),
2328 N_("If turned off, trading gold in the diplomacy dialog "
2329 "is not allowed."), NULL, NULL,
2331
2332 GEN_BOOL("trading_city", game.info.trading_city,
2334 N_("City trading"),
2335 N_("If turned off, trading cities in the diplomacy dialog "
2336 "is not allowed."), NULL, NULL,
2338
2339 GEN_ENUM("caravan_bonus_style", game.info.caravan_bonus_style,
2341 N_("Caravan bonus style"),
2342 N_("The formula for the bonus when a caravan enters a city. "
2343 "CLASSIC bonuses are proportional to distance and trade "
2344 "of source and destination with multipliers for overseas and "
2345 "international destinations. LOGARITHMIC bonuses are "
2346 "proportional to log^2(distance + trade)."),
2349
2350 GEN_ENUM("trade_revenue_style", game.info.trade_revenue_style,
2352 N_("Trade revenue style"),
2353 N_("The formula for the trade a city receives from a trade route. "
2354 "CLASSIC revenues are given by the sum of the two city sizes "
2355 "plus the distance between them, with multipliers for overseas "
2356 "and international routes. "
2357 "SIMPLE revenues are proportional to the average trade of the "
2358 "two cities."),
2361
2362 GEN_INT("trademindist", game.info.trademindist,
2364 N_("Minimum distance for trade routes"),
2365 N_("In order for two cities in the same civilization to establish "
2366 "a trade route, they must be at least this far apart on the "
2367 "map. For square grids, the distance is calculated as "
2368 "\"Manhattan distance\", that is, the sum of the displacements "
2369 "along the x and y directions."), NULL, NULL, NULL,
2372
2373 GEN_INT("rapturedelay", game.info.rapturedelay,
2376 N_("Number of turns between rapture effect"),
2377 N_("Sets the number of turns between rapture growth of a city. "
2378 "If set to n a city will grow after celebrating for n+1 "
2379 "turns."),
2380 NULL, NULL, NULL,
2383
2384 GEN_INT("disasters", game.info.disasters,
2387 N_("Frequency of disasters"),
2388 N_("Affects how often random disasters happen to cities, "
2389 "if any are defined by the ruleset. The relative frequency "
2390 "of disaster types is set by the ruleset. Zero prevents "
2391 "any random disasters from occurring."),
2392 NULL, NULL, NULL,
2395
2396 GEN_ENUM("traitdistribution", game.server.trait_dist,
2398 N_("AI trait distribution method"),
2399 N_("How trait values are given to AI players."),
2401
2402 GEN_INT("razechance", game.server.razechance,
2404 N_("Chance for conquered building destruction"),
2405 N_("When a player conquers a city, each city improvement has this "
2406 "percentage chance to be destroyed."), NULL, NULL, NULL,
2408
2409 GEN_INT("occupychance", game.server.occupychance,
2411 N_("Chance of moving into tile after attack"),
2412 N_("If set to 0, combat is Civ1/2-style (when you attack, "
2413 "you remain in place). If set to 100, attacking units "
2414 "will always move into the tile they attacked when they win "
2415 "the combat (and no enemy units remain in the tile). If "
2416 "set to a value between 0 and 100, this will be used as "
2417 "the percent chance of \"occupying\" territory."),
2418 NULL, NULL, NULL,
2421
2424 N_("Turn on/off server-side autoattack"),
2425 N_("If set to on, units with moves left will automatically "
2426 "consider attacking enemy units that move adjacent to them."),
2428
2429 GEN_BOOL("killstack", game.info.killstack,
2432 N_("Do all units in tile die with defender"),
2433 N_("If this is enabled, each time a defender unit loses in combat, "
2434 "and is not inside a city or suitable base, all units in the same "
2435 "tile are destroyed along with the defender. If this is disabled, "
2436 "only the defender unit is destroyed."),
2438
2439 GEN_BOOL("killcitizen", game.info.killcitizen,
2441 N_("Reduce city population after attack"),
2442 N_("This flag indicates whether a city's population is reduced "
2443 "after a successful attack by an enemy unit. If this is "
2444 "disabled, population is never reduced. Even when this is "
2445 "enabled, only some units may kill citizens."),
2447
2448 GEN_INT("killunhomed", game.server.killunhomed,
2450 N_("Slowly kill units without home cities (e.g., starting units)"),
2451 N_("If greater than 0, then every unit without a homecity will "
2452 "lose hitpoints each turn. The number of hitpoints lost is "
2453 "given by 'killunhomed' percent of the hitpoints of the unit "
2454 "type. At least one hitpoint is lost every turn until the "
2455 "death of the unit."),
2458
2459 GEN_ENUM("borders", game.info.borders,
2462 N_("National borders"),
2463 N_("If this is not disabled, then any land tiles around a "
2464 "city or border-claiming extra (like the classic ruleset's "
2465 "Fortress base) will be owned by that nation. "
2466 "SEE_INSIDE and EXPAND makes everything inside a player's "
2467 "borders visible at once. ENABLED will, in some rulesets, "
2468 "grant the same visibility if certain conditions are met."),
2470
2471 GEN_ENUM("happyborders", game.info.happyborders,
2474 N_("Units inside borders cause no unhappiness"),
2475 N_("If this is set, units will not cause unhappiness when "
2476 "inside your borders, or even allies borders, depending "
2477 "on value."), NULL, NULL, NULL,
2479
2480 GEN_ENUM("diplomacy", game.info.diplomacy,
2483 N_("Ability to do diplomacy with other players"),
2484 N_("This setting controls the ability to do diplomacy with "
2485 "other players."),
2487
2490 N_("Allowed city names"),
2491 /* TRANS: The strings between double quotes are also translated
2492 * separately (they must match!). The strings between parentheses
2493 * and in uppercase must not be translated. */
2494 N_("- \"No restrictions\" (NO_RESTRICTIONS): players can have "
2495 "multiple cities with the same names.\n"
2496 "- \"Unique to a player\" (PLAYER_UNIQUE): one player can't "
2497 "have multiple cities with the same name.\n"
2498 "- \"Globally unique\" (GLOBAL_UNIQUE): all cities in a game "
2499 "have to have different names.\n"
2500 "- \"No city name stealing\" (NO_STEALING): like "
2501 "\"Globally unique\", but a player isn't allowed to use a "
2502 "default city name of another nation unless it is a default "
2503 "for their nation also."),
2505
2506 GEN_ENUM("plrcolormode", game.server.plrcolormode,
2508 N_("How to pick player colors"),
2509 /* TRANS: The strings between double quotes are also translated
2510 * separately (they must match!). The strings between single quotes
2511 * are setting names and shouldn't be translated. The strings
2512 * between parentheses and in uppercase must not be translated. */
2513 N_("This setting determines how player colors are chosen. Player "
2514 "colors are used in the Nations report, for national borders on "
2515 "the map, and so on.\n"
2516 "- \"Per-player, in order\" (PLR_ORDER): colors are assigned to "
2517 "individual players in order from a list defined by the "
2518 "ruleset.\n"
2519 "- \"Per-player, random\" (PLR_RANDOM): colors are assigned "
2520 "to individual players randomly from the set defined by the "
2521 "ruleset.\n"
2522 "- \"Set manually\" (PLR_SET): colors can be set with the "
2523 "'playercolor' command before the game starts; these are not "
2524 "restricted to the ruleset colors. Any players for which no "
2525 "color is set when the game starts get a random color from the "
2526 "ruleset.\n"
2527 "- \"Per-team, in order\" (TEAM_ORDER): colors are assigned to "
2528 "teams from the list in the ruleset. Every player on the same "
2529 "team gets the same color.\n"
2530 "- \"Per-nation, in order\" (NATION_ORDER): if the ruleset "
2531 "defines a color for a player's nation, the player takes that "
2532 "color. Any players whose nations don't have associated colors "
2533 "get a random color from the list in the ruleset.\n"
2534 "Regardless of this setting, individual player colors can be "
2535 "changed after the game starts with the 'playercolor' command."),
2538
2539 /* Flexible rules: these can be changed after the game has started.
2540 *
2541 * The distinction between "rules" and "flexible rules" is not always
2542 * clearcut, and some existing cases may be largely historical or
2543 * accidental. However some generalizations can be made:
2544 *
2545 * -- Low-level game mechanics should not be flexible (eg, rulesets).
2546 * -- Options which would affect the game "state" (city production etc)
2547 * should not be flexible (eg, foodbox).
2548 * -- Options which are explicitly sent to the client (eg, in
2549 * packet_game_info) should probably not be flexible, or at
2550 * least need extra care to be flexible.
2551 */
2552 GEN_ENUM("barbarians", game.server.barbarianrate,
2555 N_("Barbarian appearance frequency"),
2556 /* TRANS: The string between single quotes is a setting name and
2557 * should not be translated. */
2558 N_("This setting controls how frequently the barbarians appear "
2559 "in the game. See also the 'onsetbarbs' setting."),
2561
2562 GEN_INT("onsetbarbs", game.server.onsetbarbarian,
2565 N_("Barbarian onset turn"),
2566 N_("Barbarians will not appear before this turn."),
2567 NULL, NULL, NULL,
2570
2571 GEN_ENUM("revolentype", game.info.revolentype,
2573 N_("Way to determine revolution length"),
2574 N_("Which method is used in determining how long period of anarchy "
2575 "lasts when changing government. The actual value is set with "
2576 "'revolen' setting. The 'quickening' methods depend on how "
2577 "many times any player has changed to this type of government "
2578 "before, so it becomes easier to establish a new system of "
2579 "government if it has been done before."),
2581
2585 N_("Length of revolution"),
2586 N_("When changing governments, a period of anarchy will occur. "
2587 "Value of this setting, used the way 'revolentype' setting "
2588 "dictates, defines the length of the anarchy."),
2589 NULL, NULL, NULL,
2592
2593 GEN_BOOL("fogofwar", game.info.fogofwar,
2595 N_("Whether to enable fog of war"),
2596 N_("If this is enabled, only those units and cities within "
2597 "the vision range of your own units and cities will be "
2598 "revealed to you. You will not see new cities or terrain "
2599 "changes in tiles not observed."),
2601
2602 GEN_BOOL("foggedborders", game.server.foggedborders,
2604 N_("Whether fog of war applies to border changes"),
2605 N_("If this setting is enabled, players will not be able "
2606 "to see changes in tile ownership if they do not have "
2607 "direct sight of the affected tiles. Otherwise, players "
2608 "can see any or all changes to borders as long as they "
2609 "have previously seen the tiles."),
2611
2612 GEN_BITWISE("airliftingstyle", game.info.airlifting_style,
2614 ALLOW_NONE, ALLOW_BASIC, N_("Airlifting style"),
2615 /* TRANS: The strings between double quotes are also
2616 * translated separately (they must match!). The strings
2617 * between parenthesis and in uppercase must not be
2618 * translated. */
2619 N_("This setting affects airlifting units between cities. It "
2620 "can be a set of the following values:\n"
2621 "- \"Allows units to be airlifted from allied cities\" "
2622 "(FROM_ALLIES).\n"
2623 "- \"Allows units to be airlifted to allied cities\" "
2624 "(TO_ALLIES).\n"
2625 "- \"Unlimited units from source city\" (SRC_UNLIMITED): "
2626 "airlifting from a city doesn't reduce the "
2627 "airlifted counter. It depends on the ruleset whether "
2628 "this is possible even with zero airlift capacity.\n"
2629 "- \"Unlimited units to destination city\" "
2630 "(DEST_UNLIMITED): airlifting to a city doesn't "
2631 "reduce the airlifted counter. It depends on the ruleset "
2632 "whether this is possible even with zero airlift capacity."),
2634
2635 GEN_INT("diplchance", game.server.diplchance,
2638 N_("Base chance for diplomats and spies to succeed"),
2639 N_("The base chance of a spy returning from a successful mission and "
2640 "the base chance of success for diplomats and spies for most "
2641 "aggressive mission types. Not all the mission types use diplchance "
2642 "as a base chance – a ruleset can even say that no action at all does. "
2643 "Unit Bribing, and Unit Sabotaging never do. "
2644 "Non-aggressive missions typically have no base chance "
2645 "at all, but always success."),
2646 NULL, NULL, NULL,
2648
2652 N_("What kinds of victories are possible"),
2653 /* TRANS: The strings between double quotes are also translated
2654 * separately (they must match!). The strings between single
2655 * quotes are setting names and shouldn't be translated. The
2656 * strings between parentheses and in uppercase must stay as
2657 * untranslated. */
2658 N_("This setting controls how game can be won. One can always "
2659 "win by conquering entire planet, but other victory conditions "
2660 "can be enabled or disabled:\n"
2661 "- \"Spacerace\" (SPACERACE): Spaceship is built and travels to "
2662 "Alpha Centauri.\n"
2663 "- \"Allied\" (ALLIED): After defeating enemies, all remaining "
2664 "players are allied.\n"
2665 "- \"Culture\" (CULTURE): Player meets ruleset defined cultural "
2666 "domination criteria.\n"
2667 "- \"World Peace\" (WORLDPEACE): There's no wars in the world for "
2668 "the specified amount of turns.\n"),
2670
2673 N_("Should the game end if the spaceship arrives?"),
2674 N_("If this option is turned on, the game will end with the "
2675 "arrival of a spaceship at Alpha Centauri."),
2677
2678 GEN_INT("spaceship_travel_pct", game.server.spaceship_travel_pct,
2681 N_("Percentage to multiply spaceship travel time by"),
2682 N_("This percentage is multiplied onto the time it will take for "
2683 "a spaceship to arrive at Alpha Centauri."), NULL, NULL, NULL,
2686
2687 GEN_INT("civilwarsize", game.server.civilwarsize,
2690 N_("Minimum number of cities for civil war"),
2691 N_("A civil war is triggered when a player has at least this "
2692 "many cities and the player's capital is captured. If "
2693 "this option is set to the maximum value, civil wars are "
2694 "turned off altogether."), NULL, NULL, NULL,
2697
2698 GEN_BOOL("restrictinfra", game.info.restrictinfra,
2701 N_("Restrict the use of the infrastructure for enemy units"),
2702 N_("If this option is enabled, the use of roads and rails "
2703 "will be restricted for enemy units."), NULL, NULL,
2705
2706 GEN_BOOL("unreachableprotects", game.info.unreachable_protects,
2709 N_("Does unreachable unit protect reachable ones"),
2710 N_("This option controls whether tiles with both unreachable "
2711 "and reachable units can be attacked. If disabled, any "
2712 "tile with reachable units can be attacked. If enabled, "
2713 "tiles with an unreachable unit in them cannot be attacked. "
2714 "Some units in some rulesets may override this, never "
2715 "protecting reachable units on their tile."),
2717
2718 GEN_INT("contactturns", game.server.contactturns,
2721 N_("Turns until player contact is lost"),
2722 N_("Players may meet for diplomacy this number of turns "
2723 "after their units have last met, even when they do not have "
2724 "an embassy. If set to zero, then players cannot meet unless "
2725 "they have an embassy."),
2726 NULL, NULL, NULL,
2729
2730 GEN_BOOL("savepalace", game.server.savepalace,
2733 N_("Rebuild palace whenever capital is conquered"),
2734 N_("If this is turned on, when the capital is conquered the "
2735 "palace is automatically rebuilt for free in another randomly "
2736 "chosen city. This is significant because the technology "
2737 "requirement for building a palace will be ignored. (In "
2738 "some rulesets, buildings other than the palace are affected "
2739 "by this setting.)"),
2741
2742 GEN_BOOL("homecaughtunits", game.server.homecaughtunits,
2745 N_("Give caught units a homecity"),
2746 /* TRANS: The string between single quotes is a setting name and
2747 * should not be translated. */
2748 N_("If unset, caught units will have no homecity and will be "
2749 "subject to the 'killunhomed' option."),
2751
2752 GEN_BOOL("naturalcitynames", game.server.natural_city_names,
2755 N_("Whether to use natural city names"),
2756 N_("If enabled, the default city names will be determined based "
2757 "on the surrounding terrain."),
2759
2760 GEN_BOOL("migration", game.server.migration,
2763 N_("Whether to enable citizen migration"),
2764 /* TRANS: The strings between single quotes are setting names
2765 * and should not be translated. */
2766 N_("This is the master setting that controls whether citizen "
2767 "migration is active in the game. If enabled, citizens may "
2768 "automatically move from less desirable cities to more "
2769 "desirable ones. The \"desirability\" of a given city is "
2770 "calculated from a number of factors. In general larger "
2771 "cities with more income and improvements will be preferred. "
2772 "Citizens will never migrate out of the capital, or cause "
2773 "a wonder to be lost by disbanding a city. A number of other "
2774 "settings control how migration behaves:\n"
2775 " 'mgr_turninterval' - How often citizens try to migrate.\n"
2776 " 'mgr_foodneeded' - Whether destination food is checked.\n"
2777 " 'mgr_distance' - How far citizens will migrate.\n"
2778 " 'mgr_worldchance' - Chance for inter-nation migration.\n"
2779 " 'mgr_nationchance' - Chance for intra-nation migration."),
2781
2782 GEN_INT("mgr_turninterval", game.server.mgr_turninterval,
2785 N_("Number of turns between migrations from a city"),
2786 /* TRANS: Do not translate 'migration' setting name. */
2787 N_("This setting controls the number of turns between migration "
2788 "checks for a given city. The interval is calculated from "
2789 "the founding turn of the city. So for example if this "
2790 "setting is 5, citizens will look for a suitable migration "
2791 "destination every five turns from the founding of their "
2792 "current city. Migration will never occur the same turn "
2793 "that a city is built. This setting has no effect unless "
2794 "migration is enabled by the 'migration' setting."),
2795 NULL, NULL, NULL,
2798
2799 GEN_BOOL("mgr_foodneeded", game.server.mgr_foodneeded,
2802 N_("Whether migration is limited by food"),
2803 /* TRANS: Do not translate 'migration' setting name. */
2804 N_("If this setting is enabled, citizens will not migrate to "
2805 "cities which would not have enough food to support them. "
2806 "This setting has no effect unless migration is enabled by "
2807 "the 'migration' setting."), NULL, NULL,
2809
2810 GEN_INT("mgr_distance", game.server.mgr_distance,
2813 N_("Maximum distance citizens may migrate"),
2814 /* TRANS: Do not translate 'migration' setting name. */
2815 N_("This setting controls how far citizens may look for a "
2816 "suitable migration destination when deciding which city "
2817 "to migrate to. The value is added to the candidate target "
2818 "city's radius and compared to the distance between the "
2819 "two cities. If the distance is lower or equal, migration "
2820 "is possible. (So with a setting of 0, citizens will only "
2821 "consider migrating if their city's center is within the "
2822 "destination city's working radius.) This setting has no "
2823 "effect unless migration is enabled by the 'migration' "
2824 "setting."),
2827
2828 GEN_INT("mgr_nationchance", game.server.mgr_nationchance,
2831 N_("Percent probability for migration within the same nation"),
2832 /* TRANS: Do not translate 'migration' setting name. */
2833 N_("This setting controls how likely it is for citizens to "
2834 "migrate between cities owned by the same player. Zero "
2835 "indicates migration will never occur, 100 means that "
2836 "migration will always occur if the citizens find a suitable "
2837 "destination. This setting has no effect unless migration "
2838 "is activated by the 'migration' setting."),
2839 NULL, NULL, NULL,
2842
2843 GEN_INT("mgr_worldchance", game.server.mgr_worldchance,
2846 N_("Percent probability for migration between foreign cities"),
2847 /* TRANS: Do not translate 'migration' setting name. */
2848 N_("This setting controls how likely it is for migration "
2849 "to occur between cities owned by different players. "
2850 "Zero indicates migration will never occur, 100 means "
2851 "that citizens will always migrate if they find a suitable "
2852 "destination. This setting has no effect if migration is "
2853 "not enabled by the 'migration' setting."),
2854 NULL, NULL, NULL,
2857
2858 /* Meta options: these don't affect the internal rules of the game, but
2859 * do affect players. Also options which only produce extra server
2860 * "output" and don't affect the actual game.
2861 * ("endturn" is here, and not RULES_FLEXIBLE, because it doesn't
2862 * affect what happens in the game, it just determines when the
2863 * players stop playing and look at the score.)
2864 */
2865 GEN_STRING("allowtake", game.server.allow_take,
2867 N_("Players that users are allowed to take"),
2868 /* TRANS: the strings in double quotes are server command names
2869 * and should not be translated. */
2870 N_("This should be a string of characters, each of which "
2871 "specifies a type or status of a civilization (player).\n"
2872 "Clients will only be permitted to take or observe those "
2873 "players which match one of the specified letters. This "
2874 "only affects future uses of the \"take\" or \"observe\" "
2875 "commands; it is not retroactive. The characters and their "
2876 "meanings are:\n"
2877 " o,O = Global observer\n"
2878 " b = Barbarian players\n"
2879 " d = Dead players\n"
2880 " a,A = AI players\n"
2881 " h,H = Human players\n"
2882 "The first description on this list which matches a "
2883 "player is the one which applies. Thus 'd' does not "
2884 "include dead barbarians, 'a' does not include dead AI "
2885 "players, and so on. Upper case letters apply before "
2886 "the game has started, lower case letters afterwards.\n"
2887 "Each character above may be followed by one of the "
2888 "following numbers to allow or restrict the manner "
2889 "of connection:\n"
2890 "(none) = Controller allowed, observers allowed, "
2891 "can displace connections. (Displacing a connection means "
2892 "that you may take over a player, even when another user "
2893 "already controls that player.)\n"
2894 " 1 = Controller allowed, observers allowed, "
2895 "can't displace connections;\n"
2896 " 2 = Controller allowed, no observers allowed, "
2897 "can displace connections;\n"
2898 " 3 = Controller allowed, no observers allowed, "
2899 "can't displace connections;\n"
2900 " 4 = No controller allowed, observers allowed"),
2902
2903 GEN_BOOL("autotoggle", game.server.auto_ai_toggle,
2906 N_("Whether AI-status toggles with connection"),
2907 N_("If enabled, AI status is turned off when a player "
2908 "connects, and on when a player disconnects."),
2910
2911 GEN_INT("endturn", game.server.end_turn,
2913 N_("Turn the game ends"),
2914 N_("The game will end at the end of the given turn."),
2917
2920 N_("Reveal the map"),
2921 /* TRANS: The strings between double quotes are also translated
2922 * separately (they must match!). The strings between single
2923 * quotes are setting names and shouldn't be translated. The
2924 * strings between parentheses and in uppercase must not be
2925 * translated. */
2926 N_("If \"Reveal map at game start\" (START) is set, the "
2927 "initial state of the entire map will be known to all "
2928 "players from the start of the game, although it may "
2929 "still be fogged (depending on the 'fogofwar' setting). "
2930 "If \"Unfog map for dead players\" (DEAD) is set, dead "
2931 "players can see the entire map, if they are alone in "
2932 "their team."),
2934
2935 GEN_INT("timeout", game.info.timeout,
2937 N_("Maximum seconds per turn"),
2938 /* TRANS: \"Turn Done\" refers to the client button; it is also
2939 * translated separately, the translation should be the same.
2940 * \"timeoutincrease\" is a command name and must not to be
2941 * translated. */
2942 N_("If all players have not hit \"Turn Done\" before this "
2943 "time is up, then the turn ends automatically. Zero "
2944 "means there is no timeout. In servers compiled with "
2945 "debugging, a timeout of -1 sets the autogame test mode. "
2946 "Only connections with hack level access may set the "
2947 "timeout to fewer than 30 seconds. Use this with the "
2948 "command \"timeoutincrease\" to have a dynamic timer. "
2949 "The first turn is treated as a special case and is controlled "
2950 "by the 'first_timeout' setting."),
2953
2954 GEN_INT("first_timeout", game.info.first_timeout,
2956 N_("First turn timeout"),
2957 /* TRANS: The strings between single quotes are setting names and
2958 * should not be translated. */
2959 N_("If greater than 0, T1 will last for 'first_timeout' seconds.\n"
2960 "If set to 0, T1 will not have a timeout.\n"
2961 "If set to -1, the special treatment of T1 will be disabled.\n"
2962 "See also 'timeout'."),
2966
2967 GEN_INT("timeaddenemymove", game.server.timeoutaddenemymove,
2969 N_("Timeout at least n seconds when enemy moved"),
2970 N_("Any time a unit moves while in sight of an enemy player, "
2971 "the remaining timeout is increased to this value."),
2972 NULL, NULL, NULL,
2974
2975 GEN_INT("unitwaittime", game.server.unitwaittime,
2978 N_("Minimum time between unit actions over turn change"),
2979 /* TRANS: The string between single quotes is a setting name and
2980 * should not be translated. */
2981 N_("This setting gives the minimum amount of time in seconds "
2982 "between unit moves and other significant actions (such as "
2983 "building cities) after a turn change occurs. For example, "
2984 "if this setting is set to 20 and a unit moves 5 seconds "
2985 "before the turn change, it will not be able to move or act "
2986 "in the next turn for at least 15 seconds. This value is "
2987 "limited to a maximum value of 2/3 'timeout'."),
2990
2991 /* This setting points to the "stored" value; changing it won't have
2992 * an effect until the next synchronization point (i.e., the start of
2993 * the next turn). */
2997 N_("Control of simultaneous player/team phases"),
2998 N_("This setting controls whether players may make "
2999 "moves at the same time during a turn. Change "
3000 "in setting takes effect next turn."),
3002
3003 GEN_INT("nettimeout", game.server.tcptimeout,
3005 N_("Seconds to let a client's network connection block"),
3006 N_("If a network connection is blocking for a time greater than "
3007 "this value, then the connection is closed. Zero "
3008 "means there is no timeout (although connections will be "
3009 "automatically disconnected eventually)."),
3010 NULL, NULL, NULL,
3012
3013 GEN_INT("netwait", game.server.netwait,
3015 N_("Max seconds for network buffers to drain"),
3016 N_("The server will wait for up to the value of this "
3017 "parameter in seconds, for all client connection network "
3018 "buffers to unblock. Zero means the server will not "
3019 "wait at all."), NULL, NULL, NULL,
3021
3022 GEN_INT("pingtime", game.server.pingtime,
3024 N_("Seconds between PINGs"),
3025 N_("The server will poll the clients with a PING request "
3026 "each time this period elapses."), NULL, NULL, NULL,
3028
3029 GEN_INT("pingtimeout", game.server.pingtimeout,
3032 N_("Time to cut a client"),
3033 N_("If a client doesn't reply to a PING in this time the "
3034 "client is disconnected."), NULL, NULL, NULL,
3036
3037 GEN_BOOL("iphide", game.server.ip_hide,
3040 N_("Keep client IP hidden"),
3041 N_("Don't tell client IP address to other clients. Server operator "
3042 "can still see it. Also, changing this setting cannot do anything "
3043 "to the information already sent before."),
3045
3046 GEN_BOOL("turnblock", game.server.turnblock,
3049 N_("Turn-blocking game play mode"),
3050 N_("If this is turned on, the game turn is not advanced "
3051 "until all players have finished their turn, including "
3052 "disconnected players."),
3054
3055 GEN_BOOL("fixedlength", game.server.fixedlength,
3058 N_("Fixed-length turns play mode"),
3059 /* TRANS: \"Turn Done\" refers to the client button; it is also
3060 * translated separately, the translation should be the same. */
3061 N_("If this is turned on the game turn will not advance "
3062 "until the timeout has expired, even after all players "
3063 "have clicked on \"Turn Done\"."),
3064 NULL, NULL, FALSE)
3065
3066 GEN_INT("top_cities", game.info.top_cities_count,
3069 N_("Number of cities in Top Cities report"),
3070 N_("How many cities should the Top Cities report contain? "
3071 "If this is zero, Top Cities report is not available "
3072 "at all."), NULL, NULL, NULL,
3075
3076 GEN_STRING("demography", game.server.demography,
3079 N_("What is in the Demographics report"),
3080 /* TRANS: The strings between double quotes should be
3081 * translated. */
3082 N_("This should be a string of characters, each of which "
3083 "specifies the inclusion of a line of information "
3084 "in the Demographics report.\n"
3085 "The characters and their meanings are:\n"
3086 " N = include Population\n"
3087 " P = include Production\n"
3088 " A = include Land Area\n"
3089 " L = include Literacy\n"
3090 " R = include Research Speed\n"
3091 " S = include Settled Area\n"
3092 " E = include Economics\n"
3093 " M = include Military Service\n"
3094 " O = include Pollution\n"
3095 " C = include Culture\n"
3096 "Additionally, the following characters control whether "
3097 "or not certain columns are displayed in the report:\n"
3098 " q = display \"quantity\" column\n"
3099 " r = display \"rank\" column\n"
3100 " b = display \"best nation\" column\n"
3101 "The order of characters is not significant, but "
3102 "their capitalization is."),
3104
3105 GEN_INT("saveturns", game.server.save_nturns,
3107 N_("Turns per auto-save"),
3108 /* TRANS: The string between double quotes is also translated
3109 * separately (it must match!). The string between single
3110 * quotes is a setting name and shouldn't be translated. */
3111 N_("How many turns elapse between automatic game saves. This "
3112 "setting only has an effect when the 'autosaves' setting "
3113 "includes \"New turn\"."), NULL, NULL, NULL,
3115
3116 GEN_INT("savefrequency", game.server.save_frequency,
3118 N_("Minutes per auto-save"),
3119 /* TRANS: The string between double quotes is also translated
3120 * separately (it must match!). The string between single
3121 * quotes is a setting name and shouldn't be translated. */
3122 N_("How many minutes elapse between automatic game saves. "
3123 "Unlike other save types, this save is only meant as backup "
3124 "for computer memory, and it always uses the same name, older "
3125 "saves are not kept. This setting only has an effect when the "
3126 "'autosaves' setting includes \"Timer\"."), NULL, NULL, NULL,
3128
3129 GEN_BITWISE("autosaves", game.server.autosaves,
3131 N_("Which savegames are generated automatically"),
3132 /* TRANS: The strings between double quotes are also translated
3133 * separately (they must match!). The strings between single
3134 * quotes are setting names and shouldn't be translated. The
3135 * strings between parentheses and in uppercase must stay as
3136 * untranslated. */
3137 N_("This setting controls which autosave types get generated:\n"
3138 "- \"New turn\" (TURN): Save when turn begins, once every "
3139 "'saveturns' turns.\n"
3140 "- \"Game over\" (GAMEOVER): Final save when game ends.\n"
3141 "- \"No player connections\" (QUITIDLE): "
3142 "Save before server restarts due to lack of players.\n"
3143 "- \"Server interrupted\" (INTERRUPT): Save when server "
3144 "quits due to interrupt.\n"
3145 "- \"Timer\" (TIMER): Save every 'savefrequency' minutes."),
3147
3148 GEN_BOOL("threaded_save", game.server.threaded_save,
3150 N_("Whether to do saving in separate thread"),
3151 /* TRANS: The string between single quotes is a setting name and
3152 * should not be translated. */
3153 N_("If this is turned in, compressing and saving the actual "
3154 "file containing the game situation takes place in "
3155 "the background while game otherwise continues. This way "
3156 "users are not required to wait for the save to finish."),
3158
3161 N_("Savegame compression level"),
3162 /* TRANS: 'compresstype' setting name should not be translated. */
3163 N_("If non-zero, saved games will be compressed depending on the "
3164 "'compresstype' setting. Larger values will give better "
3165 "compression but take longer."),
3166 NULL, NULL, NULL,
3168
3169 GEN_ENUM("compresstype", game.server.save_compress_type,
3171 N_("Savegame compression algorithm"),
3172 N_("Compression library to use for savegames."),
3174
3175 GEN_STRING("savename", game.server.save_name,
3177 N_("Definition of the save file name"),
3178 /* TRANS: %R, %S, %T and %Y must not be translated. The
3179 * strings (examples and setting names) between single quotes
3180 * neither. The strings between <> should be translated.
3181 * xgettext:no-c-format */
3182 N_("Within the string the following custom formats are "
3183 "allowed:\n"
3184 " %R = <reason>\n"
3185 " %S = <suffix>\n"
3186 " %T = <turn-number>\n"
3187 " %Y = <game-year>\n"
3188 "\n"
3189 "Example: 'freeciv-T%04T-Y%+05Y-%R' => "
3190 "'freeciv-T0100-Y00001-manual'\n"
3191 "\n"
3192 "Be careful to use at least one of %T and %Y, else newer "
3193 "savegames will overwrite old ones. If none of the formats "
3194 "is used '-T%04T-Y%05Y-%R' is appended to the value of "
3195 "'savename'."),
3197
3198 GEN_BOOL("scorelog", game.server.scorelog,
3202#else /* FREECIV_WEB */
3204#endif /* FREECIV_WEB */
3205 N_("Whether to log player statistics"),
3206 /* TRANS: The string between single quotes is a setting name and
3207 * should not be translated. */
3208 N_("If this is turned on, player statistics are appended to "
3209 "the file defined by the option 'scorefile' every turn. "
3210 "These statistics can be used to create power graphs after "
3212
3213 GEN_ENUM("scoreloglevel", game.server.scoreloglevel,
3216 N_("Scorelog level"),
3217 N_("Whether scores are logged for all players including AIs, "
3218 "or only for human players."), NULL, NULL, NULL,
3220
3221#ifndef FREECIV_WEB
3222 GEN_STRING("scorefile", game.server.scorefile,
3225 N_("Name for the score log file"),
3226 /* TRANS: Don't translate the string in single quotes. */
3227 N_("The default name for the score log file is "
3228 "'freeciv-score.log'."),
3230#endif /* !FREECIV_WEB */
3231
3232 GEN_INT("maxconnectionsperhost", game.server.maxconnectionsperhost,
3235 N_("Maximum number of connections to the server per host"),
3236 N_("New connections from a given host will be rejected if "
3237 "the total number of connections from the very same host "
3238 "equals or exceeds this value. A value of 0 means that "
3239 "there is no limit, at least up to the maximum number of "
3240 "connections supported by the server."), NULL, NULL, NULL,
3243
3244 GEN_INT("kicktime", game.server.kick_time,
3247 N_("Time before a kicked user can reconnect"),
3248 /* TRANS: the string in double quotes is a server command name and
3249 * should not be translated */
3250 N_("Gives the time in seconds before a user kicked using the "
3251 "\"kick\" command may reconnect. Changing this setting will "
3252 "affect users kicked in the past."), NULL, NULL, NULL,
3254
3255 GEN_INT("luatimeout", game.lua_timeout,
3257 N_("Lua timeout"),
3258 N_("Time in seconds that a single lua script can run before it gets "
3259 "forcibly terminated."), NULL, NULL, NULL,
3261
3264 N_("Metaserver info line"),
3265 N_("User defined metaserver info line. For most of the time "
3266 "a user defined metamessage will be used instead of an "
3267 "automatically generated message. "
3268 "Set to empty (\"\", not \"empty\") to always use an "
3269 "automatically generated meta server message."),
3271
3272 GEN_ENUM("ailevel", game.info.skill_level,
3274 N_("Level of new AIs"),
3275 N_("Difficulty level of any AI players to be created now on. "
3276 "Changing value of this setting does not affect "
3277 "existing players."), NULL, NULL, NULL,
3279
3282 N_("Default AI type"),
3283 N_("Name of the default AI type. New AI players will be "
3284 "created with that type by default. Changing this "
3285 "setting does not affect existing AI players."),
3287};
3288
3289#undef GEN_BOOL
3290#undef GEN_INT
3291#undef GEN_STRING
3292#undef GEN_ENUM
3293#undef GEN_BITWISE
3294
3295/* The number of settings, not including the END. */
3297
3298/************************************************************************/
3302{
3303 return (0 <= id && id < SETTINGS_NUM ? settings + id : NULL);
3304}
3305
3306/************************************************************************/
3309struct setting *setting_by_name(const char *name)
3310{
3312
3314 if (0 == strcmp(name, pset->name)) {
3315 return pset;
3316 }
3318 return NULL;
3319}
3320
3321/************************************************************************/
3324int setting_number(const struct setting *pset)
3325{
3326 fc_assert_ret_val(pset != NULL, -1);
3327 return pset - settings;
3328}
3329
3330/************************************************************************/
3333const char *setting_name(const struct setting *pset)
3334{
3335 return pset->name;
3336}
3337
3338/************************************************************************/
3341const char *setting_short_help(const struct setting *pset)
3342{
3343 return pset->short_help;
3344}
3345
3346/************************************************************************/
3350const char *setting_extra_help(const struct setting *pset, bool constant)
3351{
3352 if (!constant && pset->help_func != NULL) {
3353 return pset->help_func(pset);
3354 }
3355
3356 return _(pset->extra_help);
3357}
3358
3359/************************************************************************/
3363{
3364 return pset->stype;
3365}
3366
3367/************************************************************************/
3371{
3372 return pset->slevel;
3373}
3374
3375/************************************************************************/
3379{
3380 return pset->scategory;
3381}
3382
3383/************************************************************************/
3388static bool setting_is_free_to_change(const struct setting *pset,
3389 char *reject_msg,
3390 size_t reject_msg_len)
3391{
3392 switch (pset->sclass) {
3393 case SSET_MAP_SIZE:
3394 case SSET_MAP_GEN:
3395 /* Only change map options if we don't yet have a map: */
3396 if (map_is_empty()) {
3397 return TRUE;
3398 }
3399
3401 _("The setting '%s' can't be modified after the map "
3402 "is fixed."), setting_name(pset));
3403 return FALSE;
3404
3406 /* Like SSET_RULES except that it can be changed before the game starts
3407 * for heavy scenarios. A heavy scenario comes with players. It can
3408 * include cities, units, diplomatic relations and other complex
3409 * state. Make sure that changing a setting can't make the state of a
3410 * heavy scenario illegal if you want to change it from SSET_RULES to
3411 * SSET_RULES_SCENARIO. */
3412
3414 && server_state() == S_S_INITIAL) {
3415 /* Special case detected. */
3416 return TRUE;
3417 }
3418
3419 /* The special case didn't make it legal to change the setting. Don't
3420 * give up. It could still be legal. Fall through so the non special
3421 * cases are checked too. */
3423
3424 case SSET_MAP_ADD:
3425 case SSET_PLAYERS:
3426 case SSET_GAME_INIT:
3427 case SSET_RULES:
3428 /* Only change start params and most rules if we don't yet have a map,
3429 * or if we do have a map but its a scenario one (ie, the game has
3430 * never actually been started).
3431 */
3432 if (map_is_empty() || game.info.is_new_game) {
3433 return TRUE;
3434 }
3435
3437 _("The setting '%s' can't be modified after the game "
3438 "has started."), setting_name(pset));
3439 return FALSE;
3440
3443 case SSET_META:
3444 /* These can always be changed: */
3445 return TRUE;
3446 }
3447
3448 log_error("Wrong class variant for setting %s (%d): %d.",
3450 settings_snprintf(reject_msg, reject_msg_len, _("Internal error."));
3451
3452 return FALSE;
3453}
3454
3455/************************************************************************/
3461 struct connection *caller, char *reject_msg,
3462 size_t reject_msg_len)
3463{
3464 if (caller
3465 && (caller->access_level < pset->access_level_write)) {
3467 _("You are not allowed to change the setting '%s'."),
3469 return FALSE;
3470 }
3471
3472 switch (pset->lock) {
3473 case SLOCK_NONE:
3474 break;
3475 case SLOCK_RULESET:
3476 /* Setting is locked by the ruleset */
3478 _("The setting '%s' is locked by the ruleset."),
3480 return FALSE;
3481 case SLOCK_ADMIN:
3482 /* Setting is locked by admin */
3484 _("The setting '%s' is locked by admin."),
3486 return FALSE;
3487 }
3488
3490}
3491
3492/************************************************************************/
3497 enum cmdlevel plevel)
3498{
3499 return (plevel >= pset->access_level_read);
3500}
3501
3502/************************************************************************/
3507 struct connection *caller)
3508{
3509 return (!caller
3511}
3512
3513/************************************************************************/
3519static enum m_pre_result
3521 const char *prefix, int *ind_result,
3522 const char **matches, size_t max_matches,
3523 size_t *pnum_matches)
3524{
3525 const struct sset_val_name *name;
3526 size_t len = strlen(prefix);
3527 size_t num_matches;
3528 int i;
3529
3530 *pnum_matches = 0;
3531
3532 if (0 == len) {
3533 return M_PRE_EMPTY;
3534 }
3535
3536 for (i = 0, num_matches = 0; (name = name_fn(i)); i++) {
3537 if (0 == fc_strncasecmp(name->support, prefix, len)) {
3538 if (strlen(name->support) == len) {
3539 *ind_result = i;
3540 return M_PRE_EXACT;
3541 }
3542 if (num_matches < max_matches) {
3543 matches[num_matches] = name->support;
3544 (*pnum_matches)++;
3545 }
3546 if (0 == num_matches++) {
3547 *ind_result = i;
3548 }
3549 }
3550 }
3551
3552 if (1 == num_matches) {
3553 return M_PRE_ONLY;
3554 } else if (1 < num_matches) {
3555 return M_PRE_AMBIGUOUS;
3556 } else {
3557 return M_PRE_FAIL;
3558 }
3559}
3560
3561/************************************************************************/
3566 const char *prefix, int *pvalue,
3567 char *reject_msg,
3568 size_t reject_msg_len)
3569{
3570 const char *matches[16];
3571 size_t num_matches;
3572
3573 switch (setting_match_prefix_base(name_fn, prefix, pvalue, matches,
3575 case M_PRE_EXACT:
3576 case M_PRE_ONLY:
3577 return TRUE; /* Ok. */
3578 case M_PRE_AMBIGUOUS:
3579 {
3580 struct astring astr = ASTRING_INIT;
3581
3582 fc_assert(2 <= num_matches);
3584 _("\"%s\" prefix is ambiguous. Candidates are: %s."),
3585 prefix,
3587 astr_free(&astr);
3588 }
3589 return FALSE;
3590 case M_PRE_EMPTY:
3591 settings_snprintf(reject_msg, reject_msg_len, _("Missing value."));
3592 return FALSE;
3593 case M_PRE_LONG:
3594 case M_PRE_FAIL:
3595 case M_PRE_LAST:
3596 break;
3597 }
3598
3600 _("No match for \"%s\"."), prefix);
3601 return FALSE;
3602}
3603
3604/************************************************************************/
3607static const char *setting_bool_to_str(const struct setting *pset,
3608 bool value, bool pretty,
3609 char *buf, size_t buf_len)
3610{
3611 const struct sset_val_name *name = pset->boolean.name(value);
3612
3613 if (pretty) {
3614 fc_snprintf(buf, buf_len, "%s", Q_(name->pretty));
3615 } else {
3616 fc_strlcpy(buf, name->support, buf_len);
3617 }
3618 return buf;
3619}
3620
3621/************************************************************************/
3628static bool setting_bool_validate_base(const struct setting *pset,
3629 const char *val, int *pint_val,
3630 struct connection *caller,
3631 char *reject_msg,
3632 size_t reject_msg_len)
3633{
3634 char buf[256];
3635
3636 if (SST_BOOL != pset->stype) {
3638 _("This setting is not a boolean."));
3639 return FALSE;
3640 }
3641
3642 sz_strlcpy(buf, val);
3644
3645 return (setting_match_prefix(pset->boolean.name, buf, pint_val,
3647 && (NULL == pset->boolean.validate
3648 || pset->boolean.validate(0 != *pint_val, caller, reject_msg,
3649 reject_msg_len)));
3650}
3651
3652/************************************************************************/
3657bool setting_bool_set(struct setting *pset, const char *val,
3658 struct connection *caller, char *reject_msg,
3659 size_t reject_msg_len)
3660{
3661 int int_val;
3662
3664 || !setting_bool_validate_base(pset, val, &int_val, caller,
3666 return FALSE;
3667 }
3668
3669 *pset->boolean.pvalue = (0 != int_val);
3670 return TRUE;
3671}
3672
3673/************************************************************************/
3677{
3679
3680 return *pset->boolean.pvalue;
3681}
3682
3683/************************************************************************/
3688bool setting_bool_validate(const struct setting *pset, const char *val,
3689 struct connection *caller, char *reject_msg,
3690 size_t reject_msg_len)
3691{
3692 int int_val;
3693
3694 return setting_bool_validate_base(pset, val, &int_val, caller,
3696}
3697
3698/************************************************************************/
3702static const char *setting_bool_secfile_str(secfile_data_t data, int val)
3703{
3704 const struct sset_val_name *name =
3705 ((const struct setting *) data)->boolean.name(val);
3706
3707 return (NULL != name ? name->support : NULL);
3708}
3709
3710/************************************************************************/
3713static const char *setting_int_to_str(const struct setting *pset,
3714 int value, bool pretty,
3715 char *buf, size_t buf_len)
3716{
3717 fc_snprintf(buf, buf_len, "%d", value);
3718 return buf;
3719}
3720
3721/************************************************************************/
3724int setting_int_min(const struct setting *pset)
3725{
3726 fc_assert_ret_val(pset->stype == SST_INT, 0);
3727 return pset->integer.min_value;
3728}
3729
3730/************************************************************************/
3733int setting_int_max(const struct setting *pset)
3734{
3735 fc_assert_ret_val(pset->stype == SST_INT, 0);
3736 return pset->integer.max_value;
3737}
3738
3739/************************************************************************/
3743bool setting_int_set(struct setting *pset, int val,
3744 struct connection *caller, char *reject_msg,
3745 size_t reject_msg_len)
3746{
3748 || !setting_int_validate(pset, val, caller, reject_msg,
3749 reject_msg_len)) {
3750 return FALSE;
3751 }
3752
3753 *pset->integer.pvalue = val;
3754 return TRUE;
3755}
3756
3757/************************************************************************/
3763bool setting_int_validate(const struct setting *pset, int val,
3764 struct connection *caller, char *reject_msg,
3765 size_t reject_msg_len)
3766{
3767 if (SST_INT != pset->stype) {
3769 _("This setting is not an integer."));
3770 return FALSE;
3771 }
3772
3773 if (val < pset->integer.min_value || val > pset->integer.max_value) {
3775 _("Value out of range: %d (min: %d; max: %d)."),
3776 val, pset->integer.min_value, pset->integer.max_value);
3777 return FALSE;
3778 }
3779
3780 return (!pset->integer.validate
3781 || pset->integer.validate(val, caller, reject_msg,
3783}
3784
3785/************************************************************************/
3789{
3791
3792 return *pset->integer.pvalue;
3793}
3794
3795/************************************************************************/
3798static const char *setting_str_to_str(const struct setting *pset,
3799 const char *value, bool pretty,
3800 char *buf, size_t buf_len)
3801{
3802 if (pretty) {
3803 fc_snprintf(buf, buf_len, "\"%s\"", value);
3804 } else {
3806 }
3807 return buf;
3808}
3809
3810/************************************************************************/
3814bool setting_str_set(struct setting *pset, const char *val,
3815 struct connection *caller, char *reject_msg,
3816 size_t reject_msg_len)
3817{
3819 || !setting_str_validate(pset, val, caller, reject_msg,
3820 reject_msg_len)) {
3821 return FALSE;
3822 }
3823
3824 fc_strlcpy(pset->string.value, val, pset->string.value_size);
3825 return TRUE;
3826}
3827
3828/************************************************************************/
3834bool setting_str_validate(const struct setting *pset, const char *val,
3835 struct connection *caller, char *reject_msg,
3836 size_t reject_msg_len)
3837{
3838 if (SST_STRING != pset->stype) {
3840 _("This setting is not a string."));
3841 return FALSE;
3842 }
3843
3844 if (strlen(val) >= pset->string.value_size) {
3846 _("String value too long (max length: %lu)."),
3847 (unsigned long) pset->string.value_size);
3848 return FALSE;
3849 }
3850
3851 return (!pset->string.validate
3852 || pset->string.validate(val, caller, reject_msg,
3854}
3855
3856/************************************************************************/
3860{
3862
3863 return pset->string.value;
3864}
3865
3866/************************************************************************/
3871{
3872 struct sf_cb_data *info = (struct sf_cb_data *)data;
3873 const struct sset_val_name *name;
3874
3875 name = info->set->enumerator.name(val);
3876
3877 if (info->compat && name != NULL) {
3878 const char *ret = setcompat_current_val_from_previous(info->set,
3879 name->support);
3880
3881 if (ret != NULL) {
3882 return ret;
3883 }
3884 }
3885
3886 return (NULL != name ? name->support : NULL);
3887}
3888
3889/************************************************************************/
3893const char *setting_enum_val(const struct setting *pset, int val, bool pretty)
3894{
3895 const struct sset_val_name *name;
3896
3897 fc_assert_ret_val(SST_ENUM == pset->stype, NULL);
3898 name = pset->enumerator.name(val);
3899 if (NULL == name) {
3900 return NULL;
3901 } else if (pretty) {
3902 return _(name->pretty);
3903 } else {
3904 return name->support;
3905 }
3906}
3907
3908/************************************************************************/
3912static const char *setting_enum_to_str(const struct setting *pset,
3913 int value, bool pretty,
3914 char *buf, size_t buf_len)
3915{
3916 const struct sset_val_name *name = pset->enumerator.name(value);
3917
3918 if (pretty) {
3919 fc_snprintf(buf, buf_len, "\"%s\" (%s)",
3920 Q_(name->pretty), name->support);
3921 } else {
3922 fc_strlcpy(buf, name->support, buf_len);
3923 }
3924 return buf;
3925}
3926
3927/************************************************************************/
3934static bool setting_enum_validate_base(const struct setting *pset,
3935 const char *val, int *pint_val,
3936 struct connection *caller,
3937 char *reject_msg,
3938 size_t reject_msg_len)
3939{
3940 char buf[256];
3941
3942 if (SST_ENUM != pset->stype) {
3944 _("This setting is not an enumerator."));
3945 return FALSE;
3946 }
3947
3948 sz_strlcpy(buf, val);
3950
3951 return (setting_match_prefix(pset->enumerator.name, buf, pint_val,
3953 && (NULL == pset->enumerator.validate
3954 || pset->enumerator.validate(*pint_val, caller, reject_msg,
3955 reject_msg_len)));
3956}
3957
3958/************************************************************************/
3961static bool set_enum_value(struct setting *pset, int val)
3962{
3963 switch (pset->enumerator.store_size) {
3964 case sizeof(int):
3965 {
3966 int *to_int = pset->enumerator.pvalue;
3967
3968 *to_int = val;
3969 }
3970 break;
3971 case sizeof(char):
3972 {
3973 char *to_char = pset->enumerator.pvalue;
3974
3975 *to_char = (char) val;
3976 }
3977 break;
3978 case sizeof(short):
3979 {
3980 short *to_short = pset->enumerator.pvalue;
3981
3982 *to_short = (short) val;
3983 }
3984 break;
3985 default:
3986 return FALSE;
3987 }
3988
3989 return TRUE;
3990}
3991
3992/************************************************************************/
3995int read_enum_value(const struct setting *pset)
3996{
3997 int val;
3998
3999 switch (pset->enumerator.store_size) {
4000 case sizeof(int):
4001 val = *((int *)pset->enumerator.pvalue);
4002 break;
4003 case sizeof(char):
4004 val = *((char *)pset->enumerator.pvalue);
4005 break;
4006 case sizeof(short):
4007 val = *((short *)pset->enumerator.pvalue);
4008 break;
4009 default:
4010 log_error("Illegal enum store size %d, can't read value", pset->enumerator.store_size);
4011 return 0;
4012 }
4013
4014 return val;
4015}
4016
4017/************************************************************************/
4022bool setting_enum_set(struct setting *pset, const char *val,
4023 struct connection *caller, char *reject_msg,
4024 size_t reject_msg_len)
4025{
4026 int int_val;
4027
4029 return FALSE;
4030 }
4031
4032 if (!setting_enum_validate_base(pset, val, &int_val, caller,
4034 return FALSE;
4035 }
4036
4037 if (!set_enum_value(pset, int_val)) {
4038 log_error("Illegal enumerator value size %d for %s",
4039 pset->enumerator.store_size, val);
4040 return FALSE;
4041 }
4042
4043 return TRUE;
4044}
4045
4046/************************************************************************/
4051bool setting_enum_validate(const struct setting *pset, const char *val,
4052 struct connection *caller, char *reject_msg,
4053 size_t reject_msg_len)
4054{
4055 int int_val;
4056
4057 return setting_enum_validate_base(pset, val, &int_val, caller,
4059}
4060
4061/************************************************************************/
4066{
4067 struct sf_cb_data *info = (struct sf_cb_data *)data;
4068 const struct sset_val_name *name = info->set->bitwise.name(bit);
4069
4070 if (info->compat && name == NULL) {
4071 if (!fc_strcasecmp("topology", setting_name(info->set))) {
4072 if ((1 << bit) == TF_OLD_WRAPX) {
4073 return "WrapX";
4074 }
4075 if ((1 << bit) == TF_OLD_WRAPY) {
4076 return "WrapY";
4077 }
4078 }
4079 }
4080
4081 return (NULL != name ? name->support : NULL);
4082}
4083
4084/************************************************************************/
4088const char *setting_bitwise_bit(const struct setting *pset,
4089 int bit, bool pretty)
4090{
4091 const struct sset_val_name *name;
4092
4094 name = pset->bitwise.name(bit);
4095 if (NULL == name) {
4096 return NULL;
4097 } else if (pretty) {
4098 return _(name->pretty);
4099 } else {
4100 return name->support;
4101 }
4102}
4103
4104/************************************************************************/
4107static const char *setting_bitwise_to_str(const struct setting *pset,
4108 unsigned value, bool pretty,
4109 char *buf, size_t buf_len)
4110{
4111 const struct sset_val_name *name;
4112 char *old_buf = buf;
4113 int bit;
4114
4115 if (pretty) {
4116 char buf2[256];
4117 struct astring astr = ASTRING_INIT;
4118 struct strvec *vec = strvec_new();
4119 size_t len;
4120
4121 for (bit = 0; (name = pset->bitwise.name(bit)); bit++) {
4122 if ((1 << bit) & value) {
4123 /* TRANS: only emphasizing a string. */
4124 fc_snprintf(buf2, sizeof(buf2), _("\"%s\""), Q_(name->pretty));
4126 }
4127 }
4128
4129 if (0 == strvec_size(vec)) {
4130 /* No value. */
4131 fc_assert(0 == value);
4132 /* TRANS: Bitwise setting has no bits set. */
4133 fc_strlcpy(buf, _("empty value"), buf_len);
4135 return buf;
4136 }
4137
4141 astr_free(&astr);
4142 fc_strlcat(buf, " (", buf_len);
4143 len = strlen(buf);
4144 buf += len;
4145 buf_len -= len;
4146 }
4147
4148 /* Long support part. */
4149 buf[0] = '\0';
4150 for (bit = 0; (name = pset->bitwise.name(bit)); bit++) {
4151 if ((1 << bit) & value) {
4152 if ('\0' != buf[0]) {
4153 fc_strlcat(buf, "|", buf_len);
4154 }
4155 fc_strlcat(buf, name->support, buf_len);
4156 }
4157 }
4158
4159 if (pretty) {
4160 fc_strlcat(buf, ")", buf_len);
4161 }
4162 return old_buf;
4163}
4164
4165/************************************************************************/
4173 const char *val,
4174 unsigned *pint_val,
4175 struct connection *caller,
4176 char *reject_msg,
4177 size_t reject_msg_len)
4178{
4179 char buf[256];
4180 const char *p;
4181 int bit;
4182
4183 if (SST_BITWISE != pset->stype) {
4185 _("This setting is not a bitwise."));
4186 return FALSE;
4187 }
4188
4189 *pint_val = 0;
4190
4191 /* Value names are separated by '|'. */
4192 do {
4193 p = strchr(val, '|');
4194 if (NULL != p) {
4195 p++;
4196 fc_strlcpy(buf, val, MIN(p - val, sizeof(buf)));
4197 } else {
4198 /* Last segment, full copy. */
4199 sz_strlcpy(buf, val);
4200 }
4202 if (NULL == p && '\0' == buf[0] && 0 == *pint_val) {
4203 /* Empty string = value 0. */
4204 break;
4205 } else if (!setting_match_prefix(pset->bitwise.name, buf, &bit,
4207 return FALSE;
4208 }
4209 *pint_val |= 1 << bit;
4210 val = p;
4211 } while (NULL != p);
4212
4213 return (NULL == pset->bitwise.validate
4214 || pset->bitwise.validate(*pint_val, caller,
4216}
4217
4218/************************************************************************/
4223bool setting_bitwise_set(struct setting *pset, const char *val,
4224 struct connection *caller, char *reject_msg,
4225 size_t reject_msg_len)
4226{
4227 unsigned int_val;
4228
4230 || !setting_bitwise_validate_base(pset, val, &int_val, caller,
4232 return FALSE;
4233 }
4234
4235 *pset->bitwise.pvalue = int_val;
4236 return TRUE;
4237}
4238
4239/************************************************************************/
4244bool setting_bitwise_validate(const struct setting *pset, const char *val,
4245 struct connection *caller, char *reject_msg,
4246 size_t reject_msg_len)
4247{
4248 unsigned int_val;
4249
4250 return setting_bitwise_validate_base(pset, val, &int_val, caller,
4252}
4253
4254/************************************************************************/
4258{
4260
4261 return *pset->bitwise.pvalue;
4262}
4263
4264/************************************************************************/
4267const char *setting_value_name(const struct setting *pset, bool pretty,
4268 char *buf, size_t buf_len)
4269{
4273
4274 switch (pset->stype) {
4275 case SST_BOOL:
4276 return setting_bool_to_str(pset, *pset->boolean.pvalue,
4277 pretty, buf, buf_len);
4278 case SST_INT:
4279 return setting_int_to_str(pset, *pset->integer.pvalue,
4280 pretty, buf, buf_len);
4281 case SST_STRING:
4282 return setting_str_to_str(pset, pset->string.value,
4283 pretty, buf, buf_len);
4284 case SST_ENUM:
4286 pretty, buf, buf_len);
4287 case SST_BITWISE:
4288 return setting_bitwise_to_str(pset, *pset->bitwise.pvalue,
4289 pretty, buf, buf_len);
4290 case SST_COUNT:
4291 /* Error logged below. */
4292 break;
4293 }
4294
4295 log_error("%s(): Setting \"%s\" (nb %d) not handled in switch statement.",
4297 return NULL;
4298}
4299
4300/************************************************************************/
4303const char *setting_default_name(const struct setting *pset, bool pretty,
4304 char *buf, size_t buf_len)
4305{
4309
4310 switch (pset->stype) {
4311 case SST_BOOL:
4312 return setting_bool_to_str(pset, pset->boolean.default_value,
4313 pretty, buf, buf_len);
4314 case SST_INT:
4315 return setting_int_to_str(pset, pset->integer.default_value,
4316 pretty, buf, buf_len);
4317 case SST_STRING:
4318 return setting_str_to_str(pset, pset->string.default_value,
4319 pretty, buf, buf_len);
4320 case SST_ENUM:
4321 return setting_enum_to_str(pset, pset->enumerator.default_value,
4322 pretty, buf, buf_len);
4323 case SST_BITWISE:
4324 return setting_bitwise_to_str(pset, pset->bitwise.default_value,
4325 pretty, buf, buf_len);
4326 case SST_COUNT:
4327 /* Error logged below. */
4328 break;
4329 }
4330
4331 log_error("%s(): Setting \"%s\" (nb %d) not handled in switch statement.",
4333 return NULL;
4334}
4335
4336/************************************************************************/
4340{
4341 switch (pset->stype) {
4342 case SST_BOOL:
4343 (*pset->boolean.pvalue) = pset->boolean.default_value;
4344 break;
4345 case SST_INT:
4346 (*pset->integer.pvalue) = pset->integer.default_value;
4347 break;
4348 case SST_STRING:
4349 fc_strlcpy(pset->string.value, pset->string.default_value,
4350 pset->string.value_size);
4351 break;
4352 case SST_ENUM:
4353 set_enum_value(pset, pset->enumerator.default_value);
4354 break;
4355 case SST_BITWISE:
4356 (*pset->bitwise.pvalue) = pset->bitwise.default_value;
4357 break;
4358 case SST_COUNT:
4359 fc_assert(pset->stype != SST_COUNT);
4360 break;
4361 }
4362
4363 pset->setdef = SETDEF_INTERNAL;
4364}
4365
4366/************************************************************************/
4369void setting_action(const struct setting *pset)
4370{
4371 if (pset->action != NULL) {
4372 pset->action(pset);
4373 }
4374}
4375
4376/************************************************************************/
4379bool settings_ruleset(struct section_file *file, const char *section,
4380 bool act, bool compat)
4381{
4382 const char *name;
4383 int j;
4384
4385 /* Unlock all settings. */
4388 if (pset->ruleset_settable && !setting_locked(pset)) {
4390 }
4392
4393 /* Settings */
4394 if (NULL == secfile_section_by_name(file, section)) {
4395 /* No settings in ruleset file */
4396 log_verbose("no [%s] section for game settings in %s", section,
4397 secfile_name(file));
4398 } else {
4399 for (j = 0; (name = secfile_lookup_str_default(file, NULL, "%s.set%d.name",
4400 section, j)); j++) {
4401 char path[256];
4402
4403 fc_snprintf(path, sizeof(path), "%s.set%d", section, j);
4404
4405 if (compat) {
4407 }
4408
4409 if (!setting_ruleset_one(file, name, path, compat)) {
4410 log_error("unknown unsettable setting in '%s': %s",
4411 secfile_name(file), name);
4412 }
4413 }
4414 }
4415
4416 /* Execute all setting actions to consider actions due to the
4417 * default values. */
4418 if (act) {
4420 if (pset->ruleset_settable) {
4422 }
4424 }
4425
4427
4428 /* send game settings */
4430
4431 return TRUE;
4432}
4433
4434/***********************************************************************/
4437static inline void setting_ruleset_setdef(struct setting *pset)
4438{
4439 pset->setdef = SETDEF_RULESET;
4440}
4441
4442/************************************************************************/
4445static bool setting_ruleset_one(struct section_file *file,
4446 const char *name, const char *path,
4447 bool compat)
4448{
4449 struct setting *pset = NULL;
4450 char reject_msg[256], buf[256];
4451 bool lock;
4452 struct sf_cb_data info = { pset, compat };
4453
4456 pset = pset_check;
4457 break;
4458 }
4460
4461 if (pset == NULL || !pset->ruleset_settable) {
4462 /* No setting found or it's not settable by ruleset */
4463 return FALSE;
4464 }
4465
4466 if (!setting_locked(pset)) {
4467 info.set = pset;
4468 info.compat = compat;
4469
4470 switch (pset->stype) {
4471 case SST_BOOL:
4472 {
4473 int ival;
4474 bool val;
4475
4476 /* Allow string with same boolean representation as accepted on
4477 * server command line */
4480 "%s.value", path)) {
4481 val = (ival != 0);
4482 } else if (!secfile_lookup_bool(file, &val, "%s.value", path)) {
4483 log_error("Can't read value for setting '%s': %s", name,
4484 secfile_error());
4485 break;
4486 }
4487 if (val != *pset->boolean.pvalue) {
4488 if (NULL == pset->boolean.validate
4489 || pset->boolean.validate(val, NULL, reject_msg,
4490 sizeof(reject_msg))) {
4491 *pset->boolean.pvalue = val;
4492 log_normal(_("Ruleset: '%s' has been set to %s."),
4494 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4495 } else {
4496 log_error("%s", reject_msg);
4497 }
4498 }
4499 }
4500 break;
4501
4502 case SST_INT:
4503 {
4504 int val;
4505
4506 if (!secfile_lookup_int(file, &val, "%s.value", path)) {
4507 log_error("Can't read value for setting '%s': %s", name,
4508 secfile_error());
4509 } else if (val != *pset->integer.pvalue) {
4511 sizeof(reject_msg))) {
4512 log_normal(_("Ruleset: '%s' has been set to %s."),
4514 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4515 } else {
4516 log_error("%s", reject_msg);
4517 }
4518 }
4519 }
4520 break;
4521
4522 case SST_STRING:
4523 {
4524 const char *val = secfile_lookup_str(file, "%s.value", path);
4525
4526 if (NULL == val) {
4527 log_error("Can't read value for setting '%s': %s", name,
4528 secfile_error());
4529 } else if (0 != strcmp(val, pset->string.value)) {
4531 sizeof(reject_msg))) {
4532 log_normal(_("Ruleset: '%s' has been set to %s."),
4534 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4535 } else {
4536 log_error("%s", reject_msg);
4537 }
4538 }
4539 }
4540 break;
4541
4542 case SST_ENUM:
4543 {
4544 int val;
4545
4546 if (!secfile_lookup_enum_data(file, &val, FALSE,
4548 "%s.value", path)) {
4549 log_error("Can't read value for setting '%s': %s",
4550 name, secfile_error());
4551 } else if (val != read_enum_value(pset)) {
4552 if (NULL == pset->enumerator.validate
4553 || pset->enumerator.validate(val, NULL, reject_msg,
4554 sizeof(reject_msg))) {
4555 set_enum_value(pset, val);
4556 log_normal(_("Ruleset: '%s' has been set to %s."),
4558 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4559 } else {
4560 log_error("%s", reject_msg);
4561 }
4562 }
4563 }
4564 break;
4565
4566 case SST_BITWISE:
4567 {
4568 int val;
4569
4570 if (!secfile_lookup_enum_data(file, &val, TRUE,
4572 "%s.value", path)) {
4573 log_error("Can't read value for setting '%s': %s",
4574 name, secfile_error());
4575 } else if (val != *pset->bitwise.pvalue) {
4576 if (NULL == pset->bitwise.validate
4577 || pset->bitwise.validate((unsigned) val, NULL,
4578 reject_msg, sizeof(reject_msg))) {
4579 *pset->bitwise.pvalue = val;
4580 log_normal(_("Ruleset: '%s' has been set to %s."),
4582 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4583 } else {
4584 log_error("%s", reject_msg);
4585 }
4586 }
4587 }
4588 break;
4589
4590 case SST_COUNT:
4591 fc_assert(pset->stype != SST_COUNT);
4592 break;
4593 }
4594
4596 }
4597
4598 /* set lock */
4599 lock = secfile_lookup_bool_default(file, FALSE, "%s.lock", path);
4600
4601 if (lock) {
4602 /* Set lock */
4604 log_normal(_("Ruleset: '%s' has been locked by the ruleset."),
4606 }
4607
4608 return TRUE;
4609}
4610
4611/************************************************************************/
4615{
4616 switch (setting_type(pset)) {
4617 case SST_BOOL:
4618 return (*pset->boolean.pvalue != pset->boolean.default_value);
4619 case SST_INT:
4620 return (*pset->integer.pvalue != pset->integer.default_value);
4621 case SST_STRING:
4622 return (0 != strcmp(pset->string.value, pset->string.default_value));
4623 case SST_ENUM:
4624 return (read_enum_value(pset) != pset->enumerator.default_value);
4625 case SST_BITWISE:
4626 return (*pset->bitwise.pvalue != pset->bitwise.default_value);
4627 case SST_COUNT:
4628 /* Error logged below. */
4629 break;
4630 }
4631
4632 log_error("%s(): Setting \"%s\" (nb %d) not handled in switch statement.",
4634 return FALSE;
4635}
4636
4637/************************************************************************/
4640bool setting_locked(const struct setting *pset)
4641{
4642 return pset->lock != SLOCK_NONE;
4643}
4644
4645/************************************************************************/
4649{
4650 return pset->rslock;
4651}
4652
4653/************************************************************************/
4657{
4658 if (pset->lock < SLOCK_RULESET) {
4659 /* No downgrading the lock */
4660 pset->lock = SLOCK_RULESET;
4661 }
4662 pset->rslock = TRUE;
4663}
4664
4665/************************************************************************/
4669{
4670 pset->lock = SLOCK_ADMIN;
4671}
4672
4673/************************************************************************/
4677{
4678 if (pset->lock == SLOCK_RULESET) {
4679 /* No clearing upper level locks */
4680 pset->lock = SLOCK_RULESET;
4681 }
4682 pset->rslock = FALSE;
4683}
4684
4685/************************************************************************/
4689{
4690 if (pset->rslock) {
4691 pset->lock = SLOCK_RULESET;
4692 } else {
4693 pset->lock = SLOCK_NONE;
4694 }
4695}
4696
4697/************************************************************************/
4700static void setting_game_set(struct setting *pset, bool init)
4701{
4702 switch (setting_type(pset)) {
4703 case SST_BOOL:
4704 pset->boolean.game_value = *pset->boolean.pvalue;
4705 break;
4706
4707 case SST_INT:
4708 pset->integer.game_value = *pset->integer.pvalue;
4709 break;
4710
4711 case SST_STRING:
4712 if (init) {
4713 pset->string.game_value
4714 = fc_calloc(1, pset->string.value_size
4715 * sizeof(pset->string.game_value));
4716 }
4717 fc_strlcpy(pset->string.game_value, pset->string.value,
4718 pset->string.value_size);
4719 break;
4720
4721 case SST_ENUM:
4722 pset->enumerator.game_value = read_enum_value(pset);
4723 break;
4724
4725 case SST_BITWISE:
4726 pset->bitwise.game_value = *pset->bitwise.pvalue;
4727 break;
4728
4729 case SST_COUNT:
4731 break;
4732 }
4733
4734 pset->game_setdef = pset->setdef;
4735}
4736
4737/************************************************************************/
4740static void setting_game_free(struct setting *pset)
4741{
4742 if (setting_type(pset) == SST_STRING) {
4743 FC_FREE(pset->string.game_value);
4744 }
4745}
4746
4747/************************************************************************/
4751{
4752 char reject_msg[256] = "", buf[256];
4753 bool res = FALSE;
4754
4756 log_debug("Can't restore '%s': %s", setting_name(pset),
4757 reject_msg);
4758 return;
4759 }
4760
4761 if (pset->game_setdef == SETDEF_INTERNAL) {
4763 return;
4764 }
4765
4766 switch (setting_type(pset)) {
4767 case SST_BOOL:
4768 res = (NULL != setting_bool_to_str(pset, pset->boolean.game_value,
4769 FALSE, buf, sizeof(buf))
4771 sizeof(reject_msg)));
4772 break;
4773
4774 case SST_INT:
4775 res = setting_int_set(pset, pset->integer.game_value, NULL, reject_msg,
4776 sizeof(reject_msg));
4777 break;
4778
4779 case SST_STRING:
4780 res = setting_str_set(pset, pset->string.game_value, NULL, reject_msg,
4781 sizeof(reject_msg));
4782 break;
4783
4784 case SST_ENUM:
4785 res = (NULL != setting_enum_to_str(pset, pset->enumerator.game_value,
4786 FALSE, buf, sizeof(buf))
4788 sizeof(reject_msg)));
4789 break;
4790
4791 case SST_BITWISE:
4792 res = (NULL != setting_bitwise_to_str(pset, pset->bitwise.game_value,
4793 FALSE, buf, sizeof(buf))
4795 sizeof(reject_msg)));
4796 break;
4797
4798 case SST_COUNT:
4799 res = FALSE;
4800 break;
4801 }
4802
4803 if (!res) {
4804 log_error("Error restoring setting '%s' to the value from game start: "
4805 "%s", setting_name(pset), reject_msg);
4806 }
4807}
4808
4809/************************************************************************/
4813{
4817
4818 /* Settings from the start of the game are saved. */
4820}
4821
4822/************************************************************************/
4825void settings_game_save(struct section_file *file, const char *section)
4826{
4827 int set_count = 0;
4828
4830 char errbuf[200];
4831 struct sf_cb_data info = { pset, FALSE };
4832
4833 if (/* It's explicitly set to some value to save */
4835 /* It must be same at loading time as it was saving time, even if
4836 * freeciv's default has changed. */
4839
4841 "%s.set%d.name", section, set_count);
4842 switch (setting_type(pset)) {
4843 case SST_BOOL:
4844 secfile_insert_bool(file, *pset->boolean.pvalue,
4845 "%s.set%d.value", section, set_count);
4846 if (gamestart) {
4847 secfile_insert_bool(file, pset->boolean.game_value,
4848 "%s.set%d.gamestart", section, set_count);
4849 }
4850 break;
4851 case SST_INT:
4852 secfile_insert_int(file, *pset->integer.pvalue,
4853 "%s.set%d.value", section, set_count);
4854 if (gamestart) {
4855 secfile_insert_int(file, pset->integer.game_value,
4856 "%s.set%d.gamestart", section, set_count);
4857 }
4858 break;
4859 case SST_STRING:
4860 secfile_insert_str(file, pset->string.value,
4861 "%s.set%d.value", section, set_count);
4862 if (gamestart) {
4863 secfile_insert_str(file, pset->string.game_value,
4864 "%s.set%d.gamestart", section, set_count);
4865 }
4866 break;
4867 case SST_ENUM:
4870 "%s.set%d.value", section, set_count);
4871 if (gamestart) {
4872 secfile_insert_enum_data(file, pset->enumerator.game_value, FALSE,
4874 "%s.set%d.gamestart", section, set_count);
4875 }
4876 break;
4877 case SST_BITWISE:
4878 secfile_insert_enum_data(file, *pset->bitwise.pvalue, TRUE,
4880 "%s.set%d.value", section, set_count);
4881 if (gamestart) {
4882 secfile_insert_enum_data(file, pset->bitwise.game_value, TRUE,
4884 "%s.set%d.gamestart", section, set_count);
4885 }
4886 break;
4887 case SST_COUNT:
4889 secfile_insert_str(file, "Unknown setting type",
4890 "%s.set%d.value", section, set_count);
4891 if (gamestart) {
4892 secfile_insert_str(file, "Unknown setting type",
4893 "%s.set%d.gamestart", section, set_count);
4894 }
4895 break;
4896 }
4897 if (gamestart) {
4899 "%s.set%d.gamesetdef", section, set_count);
4900 }
4901 set_count++;
4902 }
4904
4905 secfile_insert_int(file, set_count, "%s.set_count", section);
4907 "%s.gamestart_valid", section);
4908}
4909
4910/************************************************************************/
4913void settings_game_load(struct section_file *file, const char *section)
4914{
4915 const char *name;
4916 char reject_msg[256], buf[256];
4917 int i, set_count;
4918 int oldcitymindist = game.info.citymindist; /* backwards compat, see below */
4919
4920 /* Compatibility with savegames created with older versions is usually
4921 * handled as conversions in savecompat.c compat_load_<version>() */
4922
4923 if (!secfile_lookup_int(file, &set_count, "%s.set_count", section)) {
4924 /* Old savegames and scenarios doesn't contain this, not an error. */
4925 log_verbose("Can't read the number of settings in the save file.");
4926 return;
4927 }
4928
4929 /* Check if the saved settings are valid settings from game start. */
4931 = secfile_lookup_bool_default(file, FALSE, "%s.gamestart_valid",
4932 section);
4933
4934 for (i = 0; i < set_count; i++) {
4935 name = secfile_lookup_str(file, "%s.set%d.name", section, i);
4936
4938 struct sf_cb_data info = { pset, FALSE };
4939
4940 if (fc_strcasecmp(setting_name(pset), name) != 0) {
4941 continue;
4942 }
4943
4944 /* Load the current value of the setting. */
4945 switch (pset->stype) {
4946 case SST_BOOL:
4947 {
4948 bool val;
4949
4950 if (!secfile_lookup_bool(file, &val, "%s.set%d.value", section,
4951 i)) {
4952 log_verbose("Option '%s' not defined in the savegame: %s", name,
4953 secfile_error());
4954 } else {
4955 pset->setdef = SETDEF_CHANGED;
4956
4957 if (val != *pset->boolean.pvalue) {
4959 sizeof(reject_msg))
4960 && (NULL == pset->boolean.validate
4961 || pset->boolean.validate(val, NULL, reject_msg,
4962 sizeof(reject_msg)))) {
4963 *pset->boolean.pvalue = val;
4964 log_normal(_("Savegame: '%s' has been set to %s."),
4966 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4967 } else {
4968 log_error("Savegame: error restoring '%s' . (%s)",
4970 }
4971 } else {
4972 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
4974 }
4975 }
4976 }
4977 break;
4978
4979 case SST_INT:
4980 {
4981 int val;
4982
4983 if (!secfile_lookup_int(file, &val, "%s.set%d.value", section, i)) {
4984 log_verbose("Option '%s' not defined in the savegame: %s", name,
4985 secfile_error());
4986 } else {
4987 pset->setdef = SETDEF_CHANGED;
4988
4989 if (val != *pset->integer.pvalue) {
4991 sizeof(reject_msg))
4992 && (NULL == pset->integer.validate
4993 || pset->integer.validate(val, NULL, reject_msg,
4994 sizeof(reject_msg)))) {
4995 *pset->integer.pvalue = val;
4996 log_normal(_("Savegame: '%s' has been set to %s."),
4998 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4999 } else {
5000 log_error("Savegame: error restoring '%s' . (%s)",
5002 }
5003 } else {
5004 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
5006 }
5007 }
5008 }
5009 break;
5010
5011 case SST_STRING:
5012 {
5013 const char *val = secfile_lookup_str(file, "%s.set%d.value",
5014 section, i);
5015
5016 if (NULL == val) {
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 (0 != strcmp(val, pset->string.value)) {
5024 sizeof(reject_msg))) {
5025 log_normal(_("Savegame: '%s' has been set to %s."),
5027 setting_value_name(pset, TRUE, buf, sizeof(buf)));
5028 } else {
5029 log_error("Savegame: error restoring '%s' . (%s)",
5031 }
5032 } else {
5033 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
5035 }
5036 }
5037 }
5038 break;
5039
5040 case SST_ENUM:
5041 {
5042 int val;
5043
5044 if (!secfile_lookup_enum_data(file, &val, FALSE,
5046 "%s.set%d.value", section, i)) {
5047 log_verbose("Option '%s' not defined in the savegame: %s", name,
5048 secfile_error());
5049 } else {
5050 pset->setdef = SETDEF_CHANGED;
5051
5052 if (val != read_enum_value(pset)) {
5054 sizeof(reject_msg))
5055 && (NULL == pset->enumerator.validate
5056 || pset->enumerator.validate(val, NULL, reject_msg,
5057 sizeof(reject_msg)))) {
5058 set_enum_value(pset, val);
5059 log_normal(_("Savegame: '%s' has been set to %s."),
5061 setting_value_name(pset, TRUE, buf, sizeof(buf)));
5062 } else {
5063 log_error("Savegame: error restoring '%s' . (%s)",
5065 }
5066 } else {
5067 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
5069 }
5070 }
5071 }
5072 break;
5073
5074 case SST_BITWISE:
5075 {
5076 int val;
5077
5078 if (!secfile_lookup_enum_data(file, &val, TRUE,
5080 "%s.set%d.value", section, i)) {
5081 log_verbose("Option '%s' not defined in the savegame: %s", name,
5082 secfile_error());
5083 } else {
5084 pset->setdef = SETDEF_CHANGED;
5085
5086 if (val != *pset->bitwise.pvalue) {
5088 sizeof(reject_msg))
5089 && (NULL == pset->bitwise.validate
5090 || pset->bitwise.validate(val, NULL, reject_msg,
5091 sizeof(reject_msg)))) {
5092 *pset->bitwise.pvalue = val;
5093 log_normal(_("Savegame: '%s' has been set to %s."),
5095 setting_value_name(pset, TRUE, buf, sizeof(buf)));
5096 } else {
5097 log_error("Savegame: error restoring '%s' . (%s)",
5099 }
5100 } else {
5101 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
5103 }
5104 }
5105 }
5106 break;
5107
5108 case SST_COUNT:
5109 fc_assert(pset->stype != SST_COUNT);
5110 break;
5111 }
5112
5114 const char *sdname;
5115
5116 /* Load the value of the setting at the start of the game. */
5117 switch (pset->stype) {
5118 case SST_BOOL:
5119 pset->boolean.game_value =
5120 secfile_lookup_bool_default(file, *pset->boolean.pvalue,
5121 "%s.set%d.gamestart", section, i);
5122 break;
5123
5124 case SST_INT:
5125 pset->integer.game_value =
5126 secfile_lookup_int_default(file, *pset->integer.pvalue,
5127 "%s.set%d.gamestart", section, i);
5128 break;
5129
5130 case SST_STRING:
5131 fc_strlcpy(pset->string.game_value,
5132 secfile_lookup_str_default(file, pset->string.value,
5133 "%s.set%d.gamestart",
5134 section, i),
5135 pset->string.value_size);
5136 break;
5137
5138 case SST_ENUM:
5139 pset->enumerator.game_value =
5142 &info, "%s.set%d.gamestart", section, i);
5143 break;
5144
5145 case SST_BITWISE:
5146 pset->bitwise.game_value =
5148 *pset->bitwise.pvalue, TRUE, setting_bitwise_secfile_str,
5149 &info, "%s.set%d.gamestart", section, i);
5150 break;
5151
5152 case SST_COUNT:
5153 fc_assert(pset->stype != SST_COUNT);
5154 break;
5155 }
5156
5157 sdname
5160 "%s.set%d.gamesetdef", section, i);
5163
5164 if (!setting_default_level_is_valid(pset->game_setdef)) {
5165 log_error("Setting %s has invalid gamesetdef value %s",
5167 pset->game_setdef = SETDEF_CHANGED;
5168 }
5169 } else {
5170 pset->game_setdef = SETDEF_CHANGED;
5171 }
5173 }
5174
5175 /* Backwards compatibility for pre-2.4 savegames: citymindist=0 used to mean
5176 * take from ruleset min_dist_bw_cities, but that no longer exists.
5177 * This is here rather than in savegame2.c compat functions, as we need
5178 * to have loaded the relevant ruleset to know what to set it to (the
5179 * ruleset and any 'citymindist' setting it contains will have been loaded
5180 * before this function was called). */
5181 if (game.info.citymindist == 0) {
5183 }
5184
5186 /* Have to do this at the end due to dependencies ('aifill' and
5187 * 'maxplayer'). */
5190}
5191
5192/************************************************************************/
5196{
5198 log_debug("No saved settings from the game start available.");
5199 return FALSE;
5200 }
5201
5205
5206 return TRUE;
5207}
5208
5209/************************************************************************/
5228
5229/************************************************************************/
5241
5242/************************************************************************/
5247{
5248 /* Nothing at the moment. */
5249}
5250
5251/************************************************************************/
5262
5263/************************************************************************/
5267{
5268 return SETTINGS_NUM;
5269}
5270
5271/************************************************************************/
5275void send_server_setting(struct conn_list *dest, const struct setting *pset)
5276{
5277 if (!dest) {
5278 dest = game.est_connections;
5279 }
5280
5281#define PACKET_COMMON_INIT(packet, pset, pconn) \
5282 memset(&packet, 0, sizeof(packet)); \
5283 packet.id = setting_number(pset); \
5284 packet.is_visible = setting_is_visible(pset, pconn); \
5285 packet.is_changeable = setting_is_changeable(pset, pconn, NULL, 0); \
5286 packet.initial_setting = game.info.is_new_game; \
5287 packet.setdef = setting_get_setdef(pset);
5288
5289 switch (setting_type(pset)) {
5290 case SST_BOOL:
5291 {
5292 struct packet_server_setting_bool packet;
5293
5294 conn_list_iterate(dest, pconn) {
5295 PACKET_COMMON_INIT(packet, pset, pconn);
5296 if (packet.is_visible) {
5297 packet.val = *pset->boolean.pvalue;
5298 packet.default_val = pset->boolean.default_value;
5299 }
5302 }
5303 break;
5304 case SST_INT:
5305 {
5306 struct packet_server_setting_int packet;
5307
5308 conn_list_iterate(dest, pconn) {
5309 PACKET_COMMON_INIT(packet, pset, pconn);
5310 if (packet.is_visible) {
5311 packet.val = *pset->integer.pvalue;
5312 packet.default_val = pset->integer.default_value;
5313 packet.min_val = pset->integer.min_value;
5314 packet.max_val = pset->integer.max_value;
5315 }
5318 }
5319 break;
5320 case SST_STRING:
5321 {
5322 struct packet_server_setting_str packet;
5323
5324 conn_list_iterate(dest, pconn) {
5325 PACKET_COMMON_INIT(packet, pset, pconn);
5326 if (packet.is_visible) {
5327 sz_strlcpy(packet.val, pset->string.value);
5328 sz_strlcpy(packet.default_val, pset->string.default_value);
5329 }
5332 }
5333 break;
5334 case SST_ENUM:
5335 {
5336 struct packet_server_setting_enum packet;
5337 const struct sset_val_name *val_name;
5338 int i;
5339
5340 conn_list_iterate(dest, pconn) {
5341 PACKET_COMMON_INIT(packet, pset, pconn);
5342 if (packet.is_visible) {
5343 packet.val = read_enum_value(pset);
5344 packet.default_val = pset->enumerator.default_value;
5345 for (i = 0; (val_name = pset->enumerator.name(i)); i++) {
5346 sz_strlcpy(packet.support_names[i], val_name->support);
5347 /* Send untranslated string */
5348 sz_strlcpy(packet.pretty_names[i], val_name->pretty);
5349 }
5350 packet.values_num = i;
5351 fc_assert(i <= ARRAY_SIZE(packet.support_names));
5352 fc_assert(i <= ARRAY_SIZE(packet.pretty_names));
5353 }
5356 }
5357 break;
5358 case SST_BITWISE:
5359 {
5360 struct packet_server_setting_bitwise packet;
5361 const struct sset_val_name *val_name;
5362 int i;
5363
5364 conn_list_iterate(dest, pconn) {
5365 PACKET_COMMON_INIT(packet, pset, pconn);
5366 if (packet.is_visible) {
5367 packet.val = *pset->bitwise.pvalue;
5368 packet.default_val = pset->bitwise.default_value;
5369 for (i = 0; (val_name = pset->bitwise.name(i)); i++) {
5370 sz_strlcpy(packet.support_names[i], val_name->support);
5371 /* Send untranslated string */
5372 sz_strlcpy(packet.pretty_names[i], val_name->pretty);
5373 }
5374 packet.bits_num = i;
5375 fc_assert(i <= ARRAY_SIZE(packet.support_names));
5376 fc_assert(i <= ARRAY_SIZE(packet.pretty_names));
5377 }
5380 }
5381 break;
5382
5383 case SST_COUNT:
5385 break;
5386 }
5387
5388#undef PACKET_INIT
5389}
5390
5391/************************************************************************/
5400
5401/************************************************************************/
5407 enum cmdlevel old_level,
5408 enum cmdlevel new_level)
5409{
5410 enum cmdlevel min_level;
5411 enum cmdlevel max_level;
5412
5413 if (old_level == new_level) {
5414 return;
5415 }
5416
5417 if (old_level < new_level) {
5420 } else {
5423 }
5424
5426 if ((pset->access_level_read >= min_level
5427 && pset->access_level_read <= max_level)
5428 || (pset->access_level_write >= min_level
5429 && pset->access_level_write <= max_level)) {
5431 }
5433}
5434
5435/************************************************************************/
5439{
5440 struct packet_server_setting_control control;
5442 int i;
5443
5444 control.settings_num = SETTINGS_NUM;
5445
5446 /* Fill in the category strings. */
5449 for (i = 0; i < SSET_NUM_CATEGORIES; i++) {
5450 /* Send untranslated name */
5452 }
5453
5454 /* Send off the control packet. */
5456
5457 pconn->server.settings_sent = TRUE;
5458
5459 /* Send the constant and common part of the settings. */
5463 /* Send untranslated strings to client */
5466 setting.category = pset->scategory;
5467
5470}
5471
5472/************************************************************************/
5475static void settings_list_init(void)
5476{
5477 struct setting *pset;
5478 int i;
5479
5481
5482 /* Do it for all values of enum sset_level. */
5483 for (i = 0; i < OLEVELS_NUM; i++) {
5485 }
5486
5487 for (i = 0; (pset = setting_by_number(i)); i++) {
5488 /* Add the setting to the list of all settings. */
5490
5491 switch (setting_level(pset)) {
5492 case SSET_NONE:
5493 /* No setting should be in this level. */
5495 "No setting level defined for '%s'.", setting_name(pset));
5496 break;
5497 case SSET_ALL:
5498 /* Done above - list of all settings. */
5499 break;
5500 case SSET_VITAL:
5502 break;
5503 case SSET_SITUATIONAL:
5505 break;
5506 case SSET_RARE:
5508 break;
5509 case SSET_CHANGED:
5510 case SSET_LOCKED:
5511 /* This is done in settings_list_update. */
5512 break;
5513 case OLEVELS_NUM:
5514 /* No setting should be in this level. */
5516 "Invalid setting level for '%s' (%s).",
5518 break;
5519 }
5520 }
5521
5522 /* Sort the lists. */
5523 for (i = 0; i < OLEVELS_NUM; i++) {
5525 }
5526
5527 setting_sorted.init = TRUE;
5528}
5529
5530/************************************************************************/
5534{
5535 struct setting *pset;
5536 int i;
5537
5539
5540 /* Clear the lists for changed and locked values. */
5543
5544 /* Refill them. */
5545 for (i = 0; (pset = setting_by_number(i)); i++) {
5548 }
5549 if (setting_locked(pset)) {
5551 }
5552 }
5553
5554 /* Sort them. */
5557}
5558
5559/************************************************************************/
5562int settings_list_cmp(const struct setting *const *ppset1,
5563 const struct setting *const *ppset2)
5564{
5565 const struct setting *pset1 = *ppset1;
5566 const struct setting *pset2 = *ppset2;
5567
5569}
5570
5571/************************************************************************/
5583
5584/************************************************************************/
5587static void settings_list_free(void)
5588{
5589 int i;
5590
5592
5593 /* Free the lists. */
5594 for (i = 0; i < OLEVELS_NUM; i++) {
5596 }
5597
5598 setting_sorted.init = FALSE;
5599}
5600
5601/************************************************************************/
5605{
5606 pset->setdef = SETDEF_CHANGED;
5607}
5608
5609/************************************************************************/
5613{
5614 return pset->setdef;
5615}
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:273
void astr_free(struct astring *astr)
Definition astring.c:148
const char * astr_build_and_list(struct astring *astr, const char *const *items, size_t number)
Definition astring.c:351
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:86
char * incite_cost
Definition comments.c:76
#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:752
@ TDM_EVEN
Definition fc_types.h:753
@ DIPLO_NO_MIXED
Definition fc_types.h:762
@ DIPLO_FOR_TEAMS
Definition fc_types.h:763
@ DIPLO_NO_AIS
Definition fc_types.h:761
@ DIPLO_FOR_HUMANS
Definition fc_types.h:759
@ DIPLO_FOR_ALL
Definition fc_types.h:758
@ DIPLO_FOR_AIS
Definition fc_types.h:760
@ DIPLO_DISABLED
Definition fc_types.h:764
@ REVOLEN_RANDOM
Definition fc_types.h:993
@ REVOLEN_RANDQUICK
Definition fc_types.h:995
@ REVOLEN_FIXED
Definition fc_types.h:992
@ REVOLEN_QUICKENING
Definition fc_types.h:994
int Unit_Class_id
Definition fc_types.h:275
@ HB_ALLIANCE
Definition fc_types.h:1001
@ HB_DISABLED
Definition fc_types.h:999
@ HB_NATIONAL
Definition fc_types.h:1000
@ VC_SPACERACE
Definition fc_types.h:979
@ VC_CULTURE
Definition fc_types.h:981
@ VC_ALLIED
Definition fc_types.h:980
@ VC_WORLDPEACE
Definition fc_types.h:982
@ BORDERS_ENABLED
Definition fc_types.h:746
@ BORDERS_DISABLED
Definition fc_types.h:745
@ BORDERS_SEE_INSIDE
Definition fc_types.h:747
@ BORDERS_EXPAND
Definition fc_types.h:748
#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:61
struct world wld
Definition game.c:62
int generate_save_name(const char *format, char *buf, int buflen, const char *reason)
Definition game.c:796
#define GAME_MIN_TOP_CITIES_COUNT
Definition game.h:707
#define GAME_DEFAULT_TECHPENALTY
Definition game.h:559
#define GAME_MAX_RAPTUREDELAY
Definition game.h:511
#define GAME_DEFAULT_START_CITY
Definition game.h:388
#define GAME_DEFAULT_SKILL_LEVEL
Definition game.h:702
#define GAME_DEFAULT_KILLSTACK
Definition game.h:552
@ 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:383
#define GAME_MAX_DIPLCHANCE
Definition game.h:470
#define GAME_MAX_SCIENCEBOX
Definition game.h:428
#define GAME_DEFAULT_LUA_TIMEOUT
Definition game.h:759
#define GAME_MAX_EVENT_CACHE_MAX_SIZE
Definition game.h:719
#define GAME_DEFAULT_REVOLENTYPE
Definition game.h:743
#define GAME_DEFAULT_AUTO_AI_TOGGLE
Definition game.h:598
#define GAME_MIN_RAZECHANCE
Definition game.h:575
#define GAME_MIN_GLOBAL_WARMING_PERCENT
Definition game.h:453
#define GAME_DEFAULT_CARAVAN_BONUS_STYLE
Definition game.h:658
#define GAME_MIN_SEED
Definition game.h:376
#define GAME_MAX_TECHLOSSFG
Definition game.h:482
#define GAME_DEFAULT_TCPTIMEOUT
Definition game.h:624
#define GAME_MAX_INFRA
Definition game.h:385
#define GAME_DEFAULT_EVENT_CACHE_INFO
Definition game.h:723
#define GAME_DEFAULT_MGR_FOODNEEDED
Definition game.h:531
#define GAME_DEFAULT_TECHLOST_DONOR
Definition game.h:567
#define GAME_DEFAULT_ALLOWED_CITY_NAMES
Definition game.h:739
#define GAME_MIN_TRADEWORLDRELPCT
Definition game.h:647
#define GAME_DEFAULT_SCORELOG
Definition game.h:580
#define GAME_MAX_KILLUNHOMED
Definition game.h:557
#define GAME_MIN_TECHLOST_RECV
Definition game.h:564
#define GAME_MIN_FREECOST
Definition game.h:473
#define GAME_MAX_CONTACTTURNS
Definition game.h:505
#define GAME_MAX_TECHLOST_RECV
Definition game.h:565
#define GAME_DEFAULT_OCCUPYCHANCE
Definition game.h:672
#define GAME_DEFAULT_USER_META_MESSAGE
Definition game.h:700
#define GAME_MAX_FOODBOX
Definition game.h:420
#define GAME_DEFAULT_GLOBAL_WARMING_PERCENT
Definition game.h:452
#define GAME_DEFAULT_TRADING_TECH
Definition game.h:654
#define GAME_MIN_SCIENCEBOX
Definition game.h:427
#define GAME_MAX_PINGTIMEOUT
Definition game.h:638
#define GAME_MAX_SAVEFREQUENCY
Definition game.h:690
#define GAME_MIN_REVOLUTION_LENGTH
Definition game.h:745
#define GAME_MAX_MGR_TURNINTERVAL
Definition game.h:529
#define GAME_DEFAULT_SAVETURNS
Definition game.h:685
#define GAME_DEFAULT_IPHIDE
Definition game.h:640
#define GAME_DEFAULT_BORDERS
Definition game.h:462
#define GAME_DEFAULT_AIRLIFTINGSTYLE
Definition game.h:750
#define GAME_DEFAULT_SPACESHIP_TRAVEL_PCT
Definition game.h:592
#define GAME_MAX_CONQUERCOST
Definition game.h:478
#define GAME_MAX_TOP_CITIES_COUNT
Definition game.h:708
#define GAME_DEFAULT_TOP_CITIES_COUNT
Definition game.h:706
#define GAME_MAX_AQUEDUCTLOSS
Definition game.h:550
#define GAME_DEFAULT_KILLUNHOMED
Definition game.h:555
#define GAME_DEFAULT_SCIENCEBOX
Definition game.h:426
#define GAME_MIN_DIPLGOLDCOST
Definition game.h:435
#define GAME_DEFAULT_MGR_WORLDCHANCE
Definition game.h:544
#define GAME_MIN_PINGTIME
Definition game.h:633
#define GAME_DEFAULT_ONSETBARBARIAN
Definition game.h:668
#define GAME_MIN_ONSETBARBARIAN
Definition game.h:669
#define GAME_MAX_TECHLOSSREST
Definition game.h:486
#define GAME_DEFAULT_KILLCITIZEN
Definition game.h:553
#define GAME_MIN_INCITE_GOLD_LOSS_CHANCE
Definition game.h:439
#define GAME_MIN_MGR_NATIONCHANCE
Definition game.h:541
#define GAME_MAX_COMPRESS_LEVEL
Definition game.h:727
#define GAME_DEFAULT_NATIONSET
Definition game.h:416
#define GAME_DEFAULT_SHIELDBOX
Definition game.h:422
#define GAME_MIN_NOTRADESIZE
Definition game.h:643
#define GAME_MIN_GOLD
Definition game.h:380
#define GAME_MAX_OCCUPYCHANCE
Definition game.h:674
#define GAME_MIN_SPACESHIP_TRAVEL_PCT
Definition game.h:593
#define GAME_DEFAULT_MAXCONNECTIONSPERHOST
Definition game.h:609
#define GAME_DEFAULT_INCITE_GOLD_CAPT_CHANCE
Definition game.h:442
#define GAME_DEFAULT_DEMOGRAPHY
Definition game.h:710
#define GAME_MIN_MAXCONNECTIONSPERHOST
Definition game.h:610
#define GAME_DEFAULT_FULLTRADESIZE
Definition game.h:650
#define GAME_MAX_DISPERSION
Definition game.h:392
#define GAME_MIN_TECHLOST_DONOR
Definition game.h:568
#define GAME_DEFAULT_RAPTUREDELAY
Definition game.h:509
#define GAME_MIN_MGR_TURNINTERVAL
Definition game.h:528
#define GAME_DEFAULT_REVOLUTION_LENGTH
Definition game.h:744
#define GAME_DEFAULT_MGR_TURNINTERVAL
Definition game.h:527
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:387
#define GAME_MAX_TCPTIMEOUT
Definition game.h:626
#define GAME_DEFAULT_ALLOW_TAKE
Definition game.h:711
#define GAME_DEFAULT_THREADED_SAVE
Definition game.h:698
#define GAME_MIN_INFRA
Definition game.h:384
#define GAME_MAX_TRADEWORLDRELPCT
Definition game.h:648
#define GAME_DEFAULT_MIN_PLAYERS
Definition game.h:404
#define GAME_MIN_CONQUERCOST
Definition game.h:477
#define GAME_MAX_MGR_DISTANCE
Definition game.h:538
#define GAME_MIN_TECHLOSSREST
Definition game.h:485
#define GAME_DEFAULT_AUTOATTACK
Definition game.h:676
#define GAME_DEFAULT_SAVEFREQUENCY
Definition game.h:688
#define GAME_MAX_GOLD
Definition game.h:381
#define GAME_DEFAULT_REVEALMAP
Definition game.h:578
#define GAME_DEFAULT_SCOREFILE
Definition game.h:582
#define GAME_MAX_FIRST_TIMEOUT
Definition game.h:616
#define GAME_MIN_MGR_DISTANCE
Definition game.h:537
#define GAME_MIN_DISPERSION
Definition game.h:391
#define GAME_DEFAULT_TEAM_POOLED_RESEARCH
Definition game.h:571
#define GAME_DEFAULT_SEED
Definition game.h:375
#define GAME_DEFAULT_HOMECAUGHTUNITS
Definition game.h:521
#define GAME_MAX_GLOBAL_WARMING_PERCENT
Definition game.h:454
#define GAME_MAX_MAXCONNECTIONSPERHOST
Definition game.h:611
#define GAME_DEFAULT_NETWAIT
Definition game.h:628
#define GAME_MIN_PINGTIMEOUT
Definition game.h:637
#define GAME_MIN_TECHPENALTY
Definition game.h:560
#define GAME_MIN_CONTACTTURNS
Definition game.h:504
#define GAME_MAX_INCITE_GOLD_LOSS_CHANCE
Definition game.h:440
#define GAME_DEFAULT_KICK_TIME
Definition game.h:755
#define GAME_DEFAULT_PLRCOLORMODE
Definition game.h:741
#define GAME_MAX_CITYMINDIST
Definition game.h:494
#define GAME_DEFAULT_DIPLCHANCE
Definition game.h:468
#define GAME_MAX_NUCLEAR_WINTER_PERCENT
Definition game.h:460
#define GAME_MIN_LUA_TIMEOUT
Definition game.h:760
#define GAME_MIN_END_TURN
Definition game.h:401
#define GAME_DEFAULT_UNRPROTECTS
Definition game.h:501
#define GAME_MIN_MGR_WORLDCHANCE
Definition game.h:545
#define GAME_DEFAULT_RAZECHANCE
Definition game.h:574
#define GAME_MIN_SHIELDBOX
Definition game.h:423
#define GAME_MIN_FIRST_TIMEOUT
Definition game.h:615
#define GAME_MAX_RAZECHANCE
Definition game.h:576
#define GAME_MIN_TIMEOUT
Definition game.h:613
#define GAME_MAX_ONSETBARBARIAN
Definition game.h:670
#define GAME_MIN_FOODBOX
Definition game.h:419
#define GAME_DEFAULT_INCITE_GOLD_LOSS_CHANCE
Definition game.h:438
#define GAME_MAX_MAX_PLAYERS
Definition game.h:410
#define GAME_DEFAULT_TRADING_CITY
Definition game.h:656
#define GAME_DEFAULT_FOODBOX
Definition game.h:418
#define GAME_DEFAULT_COMPRESS_TYPE
Definition game.h:736
#define GAME_MAX_TIMEOUT
Definition game.h:614
#define GAME_MAX_SPACESHIP_TRAVEL_PCT
Definition game.h:594
#define GAME_DEFAULT_PINGTIMEOUT
Definition game.h:636
#define GAME_DEFAULT_TRADE_REVENUE_STYLE
Definition game.h:664
#define GAME_DEFAULT_SAVEPALACE
Definition game.h:519
#define GAME_MIN_EVENT_CACHE_TURNS
Definition game.h:714
#define GAME_DEFAULT_GLOBAL_WARMING
Definition game.h:450
#define GAME_MAX_SEED
Definition game.h:377
#define GAME_MAX_DIPLGOLDCOST
Definition game.h:436
#define GAME_DEFAULT_TECHLOST_RECV
Definition game.h:563
#define GAME_DEFAULT_NOTRADESIZE
Definition game.h:642
#define GAME_DEFAULT_COMPRESS_LEVEL
Definition game.h:725
#define GAME_MAX_TECHLOST_DONOR
Definition game.h:569
#define GAME_MIN_SAVETURNS
Definition game.h:686
#define GAME_MAX_UNITWAITTIME
Definition game.h:619
#define GAME_DEFAULT_FIRST_TIMEOUT
Definition game.h:601
#define GAME_DEFAULT_NUCLEAR_WINTER_PERCENT
Definition game.h:458
#define GAME_MIN_CIVILWARSIZE
Definition game.h:497
#define GAME_DEFAULT_TRADING_GOLD
Definition game.h:655
#define GAME_MIN_TECHLEAK
Definition game.h:489
#define GAME_DEFAULT_TRAIT_DIST_MODE
Definition game.h:517
#define GAME_DEFAULT_NUCLEAR_WINTER
Definition game.h:456
#define GAME_MIN_DISASTERS
Definition game.h:514
#define GAME_MIN_OCCUPYCHANCE
Definition game.h:673
#define GAME_DEFAULT_FREECOST
Definition game.h:472
#define GAME_MIN_KICK_TIME
Definition game.h:756
#define GAME_DEFAULT_MAX_PLAYERS
Definition game.h:408
#define GAME_DEFAULT_CITYMINDIST
Definition game.h:492
#define GAME_MIN_NUCLEAR_WINTER_PERCENT
Definition game.h:459
#define GAME_DEFAULT_PHASE_MODE
Definition game.h:622
#define GAME_DEFAULT_AIFILL
Definition game.h:412
#define GAME_DEFAULT_TRADEWORLDRELPCT
Definition game.h:646
#define GAME_DEFAULT_MULTIRESEARCH
Definition game.h:572
#define GAME_DEFAULT_CONQUERCOST
Definition game.h:476
#define GAME_MAX_TECHPENALTY
Definition game.h:561
#define GAME_DEFAULT_TIMEOUT
Definition game.h:600
#define GAME_MAX_DISASTERS
Definition game.h:515
#define GAME_MIN_INCITE_GOLD_CAPT_CHANCE
Definition game.h:443
#define GAME_MIN_TECHLOSSFG
Definition game.h:481
#define GAME_MAX_END_TURN
Definition game.h:402
#define GAME_MIN_COMPRESS_LEVEL
Definition game.h:726
#define GAME_DEFAULT_TECHLOSSREST
Definition game.h:484
#define GAME_MIN_KILLUNHOMED
Definition game.h:556
#define GAME_MAX_NOTRADESIZE
Definition game.h:644
#define GAME_DEFAULT_CONTACTTURNS
Definition game.h:503
#define GAME_DEFAULT_SCORELOGLEVEL
Definition game.h:581
#define GAME_DEFAULT_TECHLOSSFG
Definition game.h:480
#define GAME_DEFAULT_TECHLEVEL
Definition game.h:394
#define GAME_MIN_MAX_PLAYERS
Definition game.h:409
#define GAME_DEFAULT_DISASTERS
Definition game.h:513
#define GAME_MAX_FREECOST
Definition game.h:474
#define GAME_MAX_REVOLUTION_LENGTH
Definition game.h:746
#define GAME_MAX_AIFILL
Definition game.h:414
#define GAME_DEFAULT_GOLD
Definition game.h:379
#define GAME_MIN_AQUEDUCTLOSS
Definition game.h:549
#define GAME_MIN_DIPLBULBCOST
Definition game.h:431
#define GAME_DEFAULT_MIGRATION
Definition game.h:525
@ 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:718
#define GAME_MIN_CITYMINDIST
Definition game.h:493
#define GAME_MIN_AIFILL
Definition game.h:413
#define GAME_MIN_SAVEFREQUENCY
Definition game.h:689
#define GAME_DEFAULT_NATURALCITYNAMES
Definition game.h:523
#define GAME_DEFAULT_EVENT_CACHE_TURNS
Definition game.h:713
#define GAME_DEFAULT_VICTORY_CONDITIONS
Definition game.h:589
#define GAME_MIN_UNITWAITTIME
Definition game.h:618
#define GAME_DEFAULT_FOGGEDBORDERS
Definition game.h:448
#define GAME_DEFAULT_UNITWAITTIME
Definition game.h:620
#define GAME_DEFAULT_TIMEOUTADDEMOVE
Definition game.h:606
#define GAME_DEFAULT_DISPERSION
Definition game.h:390
#define GAME_MAX_CIVILWARSIZE
Definition game.h:498
#define GAME_DEFAULT_AUTOSAVES
Definition game.h:695
#define GAME_DEFAULT_EVENT_CACHE_CHAT
Definition game.h:721
#define GAME_DEFAULT_DIPLOMACY
Definition game.h:466
#define GAME_DEFAULT_MGR_DISTANCE
Definition game.h:536
#define GAME_MIN_DIPLCHANCE
Definition game.h:469
#define GAME_DEFAULT_TURNBLOCK
Definition game.h:596
#define GAME_MAX_SAVETURNS
Definition game.h:687
#define GAME_MAX_PINGTIME
Definition game.h:634
#define GAME_DEFAULT_PINGTIME
Definition game.h:632
@ 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:548
#define GAME_DEFAULT_TRADEMINDIST
Definition game.h:660
#define GAME_DEFAULT_BARBARIANRATE
Definition game.h:666
#define GAME_DEFAULT_HAPPYBORDERS
Definition game.h:464
#define GAME_MAX_FULLTRADESIZE
Definition game.h:652
#define GAME_MAX_TECHLEAK
Definition game.h:490
#define GAME_MAX_MGR_NATIONCHANCE
Definition game.h:542
#define GAME_MAX_TECHLEVEL
Definition game.h:396
#define GAME_MAX_MGR_WORLDCHANCE
Definition game.h:546
#define GAME_MIN_MIN_PLAYERS
Definition game.h:405
#define GAME_MAX_TRADEMINDIST
Definition game.h:662
#define GAME_DEFAULT_END_TURN
Definition game.h:400
#define GAME_MAX_EVENT_CACHE_TURNS
Definition game.h:715
#define GAME_MAX_DIPLBULBCOST
Definition game.h:432
#define GAME_DEFAULT_DIPLGOLDCOST
Definition game.h:434
#define GAME_MAX_SHIELDBOX
Definition game.h:424
#define GAME_DEFAULT_TECHLEAK
Definition game.h:488
#define GAME_MAX_MIN_PLAYERS
Definition game.h:406
#define GAME_MAX_NETWAIT
Definition game.h:630
#define GAME_MIN_TCPTIMEOUT
Definition game.h:625
#define GAME_DEFAULT_END_SPACESHIP
Definition game.h:590
#define GAME_MIN_RAPTUREDELAY
Definition game.h:510
#define GAME_MIN_NETWAIT
Definition game.h:629
#define GAME_DEFAULT_EVENT_CACHE_MAX_SIZE
Definition game.h:717
#define GAME_DEFAULT_SAVE_NAME
Definition game.h:684
#define GAME_MAX_LUA_TIMEOUT
Definition game.h:761
#define GAME_MIN_TRADEMINDIST
Definition game.h:661
#define GAME_DEFAULT_MGR_NATIONCHANCE
Definition game.h:540
#define GAME_MIN_TECHLEVEL
Definition game.h:395
#define GAME_MAX_INCITE_GOLD_CAPT_CHANCE
Definition game.h:444
#define GAME_DEFAULT_FOGOFWAR
Definition game.h:446
#define GAME_DEFAULT_PERSISTENTREADY
Definition game.h:751
#define GAME_MIN_FULLTRADESIZE
Definition game.h:651
#define GAME_DEFAULT_DIPLBULBCOST
Definition game.h:430
#define GAME_DEFAULT_RESTRICTINFRA
Definition game.h:500
#define GAME_MAX_KICK_TIME
Definition game.h:757
#define GAME_DEFAULT_CIVILWARSIZE
Definition game.h:496
void send_game_info(struct conn_list *dest)
Definition gamehand.c:910
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:37
@ FZ_PLAIN
Definition ioz.h:38
static enum log_level max_level
Definition log.c:49
#define fc_assert_msg(condition, message,...)
Definition log.h:182
#define fc_assert_ret(condition)
Definition log.h:192
#define log_warn(message,...)
Definition log.h:106
#define log_verbose(message,...)
Definition log.h:110
#define fc_assert(condition)
Definition log.h:177
#define fc_assert_ret_val(condition, val)
Definition log.h:195
#define log_debug(message,...)
Definition log.h:116
#define log_normal(message,...)
Definition log.h:108
#define log_error(message,...)
Definition log.h:104
int map_startpos_count(void)
Definition map.c:2008
bool map_is_empty(void)
Definition map.c:148
#define MAP_MAX_SIZE
Definition map.h:652
#define MAP_MIN_HUTS
Definition map.h:633
#define MAP_MIN_STEEPNESS
Definition map.h:699
#define MAP_MIN_LANDMASS
Definition map.h:691
#define MAP_DEFAULT_SIZE
Definition map.h:650
#define MAP_MAX_LINEAR_SIZE
Definition map.h:668
#define MAP_MAX_TILESPERPLAYER
Definition map.h:664
#define MAP_DEFAULT_HUTS
Definition map.h:632
#define MAP_MAX_FLATPOLES
Definition map.h:720
#define MAP_MIN_TILESPERPLAYER
Definition map.h:663
#define MAP_DEFAULT_LINEAR_SIZE
Definition map.h:667
#define MAP_DEFAULT_STARTPOS
Definition map.h:708
#define MAP_DEFAULT_ANIMALS
Definition map.h:636
#define MAP_MIN_WETNESS
Definition map.h:703
#define MAP_MAX_SEED
Definition map.h:688
#define MAP_DEFAULT_TEAM_PLACEMENT
Definition map.h:726
#define MAP_DEFAULT_TOPO
Definition map.h:682
#define MAP_DEFAULT_SEED
Definition map.h:686
#define MAP_MIN_TEMPERATURE
Definition map.h:723
#define MAP_DEFAULT_MAPSIZE
Definition map.h:640
#define MAP_MIN_LINEAR_SIZE
Definition map.h:669
#define MAP_MAX_STEEPNESS
Definition map.h:700
#define MAP_DEFAULT_LANDMASS
Definition map.h:690
#define MAP_MIN_FLATPOLES
Definition map.h:719
#define MAP_MAX_LANDMASS
Definition map.h:692
#define MAP_MIN_SEED
Definition map.h:687
#define MAP_MAX_ANIMALS
Definition map.h:638
#define MAP_DEFAULT_WRAP
Definition map.h:683
#define MAP_MAX_TEMPERATURE
Definition map.h:724
#define MAP_MAX_LATITUDE_BOUND
Definition map.h:604
#define MAP_MIN_SIZE
Definition map.h:651
#define MAP_MIN_RICHES
Definition map.h:695
#define MAP_DEFAULT_NORTH_LATITUDE
Definition map.h:606
#define MAP_MIN_ANIMALS
Definition map.h:637
#define MAP_DEFAULT_SEPARATE_POLES
Definition map.h:714
#define MAP_DEFAULT_RICHES
Definition map.h:694
#define MAP_DEFAULT_TINYISLES
Definition map.h:710
#define MAP_MIN_LATITUDE_BOUND
Definition map.h:605
#define MAP_DEFAULT_TILESPERPLAYER
Definition map.h:662
#define MAP_DEFAULT_TEMPERATURE
Definition map.h:722
#define MAP_DEFAULT_SOUTH_LATITUDE
Definition map.h:607
#define MAP_MAX_RICHES
Definition map.h:696
#define MAP_DEFAULT_GENERATOR
Definition map.h:706
#define MAP_MAX_HUTS
Definition map.h:634
#define MAP_DEFAULT_FLATPOLES
Definition map.h:718
#define MAP_DEFAULT_WETNESS
Definition map.h:702
#define MAP_MAX_WETNESS
Definition map.h:704
#define MAP_DEFAULT_STEEPNESS
Definition map.h:698
@ 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:542
#define players_iterate(_pplayer)
Definition player.h:537
plrcolor_mode
Definition player.h:52
@ PLRCOL_PLR_RANDOM
Definition player.h:54
@ PLRCOL_PLR_SET
Definition player.h:55
@ PLRCOL_NATION_ORDER
Definition player.h:57
@ PLRCOL_TEAM_ORDER
Definition player.h:56
@ PLRCOL_PLR_ORDER
Definition player.h:53
#define is_human(plr)
Definition player.h:231
void send_nation_availability(struct conn_list *dest, bool nationset_change)
Definition plrhand.c:2647
int normal_player_count(void)
Definition plrhand.c:3209
void server_player_set_color(struct player *pplayer, const struct rgbcolor *prgbcolor)
Definition plrhand.c:1825
void send_player_info_c(struct player *src, struct conn_list *dest)
Definition plrhand.c:1148
void count_playable_nations(void)
Definition plrhand.c:2604
bool nation_is_in_current_set(const struct nation_type *pnation)
Definition plrhand.c:2595
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:1514
bool is_valid_demography(const char *demography, int *error)
Definition report.c:1158
void log_civ_score_init(void)
Definition report.c:1491
bool autolock_settings(void)
Definition rssanity.c:1713
static struct compatibility compat[]
Definition savecompat.c:112
#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:4648
bool setting_int_validate(const struct setting *pset, int val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3763
static void metamessage_action(const struct setting *pset)
Definition settings.c:859
static const struct sset_val_name * phasemode_name(int phasemode)
Definition settings.c:551
void settings_init(bool act)
Definition settings.c:5212
static bool savename_validate(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:889
static const char * setting_bool_to_str(const struct setting *pset, bool value, bool pretty, char *buf, size_t buf_len)
Definition settings.c:3607
#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:1099
void setting_action(const struct setting *pset)
Definition settings.c:4369
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:521
void setting_ruleset_lock_clear(struct setting *pset)
Definition settings.c:4676
void setting_admin_lock_clear(struct setting *pset)
Definition settings.c:4688
#define GEN_BOOL(name, value, sclass, scateg, slevel, al_read, al_write, short_help, extra_help, func_validate, func_action, _default)
Definition settings.c:1412
int setting_int_get(struct setting *pset)
Definition settings.c:3788
static const char * setting_bool_secfile_str(secfile_data_t data, int val)
Definition settings.c:3702
static void nationset_action(const struct setting *pset)
Definition settings.c:718
const char * setting_default_name(const struct setting *pset, bool pretty, char *buf, size_t buf_len)
Definition settings.c:4303
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:4051
struct setting * setting_by_name(const char *name)
Definition settings.c:3309
static const struct sset_val_name * compresstype_name(enum fz_method compresstype)
Definition settings.c:579
void setting_set_to_default(struct setting *pset)
Definition settings.c:4339
static void timeout_action(const struct setting *pset)
Definition settings.c:783
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:4267
void settings_game_load(struct section_file *file, const char *section)
Definition settings.c:4913
const char * setting_extra_help(const struct setting *pset, bool constant)
Definition settings.c:3350
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:3565
const char *(* help_callback_func_t)(const struct setting *pset)
Definition settings.c:89
int setting_number(const struct setting *pset)
Definition settings.c:3324
struct setting * setting_by_number(int id)
Definition settings.c:3301
bool setting_int_set(struct setting *pset, int val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3743
enum sset_category setting_category(const struct setting *pset)
Definition settings.c:3378
static bool aitype_callback(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1357
bool setting_is_visible(const struct setting *pset, struct connection *caller)
Definition settings.c:3506
static bool first_timeout_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1200
static void setting_ruleset_setdef(struct setting *pset)
Definition settings.c:4437
bool setting_locked(const struct setting *pset)
Definition settings.c:4640
bool setting_non_default(const struct setting *pset)
Definition settings.c:4614
static bool wrap_callback(unsigned value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1373
static bool xsize_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1263
static const struct sset_val_name * airliftingstyle_name(int bit)
Definition settings.c:533
enum sset_type setting_type(const struct setting *pset)
Definition settings.c:3362
void settings_free(void)
Definition settings.c:5254
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:4668
static void settings_list_free(void)
Definition settings.c:5587
bool setting_str_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3814
#define GEN_STRING(name, value, sclass, scateg, slevel, al_read, al_write, short_help, extra_help, func_validate, func_action, _default)
Definition settings.c:1432
static const struct sset_val_name * bool_name(int enable)
Definition settings.c:630
bool init
Definition settings.c:189
static const struct sset_val_name * revolentype_name(int revolentype)
Definition settings.c:507
int setting_int_max(const struct setting *pset)
Definition settings.c:3733
enum sset_level setting_level(const struct setting *pset)
Definition settings.c:3370
static struct setting settings[]
Definition settings.c:1474
static void first_timeout_action(const struct setting *pset)
Definition settings.c:800
static bool allowtake_callback(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:999
static void wrap_action(const struct setting *pset)
Definition settings.c:843
static const char * setting_bitwise_to_str(const struct setting *pset, unsigned value, bool pretty, char *buf, size_t buf_len)
Definition settings.c:4107
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:4223
static void topology_action(const struct setting *pset)
Definition settings.c:828
const char * setting_enum_secfile_str(secfile_data_t data, int val)
Definition settings.c:3870
void settings_game_save(struct section_file *file, const char *section)
Definition settings.c:4825
int settings_number(void)
Definition settings.c:5266
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:3834
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:5246
#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:1442
static bool setting_is_free_to_change(const struct setting *pset, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3388
static const char * setting_enum_to_str(const struct setting *pset, int value, bool pretty, char *buf, size_t buf_len)
Definition settings.c:3912
const char * setting_enum_val(const struct setting *pset, int val, bool pretty)
Definition settings.c:3893
struct setting_list * level[OLEVELS_NUM]
Definition settings.c:190
void setting_changed(struct setting *pset)
Definition settings.c:5604
#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:1452
static bool startunits_callback(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1045
static void huts_action(const struct setting *pset)
Definition settings.c:820
static bool nationset_callback(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1141
enum setting_default_level setting_get_setdef(const struct setting *pset)
Definition settings.c:5612
static bool mapsize_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1244
static const char * setting_int_to_str(const struct setting *pset, int value, bool pretty, char *buf, size_t buf_len)
Definition settings.c:3713
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:3628
static bool setting_ruleset_one(struct section_file *file, const char *name, const char *path, bool compat)
Definition settings.c:4445
static bool demography_callback(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:953
static struct @119 setting_sorted
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:4812
bool setting_enum_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:4022
const char * setting_short_help(const struct setting *pset)
Definition settings.c:3341
static const struct sset_val_name * citynames_name(int citynames)
Definition settings.c:478
void send_server_setting_control(struct connection *pconn)
Definition settings.c:5438
static bool plrcol_validate(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1393
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:4088
static bool autosaves_callback(unsigned value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:973
static bool maxplayers_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1114
int setting_int_min(const struct setting *pset)
Definition settings.c:3724
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:3934
static void autotoggle_action(const struct setting *pset)
Definition settings.c:767
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:4244
void setting_ruleset_lock_set(struct setting *pset)
Definition settings.c:4656
static const struct sset_val_name * ailevel_name(enum ai_level lvl)
Definition settings.c:605
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:1421
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:3688
struct setting_list * settings_list_get(enum sset_level level)
Definition settings.c:5575
bool setting_is_changeable(const struct setting *pset, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3460
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:5562
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:4172
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:3520
static void settings_list_init(void)
Definition settings.c:5475
void settings_reset(void)
Definition settings.c:5232
const char * setting_name(const struct setting *pset)
Definition settings.c:3333
static const int SETTINGS_NUM
Definition settings.c:3296
static const char * phasemode_help(const struct setting *pset)
Definition settings.c:648
static bool ysize_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1288
bool settings_game_reset(void)
Definition settings.c:5195
static void scorelog_action(const struct setting *pset)
Definition settings.c:693
static const struct sset_val_name * happyborders_name(int happyborders)
Definition settings.c:447
int setting_bitwise_get(struct setting *pset)
Definition settings.c:4257
static const struct sset_val_name * scoreloglevel_name(enum scorelog_level sl_level)
Definition settings.c:566
static const struct sset_val_name * wrap_name(int wrap_bit)
Definition settings.c:275
void settings_list_update(void)
Definition settings.c:5533
static bool timeout_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1162
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:910
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:3798
void(* action_callback_func_t)(const struct setting *pset)
Definition settings.c:88
#define settings_snprintf(_buf, _buf_len, format,...)
Definition settings.c:206
char * setting_str_get(struct setting *pset)
Definition settings.c:3859
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:4379
bool setting_bool_get(struct setting *pset)
Definition settings.c:3676
static bool set_enum_value(struct setting *pset, int val)
Definition settings.c:3961
static void setting_game_set(struct setting *pset, bool init)
Definition settings.c:4700
static void setting_game_free(struct setting *pset)
Definition settings.c:4740
static bool scorefile_validate(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:936
const char * setting_bitwise_secfile_str(secfile_data_t data, int bit)
Definition settings.c:4065
static void aitype_action(const struct setting *pset)
Definition settings.c:875
static void aifill_action(const struct setting *pset)
Definition settings.c:705
static const struct sset_val_name * trait_dist_name(int trait_dist)
Definition settings.c:420
bool setting_is_visible_at_level(const struct setting *pset, enum cmdlevel plevel)
Definition settings.c:3496
static const struct sset_val_name * plrcol_name(int plrcol)
Definition settings.c:432
bool setting_bool_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3657
void send_server_setting(struct conn_list *dest, const struct setting *pset)
Definition settings.c:5275
static const char * huts_help(const struct setting *pset)
Definition settings.c:666
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:5394
#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:1463
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:751
void send_server_access_level_settings(struct conn_list *dest, enum cmdlevel old_level, enum cmdlevel new_level)
Definition settings.c:5406
static const struct sset_val_name * diplomacy_name(int diplomacy)
Definition settings.c:460
static const struct sset_val_name * barbarians_name(int barbarians)
Definition settings.c:492
static void setting_game_restore(struct setting *pset)
Definition settings.c:4750
int read_enum_value(const struct setting *pset)
Definition settings.c:3995
static const struct sset_val_name * borders_name(int borders)
Definition settings.c:404
static const struct sset_val_name * autosaves_name(int autosaves_bit)
Definition settings.c:388
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:1218
static bool topology_callback(unsigned value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1321
#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:256
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:213
@ M_PRE_EXACT
Definition shared.h:214
@ M_PRE_ONLY
Definition shared.h:215
@ M_PRE_LAST
Definition shared.h:220
@ M_PRE_LONG
Definition shared.h:218
@ M_PRE_AMBIGUOUS
Definition shared.h:216
@ M_PRE_EMPTY
Definition shared.h:217
@ M_PRE_FAIL
Definition shared.h:219
size_t size
Definition specvec.h:72
const char * aifill(int amount)
Definition srv_main.c:2506
bool game_was_started(void)
Definition srv_main.c:354
enum server_states server_state(void)
Definition srv_main.c:338
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:147
int contactturns
Definition game.h:144
enum city_names_mode allowed_city_names
Definition game.h:134
int unitwaittime
Definition game.h:205
bool multiresearch
Definition game.h:170
int incite_gold_capt_chance
Definition game.h:149
char scorefile[MAX_LEN_PATH]
Definition game.h:231
int mgr_worldchance
Definition game.h:169
int kick_time
Definition game.h:160
bool chat
Definition game.h:260
enum barbarians_rate barbarianrate
Definition game.h:140
int dispersion
Definition game.h:150
bool threaded_save
Definition game.h:187
int max_size
Definition game.h:259
int save_compress_level
Definition game.h:188
int tcptimeout
Definition game.h:202
char start_units[MAX_LEN_STARTUNIT]
Definition game.h:196
int save_nturns
Definition game.h:190
int mgr_nationchance
Definition game.h:167
bool fixedlength
Definition game.h:153
int spaceship_travel_pct
Definition game.h:186
int techlost_recv
Definition game.h:201
bool mgr_foodneeded
Definition game.h:166
int diplchance
Definition game.h:145
int netwait
Definition game.h:175
int incite_gold_loss_chance
Definition game.h:148
int end_turn
Definition game.h:151
bool settings_gamestart_valid
Definition game.h:250
enum plrcolor_mode plrcolormode
Definition game.h:135
int onsetbarbarian
Definition game.h:178
char demography[MAX_LEN_DEMOGRAPHY]
Definition game.h:247
struct conn_list * est_connections
Definition game.h:97
struct civ_game::@32::@36::@40 meta_info
struct packet_game_info info
Definition game.h:89
int mgr_turninterval
Definition game.h:168
char user_message[256]
Definition game.h:273
int min_players
Definition game.h:173
unsigned autosaves
Definition game.h:192
struct timer * save_timer
Definition game.h:224
bool endspaceship
Definition game.h:152
enum scorelog_level scoreloglevel
Definition game.h:230
int lua_timeout
Definition game.h:105
bool migration
Definition game.h:171
bool ip_hide
Definition game.h:181
int diplbulbcost
Definition game.h:146
bool natural_city_names
Definition game.h:174
int maxconnectionsperhost
Definition game.h:162
struct packet_scenario_info scenario
Definition game.h:87
int pingtimeout
Definition game.h:180
int occupychance
Definition game.h:177
randseed seed_setting
Definition game.h:233
int killunhomed
Definition game.h:161
int nuclear_winter_percent
Definition game.h:239
int conquercost
Definition game.h:143
unsigned revealmap
Definition game.h:184
int pingtime
Definition game.h:179
int techloss_restore
Definition game.h:199
char default_ai_type_name[256]
Definition game.h:285
int civilwarsize
Definition game.h:142
bool savepalace
Definition game.h:194
int freecost
Definition game.h:155
char nationset[MAX_LEN_NAME]
Definition game.h:164
int aqueductloss
Definition game.h:136
char save_name[MAX_LEN_NAME]
Definition game.h:227
enum fz_method save_compress_type
Definition game.h:189
enum trait_dist_mode trait_dist
Definition game.h:172
bool foggedborders
Definition game.h:154
bool homecaughtunits
Definition game.h:195
struct civ_game::@32::@36::@38 event_cache
struct civ_game::@32::@36 server
struct packet_timeout_info tinfo
Definition game.h:91
char allow_take[MAX_LEN_ALLOW_TAKE]
Definition game.h:248
bool autoattack
Definition game.h:138
int phase_mode_stored
Definition game.h:223
bool start_city
Definition game.h:197
int max_players
Definition game.h:163
int revolution_length
Definition game.h:185
int turns
Definition game.h:258
bool auto_ai_toggle
Definition game.h:137
int save_frequency
Definition game.h:191
int mgr_distance
Definition game.h:165
int global_warming_percent
Definition game.h:237
int techlost_donor
Definition game.h:200
int timeoutaddenemymove
Definition game.h:215
bool scorelog
Definition game.h:229
int techpenalty
Definition game.h:203
int razechance
Definition game.h:183
bool turnblock
Definition game.h:204
int animals
Definition map_types.h:109
int xsize
Definition map_types.h:79
bool tinyisles
Definition map_types.h:113
int ysize
Definition map_types.h:79
int riches
Definition map_types.h:106
int north_latitude
Definition map_types.h:80
enum mapsize_type mapsize
Definition map_types.h:101
int south_latitude
Definition map_types.h:81
enum map_startpos startpos
Definition map_types.h:112
int steepness
Definition map_types.h:118
int wetness
Definition map_types.h:117
int size
Definition map_types.h:102
int tilesperplayer
Definition map_types.h:103
randseed seed_setting
Definition map_types.h:104
int landpercent
Definition map_types.h:110
enum team_placement team_placement
Definition map_types.h:122
int topology_id
Definition map_types.h:72
struct civ_map::@44::@46 server
int flatpoles
Definition map_types.h:115
int huts
Definition map_types.h:107
int wrap_id
Definition map_types.h:73
enum map_generator generator
Definition map_types.h:111
bool separatepoles
Definition map_types.h:114
int temperature
Definition map_types.h:116
int huts_absolute
Definition map_types.h:108
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
struct setting::@120::@126 bitwise
char * game_value
Definition settings.c:151
enum setting_default_level setdef
Definition settings.c:184
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
struct setting::@120::@125 enumerator
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
int *const pvalue
Definition settings.c:138
struct setting::@120::@122 boolean
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
struct setting::@120::@123 integer
struct setting::@120::@124 string
const action_callback_func_t action
Definition settings.c:173
bool ruleset_settable
Definition settings.c:181
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
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:40
char ** vec
struct civ_map map
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:960
size_t fc_strlcpy(char *dest, const char *src, size_t n)
Definition support.c:777
int fc_strcasecmp(const char *str0, const char *str1)
Definition support.c:186
size_t fc_strlcat(char *dest, const char *src, size_t n)
Definition support.c:822
int fc_strncasecmp(const char *str0, const char *str1, size_t n)
Definition support.c:235
#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:266
#define terrain_type_iterate_end
Definition terrain.h:272
#define terrain_has_flag(terr, flag)
Definition terrain.h:176
void timer_destroy(struct timer *t)
Definition timing.c:208
void timer_start(struct timer *t)
Definition timing.c:263
void timer_stop(struct timer *t)
Definition timing.c:305
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:2259
#define utype_class(_t_)
Definition unittype.h:756
#define uclass_index(_c_)
Definition unittype.h:749
#define MAP_NATIVE_WIDTH
#define MAP_IS_ISOMETRIC
#define MAP_NATIVE_HEIGHT