Freeciv-3.1
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 "gamehand.h"
33#include "maphand.h"
34#include "meta.h"
35#include "notify.h"
36#include "plrhand.h"
37#include "report.h"
38#include "rssanity.h"
39#include "srv_main.h"
40#include "stdinhand.h"
41
42#include "settings.h"
43
44/* The following classes determine what can be changed when.
45 * Actually, some of them have the same "changeability", but
46 * different types are separated here in case they have
47 * other uses.
48 * Also, SSET_GAME_INIT/SSET_RULES separate the two sections
49 * of server settings sent to the client.
50 * See the settings[] array and setting_is_changeable() for what
51 * these correspond to and explanations.
52 */
65
66typedef bool (*bool_validate_func_t) (bool value, struct connection *pconn,
67 char *reject_msg,
68 size_t reject_msg_len);
69typedef bool (*int_validate_func_t) (int value, struct connection *pconn,
70 char *reject_msg,
71 size_t reject_msg_len);
72typedef bool (*string_validate_func_t) (const char * value,
73 struct connection *pconn,
74 char *reject_msg,
75 size_t reject_msg_len);
76typedef bool (*enum_validate_func_t) (int value, struct connection *pconn,
77 char *reject_msg,
78 size_t reject_msg_len);
79typedef bool (*bitwise_validate_func_t) (unsigned value,
80 struct connection *pconn,
81 char *reject_msg,
82 size_t reject_msg_len);
83
84typedef void (*action_callback_func_t) (const struct setting *pset);
85typedef const char *(*help_callback_func_t) (const struct setting *pset);
86typedef const struct sset_val_name * (*val_name_func_t) (int value);
87
88struct setting {
89 const char *name;
91
92 /* What access level viewing and setting the setting requires. */
93 enum cmdlevel access_level_read;
94 enum cmdlevel access_level_write;
95
96 /*
97 * Should be less than 42 chars (?), or shorter if the values may
98 * have more than about 4 digits. Don't put "." on the end.
99 */
100 const char *short_help;
101
102 /*
103 * May be empty string, if short_help is sufficient. Need not
104 * include embedded newlines (but may, for formatting); lines will
105 * be wrapped (and indented) automatically. Should have punctuation
106 * etc, and should end with a "."
107 */
108 const char *extra_help;
109
110 /* help function */
112
113 enum sset_type stype;
114 enum sset_category scategory;
115 enum sset_level slevel;
116
117 /*
118 * About the *_validate functions: If the function is non-NULL, it
119 * is called with the new value, and returns whether the change is
120 * legal. The char * is an error message in the case of reject.
121 */
122
123 union {
124 /*** bool part ***/
125 struct {
126 bool *const pvalue;
127 const bool default_value;
132 /*** int part ***/
133 struct {
134 int *const pvalue;
135 const int default_value;
136 const int min_value;
137 const int max_value;
141 /*** string part ***/
142 struct {
143 char *const value;
144 const char *const default_value;
145 const size_t value_size;
149 /*** enumerator part ***/
150 struct {
151 void *const pvalue;
152 const int store_size;
153 const int default_value;
155 const val_name_func_t name;
156 int game_value;
158 /*** bitwise part ***/
159 struct {
160 unsigned *const pvalue;
161 const unsigned default_value;
163 const val_name_func_t name;
164 unsigned game_value;
166 };
167
168 /* action function */
170
171 /* ruleset lock for game settings */
172 bool locked;
173
175
176 /* It's not "default", even if value is the same as default */
177 enum setting_default_level setdef;
178 enum setting_default_level game_setdef;
179};
180
181static struct {
182 bool init;
183 struct setting_list *level[OLEVELS_NUM];
184} setting_sorted = { .init = FALSE };
185
186static bool setting_ruleset_one(struct section_file *file,
187 const char *name, const char *path);
188static void setting_game_set(struct setting *pset, bool init);
189static void setting_game_free(struct setting *pset);
190static void setting_game_restore(struct setting *pset);
191
192static void settings_list_init(void);
193static void settings_list_free(void);
194int settings_list_cmp(const struct setting *const *pset1,
195 const struct setting *const *pset2);
196
197#define settings_snprintf(_buf, _buf_len, format, ...) \
198 if (_buf != NULL) { \
199 fc_snprintf(_buf, _buf_len, format, ## __VA_ARGS__); \
200 }
201
202static bool set_enum_value(struct setting *pset, int val);
203
204/****************************************************************************
205 Enumerator name accessors.
206
207 Important note about compatibility:
208 1) you cannot modify the support name of an existent value. However, in a
209 development, you can modify it if it wasn't included in any stable
210 branch before.
211 2) Take care of modifying the pretty name of an existent value: make sure
212 to modify the help texts which are using it.
213****************************************************************************/
214
215#define NAME_CASE(_val, _support, _pretty) \
216 case _val: \
217 { \
218 static const struct sset_val_name name = { _support, _pretty }; \
219 return &name; \
220 }
221
222/************************************************************************/
225static const struct sset_val_name *caravanbonusstyle_name(int caravanbonus)
226{
227 switch (caravanbonus) {
228 /* TRANS: Description of caravan bonus style setting value. */
229 NAME_CASE(CBS_CLASSIC, "CLASSIC", N_("Classic Freeciv"));
230 NAME_CASE(CBS_LOGARITHMIC, "LOGARITHMIC", N_("Log^2 N style"));
231 }
232
233 return NULL;
234}
235
236/************************************************************************/
240static const struct sset_val_name *mapsize_name(int mapsize)
241{
242 switch (mapsize) {
243 NAME_CASE(MAPSIZE_FULLSIZE, "FULLSIZE", N_("Number of tiles"));
244 NAME_CASE(MAPSIZE_PLAYER, "PLAYER", N_("Tiles per player"));
245 NAME_CASE(MAPSIZE_XYSIZE, "XYSIZE", N_("Width and height"));
246 }
247 return NULL;
248}
249
250/************************************************************************/
253static const struct sset_val_name *topology_name(int topology_bit)
254{
255 switch (1 << topology_bit) {
256 NAME_CASE(TF_WRAPX, "WRAPX", N_("Wrap East-West"));
257 NAME_CASE(TF_WRAPY, "WRAPY", N_("Wrap North-South"));
258 NAME_CASE(TF_ISO, "ISO", N_("Isometric"));
259 NAME_CASE(TF_HEX, "HEX", N_("Hexagonal"));
260 }
261 return NULL;
262}
263
264/************************************************************************/
267static const struct sset_val_name *traderevenuestyle_name(int revenue_style)
268{
269 switch (revenue_style) {
270 /* TRANS: Description of trade revenue style setting value. */
271 NAME_CASE(TRS_CLASSIC, "CLASSIC", N_("Classic Freeciv"));
272 NAME_CASE(TRS_SIMPLE, "SIMPLE", N_("Proportional to tile trade"));
273 }
274
275 return NULL;
276}
277
278/************************************************************************/
281static const struct sset_val_name *generator_name(int generator)
282{
283 switch (generator) {
284 NAME_CASE(MAPGEN_SCENARIO, "SCENARIO", N_("Scenario map"));
285 NAME_CASE(MAPGEN_RANDOM, "RANDOM", N_("Fully random height"));
286 NAME_CASE(MAPGEN_FRACTAL, "FRACTAL", N_("Pseudo-fractal height"));
287 NAME_CASE(MAPGEN_ISLAND, "ISLAND", N_("Island-based"));
288 NAME_CASE(MAPGEN_FAIR, "FAIR", N_("Fair islands"));
289 NAME_CASE(MAPGEN_FRACTURE, "FRACTURE", N_("Fracture map"));
290 }
291 return NULL;
292}
293
294/************************************************************************/
297static const struct sset_val_name *startpos_name(int startpos)
298{
299 switch (startpos) {
301 N_("Generator's choice"));
303 N_("One player per continent"));
305 N_("Two or three players per continent"));
307 N_("All players on a single continent"));
309 N_("Depending on size of continents"));
310 }
311 return NULL;
312}
313
314/************************************************************************/
317static const struct sset_val_name *teamplacement_name(int team_placement)
318{
319 switch (team_placement) {
320 NAME_CASE(TEAM_PLACEMENT_DISABLED, "DISABLED",
321 N_("Disabled"));
322 NAME_CASE(TEAM_PLACEMENT_CLOSEST, "CLOSEST",
323 N_("As close as possible"));
324 NAME_CASE(TEAM_PLACEMENT_CONTINENT, "CONTINENT",
325 N_("On the same continent"));
326 NAME_CASE(TEAM_PLACEMENT_HORIZONTAL, "HORIZONTAL",
327 N_("Horizontal placement"));
328 NAME_CASE(TEAM_PLACEMENT_VERTICAL, "VERTICAL",
329 N_("Vertical placement"));
330 }
331 return NULL;
332}
333
334/************************************************************************/
337static const struct sset_val_name *persistentready_name(int persistent_ready)
338{
339 switch (persistent_ready) {
340 NAME_CASE(PERSISTENTR_DISABLED, "DISABLED",
341 N_("Disabled"));
342 NAME_CASE(PERSISTENTR_CONNECTED, "CONNECTED",
343 N_("As long as connected"));
344 }
345
346 return NULL;
347}
348
349/************************************************************************/
352static const struct sset_val_name *victory_conditions_name(int condition_bit)
353{
354 switch (condition_bit) {
355 NAME_CASE(VC_SPACERACE, "SPACERACE", N_("Spacerace"));
356 NAME_CASE(VC_ALLIED, "ALLIED", N_("Allied victory"));
357 NAME_CASE(VC_CULTURE, "CULTURE", N_("Culture victory"));
358 };
359
360 return NULL;
361}
362
363/************************************************************************/
366static const struct sset_val_name *autosaves_name(int autosaves_bit)
367{
368 switch (autosaves_bit) {
369 NAME_CASE(AS_TURN, "TURN", N_("New turn"));
370 NAME_CASE(AS_GAME_OVER, "GAMEOVER", N_("Game over"));
371 NAME_CASE(AS_QUITIDLE, "QUITIDLE", N_("No player connections"));
372 NAME_CASE(AS_INTERRUPT, "INTERRUPT", N_("Server interrupted"));
373 NAME_CASE(AS_TIMER, "TIMER", N_("Timer"));
374 };
375
376 return NULL;
377}
378
379/************************************************************************/
382static const struct sset_val_name *borders_name(int borders)
383{
384 switch (borders) {
385 NAME_CASE(BORDERS_DISABLED, "DISABLED", N_("Disabled"));
386 NAME_CASE(BORDERS_ENABLED, "ENABLED", N_("Enabled"));
387 NAME_CASE(BORDERS_SEE_INSIDE, "SEE_INSIDE",
388 N_("See everything inside borders"));
389 NAME_CASE(BORDERS_EXPAND, "EXPAND",
390 N_("Borders expand to unknown, revealing tiles"));
391 }
392 return NULL;
393}
394
395/************************************************************************/
398static const struct sset_val_name *trait_dist_name(int trait_dist)
399{
400 switch (trait_dist) {
401 NAME_CASE(TDM_FIXED, "FIXED", N_("Fixed"));
402 NAME_CASE(TDM_EVEN, "EVEN", N_("Even"));
403 }
404 return NULL;
405}
406
407/************************************************************************/
410static const struct sset_val_name *plrcol_name(int plrcol)
411{
412 switch (plrcol) {
413 NAME_CASE(PLRCOL_PLR_ORDER, "PLR_ORDER", N_("Per-player, in order"));
414 NAME_CASE(PLRCOL_PLR_RANDOM, "PLR_RANDOM", N_("Per-player, random"));
415 NAME_CASE(PLRCOL_PLR_SET, "PLR_SET", N_("Set manually"));
416 NAME_CASE(PLRCOL_TEAM_ORDER, "TEAM_ORDER", N_("Per-team, in order"));
417 NAME_CASE(PLRCOL_NATION_ORDER, "NATION_ORDER", N_("Per-nation, in order"));
418 }
419 return NULL;
420}
421
422/************************************************************************/
425static const struct sset_val_name *happyborders_name(int happyborders)
426{
427 switch (happyborders) {
428 NAME_CASE(HB_DISABLED, "DISABLED", N_("Borders are not helping"));
429 NAME_CASE(HB_NATIONAL, "NATIONAL", N_("Happy within own borders"));
430 NAME_CASE(HB_ALLIANCE, "ALLIED", N_("Happy within allied borders"));
431 }
432 return NULL;
433}
434
435/************************************************************************/
438static const struct sset_val_name *diplomacy_name(int diplomacy)
439{
440 switch (diplomacy) {
441 NAME_CASE(DIPLO_FOR_ALL, "ALL", N_("Enabled for everyone"));
443 N_("Only allowed between human players"));
444 NAME_CASE(DIPLO_FOR_AIS, "AI", N_("Only allowed between AI players"));
445 NAME_CASE(DIPLO_NO_AIS, "NOAI", N_("Only allowed when human involved"));
446 NAME_CASE(DIPLO_NO_MIXED, "NOMIXED", N_("Only allowed between two humans, or two AI players"));
447 NAME_CASE(DIPLO_FOR_TEAMS, "TEAM", N_("Restricted to teams"));
448 NAME_CASE(DIPLO_DISABLED, "DISABLED", N_("Disabled for everyone"));
449 }
450 return NULL;
451}
452
453/************************************************************************/
456static const struct sset_val_name *citynames_name(int citynames)
457{
458 switch (citynames) {
459 NAME_CASE(CNM_NO_RESTRICTIONS, "NO_RESTRICTIONS", N_("No restrictions"));
460 NAME_CASE(CNM_PLAYER_UNIQUE, "PLAYER_UNIQUE", N_("Unique to a player"));
461 NAME_CASE(CNM_GLOBAL_UNIQUE, "GLOBAL_UNIQUE", N_("Globally unique"));
462 NAME_CASE(CNM_NO_STEALING, "NO_STEALING", N_("No city name stealing"));
463 }
464 return NULL;
465}
466
467/************************************************************************/
470static const struct sset_val_name *barbarians_name(int barbarians)
471{
472 switch (barbarians) {
473 NAME_CASE(BARBS_DISABLED, "DISABLED", N_("No barbarians"));
474 NAME_CASE(BARBS_HUTS_ONLY, "HUTS_ONLY", N_("Only in huts"));
475 NAME_CASE(BARBS_NORMAL, "NORMAL", N_("Normal rate of appearance"));
476 NAME_CASE(BARBS_FREQUENT, "FREQUENT", N_("Frequent barbarian uprising"));
477 NAME_CASE(BARBS_HORDES, "HORDES", N_("Raging hordes"));
478 }
479 return NULL;
480}
481
482/************************************************************************/
485static const struct sset_val_name *revolentype_name(int revolentype)
486{
487 switch (revolentype) {
488 NAME_CASE(REVOLEN_FIXED, "FIXED", N_("Fixed to 'revolen' turns"));
489 NAME_CASE(REVOLEN_RANDOM, "RANDOM", N_("Randomly 1-'revolen' turns"));
490 NAME_CASE(REVOLEN_QUICKENING, "QUICKENING", N_("First time 'revolen', then always quicker"));
491 NAME_CASE(REVOLEN_RANDQUICK, "RANDQUICK", N_("Random, max always quicker"));
492 }
493 return NULL;
494}
495
496/************************************************************************/
499static const struct sset_val_name *revealmap_name(int bit)
500{
501 switch (1 << bit) {
502 NAME_CASE(REVEAL_MAP_START, "START", N_("Reveal map at game start"));
503 NAME_CASE(REVEAL_MAP_DEAD, "DEAD", N_("Unfog map for dead players"));
504 }
505 return NULL;
506}
507
508/************************************************************************/
511static const struct sset_val_name *airliftingstyle_name(int bit)
512{
513 switch (1 << bit) {
514 NAME_CASE(AIRLIFTING_ALLIED_SRC, "FROM_ALLIES",
515 N_("Allows units to be airlifted from allied cities"));
516 NAME_CASE(AIRLIFTING_ALLIED_DEST, "TO_ALLIES",
517 N_("Allows units to be airlifted to allied cities"));
518 NAME_CASE(AIRLIFTING_UNLIMITED_SRC, "SRC_UNLIMITED",
519 N_("Unlimited units from source city"));
520 NAME_CASE(AIRLIFTING_UNLIMITED_DEST, "DEST_UNLIMITED",
521 N_("Unlimited units to destination city"));
522 }
523 return NULL;
524}
525
526/************************************************************************/
529static const struct sset_val_name *phasemode_name(int phasemode)
530{
531 switch (phasemode) {
532 NAME_CASE(PMT_CONCURRENT, "ALL", N_("All players move concurrently"));
533 NAME_CASE(PMT_PLAYERS_ALTERNATE,
534 "PLAYER", N_("All players alternate movement"));
535 NAME_CASE(PMT_TEAMS_ALTERNATE, "TEAM", N_("Team alternate movement"));
536 }
537 return NULL;
538}
539
540/************************************************************************/
543static const struct sset_val_name *
545{
546 switch (sl_level) {
547 NAME_CASE(SL_ALL, "ALL", N_("All players"));
548 NAME_CASE(SL_HUMANS, "HUMANS", N_("Human players only"));
549 }
550 return NULL;
551}
552
553/************************************************************************/
556static const struct sset_val_name *
557compresstype_name(enum fz_method compresstype)
558{
559 switch (compresstype) {
560 NAME_CASE(FZ_PLAIN, "PLAIN", N_("No compression"));
561#ifdef FREECIV_HAVE_LIBZ
562 NAME_CASE(FZ_ZLIB, "LIBZ", N_("Using zlib (gzip format)"));
563#endif
564#ifdef FREECIV_HAVE_LIBBZ2
565 NAME_CASE(FZ_BZIP2, "BZIP2", N_("Using bzip2 (deprecated)"));
566#endif
567#ifdef FREECIV_HAVE_LIBLZMA
568 NAME_CASE(FZ_XZ, "XZ", N_("Using xz"));
569#endif
570#ifdef FREECIV_HAVE_LIBZSTD
571 NAME_CASE(FZ_ZSTD, "ZSTD", N_("Using zstd"));
572#endif
573 }
574 return NULL;
575}
576
577/************************************************************************/
580static const struct sset_val_name *bool_name(int enable)
581{
582 switch (enable) {
583 NAME_CASE(FALSE, "DISABLED", N_("disabled"));
584 NAME_CASE(TRUE, "ENABLED", N_("enabled"));
585 }
586 return NULL;
587}
588
589#undef NAME_CASE
590
591/****************************************************************************
592 Help callback functions.
593****************************************************************************/
594
595/************************************************************************/
598static const char *phasemode_help(const struct setting *pset)
599{
600 static char pmhelp[512];
601
602 /* Translated here */
603 fc_snprintf(pmhelp, sizeof(pmhelp),
604 _("This setting controls whether players may make "
605 "moves at the same time during a turn. Change "
606 "in setting takes effect next turn. Currently, at least "
607 "to the end of this turn, mode is \"%s\"."),
609
610 return pmhelp;
611}
612
613/************************************************************************/
616static const char *huts_help(const struct setting *pset)
617{
618 if (wld.map.server.huts_absolute >= 0) {
619 static char hutshelp[512];
620
621 /* Translated here */
622 fc_snprintf(hutshelp, sizeof(hutshelp),
623 _("%s\n"
624 "Currently this setting is being overridden by an "
625 "old scenario or savegame, which has set the absolute "
626 "number of huts to %d. Explicitly set this setting "
627 "again to make it take effect instead."),
629
630 return hutshelp;
631 }
632
633 return pset->extra_help;
634}
635
636/****************************************************************************
637 Action callback functions.
638****************************************************************************/
639
640/************************************************************************/
643static void scorelog_action(const struct setting *pset)
644{
645 if (*pset->boolean.pvalue) {
647 } else {
649 }
650}
651
652/************************************************************************/
655static void aifill_action(const struct setting *pset)
656{
657 const char *msg = aifill(*pset->integer.pvalue);
658 if (msg) {
659 log_normal(_("Warning: aifill not met: %s."), msg);
660 notify_conn(NULL, NULL, E_SETTING, ftc_server,
661 _("Warning: aifill not met: %s."), msg);
662 }
663}
664
665/************************************************************************/
668static void nationset_action(const struct setting *pset)
669{
670 /* If any player's existing selection is invalid, abort it */
671 players_iterate(pplayer) {
672 if (pplayer->nation != NULL) {
673 if (!nation_is_in_current_set(pplayer->nation)) {
674 (void) player_set_nation(pplayer, NO_NATION_SELECTED);
676 }
677 }
680 (void) aifill(game.info.aifill);
681
682 /* There might now be too many players for the available nations.
683 * Rather than getting rid of some players arbitrarily, we let the
684 * situation persist for all already-connected players; the server
685 * will simply refuse to start until someone reduces the number of
686 * players. This policy also avoids annoyance if nationset is
687 * accidentally and transiently set to an unintended value.
688 * (However, new connections will start out detached.) */
689 if (normal_player_count() > server.playable_nations) {
690 notify_conn(NULL, NULL, E_SETTING, ftc_server, "%s",
691 _("Warning: not enough nations in this nation set "
692 "for all current players."));
693 }
694
696}
697
698/************************************************************************/
701static void plrcol_action(const struct setting *pset)
702{
703 if (!game_was_started()) {
704 if (read_enum_value(pset) != PLRCOL_PLR_SET) {
705 players_iterate(pplayer) {
706 server_player_set_color(pplayer, NULL);
708 }
709 /* Update clients with new color scheme. */
710 send_player_info_c(NULL, NULL);
711 }
712}
713
714/************************************************************************/
717static void autotoggle_action(const struct setting *pset)
718{
719 if (*pset->boolean.pvalue) {
720 players_iterate(pplayer) {
721 if (is_human(pplayer) && !pplayer->is_connected) {
722 toggle_ai_player_direct(NULL, pplayer);
724 }
726 }
727}
728
729/************************************************************************/
733static void timeout_action(const struct setting *pset)
734{
735 if (S_S_RUNNING == server_state()) {
736 int timeout = *pset->integer.pvalue;
737
738 if (game.info.turn != 1 || game.info.first_timeout == -1) {
739 /* This may cause the current turn to end immediately. */
741 }
742 send_game_info(NULL);
743 }
744}
745
746/************************************************************************/
750static void first_timeout_action(const struct setting *pset)
751{
752 if (S_S_RUNNING == server_state()) {
753 int timeout = *pset->integer.pvalue;
754
755 if (game.info.turn == 1) {
756 /* This may cause the current turn to end immediately. */
757 if (timeout != -1) {
759 } else {
761 }
762 }
763 send_game_info(NULL);
764 }
765}
766
767/************************************************************************/
770static void huts_action(const struct setting *pset)
771{
773}
774
775/************************************************************************/
778static void topology_action(const struct setting *pset)
779{
780 struct packet_set_topology packet;
781
782 packet.topology_id = *pset->integer.pvalue;
783
785 send_packet_set_topology(pconn, &packet);
787}
788
789/************************************************************************/
793static void metamessage_action(const struct setting *pset)
794{
795 /* Set the metaserver message based on the new meta server user message.
796 * An empty user metaserver message results in an automatic meta message.
797 * A non empty user meta message results in the user meta message. */
799
800 if (is_metaserver_open()) {
801 /* Update the meta server. */
803 }
804}
805
806/****************************************************************************
807 Validation callback functions.
808****************************************************************************/
809
810/************************************************************************/
813static bool savename_validate(const char *value, struct connection *caller,
814 char *reject_msg, size_t reject_msg_len)
815{
816 char buf[MAX_LEN_PATH];
817
818 generate_save_name(value, buf, sizeof(buf), NULL);
819
820 if (!is_safe_filename(buf)) {
821 settings_snprintf(reject_msg, reject_msg_len,
822 _("Invalid save name definition: '%s' "
823 "(resolves to '%s')."), value, buf);
824 return FALSE;
825 }
826
827 return TRUE;
828}
829
830/************************************************************************/
834static bool generator_validate(int value, struct connection *caller,
835 char *reject_msg, size_t reject_msg_len)
836{
837 if (map_is_empty()) {
838 if (MAPGEN_SCENARIO == value
839 && (NULL != caller || !game.scenario.is_scenario)) {
840 settings_snprintf(reject_msg, reject_msg_len,
841 _("You cannot disable the map generator."));
842 return FALSE;
843 }
844 return TRUE;
845 } else {
846 if (MAPGEN_SCENARIO != value) {
847 settings_snprintf(reject_msg, reject_msg_len,
848 _("You cannot require a map generator "
849 "when a map is loaded."));
850 return FALSE;
851 }
852 }
853 return TRUE;
854}
855
856/************************************************************************/
859#ifndef FREECIV_WEB
860static bool scorefile_validate(const char *value, struct connection *caller,
861 char *reject_msg, size_t reject_msg_len)
862{
863 if (!is_safe_filename(value)) {
864 settings_snprintf(reject_msg, reject_msg_len,
865 _("Invalid score name definition: '%s'."), value);
866 return FALSE;
867 }
868
869 return TRUE;
870}
871#endif /* !FREECIV_WEB */
872
873/************************************************************************/
877static bool demography_callback(const char *value,
878 struct connection *caller,
879 char *reject_msg,
880 size_t reject_msg_len)
881{
882 int error;
883
884 if (is_valid_demography(value, &error)) {
885 return TRUE;
886 } else {
887 settings_snprintf(reject_msg, reject_msg_len,
888 _("Demography string validation failed at character: "
889 "'%c'. Try \"/help demography\"."), value[error]);
890 return FALSE;
891 }
892}
893
894/************************************************************************/
897static bool autosaves_callback(unsigned value, struct connection *caller,
898 char *reject_msg, size_t reject_msg_len)
899{
900 if (S_S_RUNNING == server_state()) {
901 if ((value & (1 << AS_TIMER))
902 && !(game.server.autosaves & (1 << AS_TIMER))) {
906 } else if (!(value & (1 << AS_TIMER))
907 && (game.server.autosaves & (1 << AS_TIMER))) {
910 game.server.save_timer = NULL;
911 }
912 }
913
914 return TRUE;
915}
916
917/************************************************************************/
921static bool allowtake_callback(const char *value,
922 struct connection *caller,
923 char *reject_msg,
924 size_t reject_msg_len)
925{
926 int len = strlen(value), i;
927 bool havecharacter_state = FALSE;
928
929 /* We check each character individually to see if it's valid. This
930 * does not check for duplicate entries.
931 *
932 * We also track the state of the machine. havecharacter_state is
933 * true if the preceding character was a primary label, e.g.
934 * NHhAadb. It is false if the preceding character was a modifier
935 * or if this is the first character. */
936
937 for (i = 0; i < len; i++) {
938 /* Check to see if the character is a primary label. */
939 if (strchr("HhAadbOo", value[i])) {
940 havecharacter_state = TRUE;
941 continue;
942 }
943
944 /* If we've already passed a primary label, check to see if the
945 * character is a modifier. */
946 if (havecharacter_state && strchr("1234", value[i])) {
947 havecharacter_state = FALSE;
948 continue;
949 }
950
951 /* Looks like the character was invalid. */
952 settings_snprintf(reject_msg, reject_msg_len,
953 _("Allowed take string validation failed at "
954 "character: '%c'. Try \"/help allowtake\"."),
955 value[i]);
956 return FALSE;
957 }
958
959 /* All characters were valid. */
960 return TRUE;
961}
962
963/************************************************************************/
967static bool startunits_callback(const char *value,
968 struct connection *caller,
969 char *reject_msg,
970 size_t reject_msg_len)
971{
972 int len = strlen(value), i;
973 Unit_Class_id first_role;
974 bool firstnative = FALSE;
975
976 if (len == 0) {
977 return TRUE;
978 }
979
980 /* We check each character individually to see if it's valid. */
981 for (i = 0; i < len; i++) {
982 if (strchr("cwxksfdDaA", value[i])) {
983 continue;
984 }
985
986 /* Looks like the character was invalid. */
987 settings_snprintf(reject_msg, reject_msg_len,
988 _("Starting units string validation failed at "
989 "character '%c'. Try \"/help startunits\"."),
990 value[i]);
991 return FALSE;
992 }
993
994 /* Check the first character to make sure it can use a startpos. */
996 crole_to_role_id(value[0]), 0)));
997 terrain_type_iterate(pterrain) {
998 if (terrain_has_flag(pterrain, TER_STARTER)
999 && BV_ISSET(pterrain->native_to, first_role)) {
1000 firstnative = TRUE;
1001 break;
1002 }
1004
1005 if (!firstnative) {
1006 /* Loading would cause an infinite loop hunting for a valid startpos. */
1007 settings_snprintf(reject_msg, reject_msg_len,
1008 _("The first starting unit must be native to at "
1009 "least one \"Starter\" terrain. "
1010 "Try \"/help startunits\"."));
1011 return FALSE;
1012 }
1013
1014 /* Everything seems fine. */
1015 return TRUE;
1016}
1017
1018/************************************************************************/
1021static bool endturn_callback(int value, struct connection *caller,
1022 char *reject_msg, size_t reject_msg_len)
1023{
1024 if (value < game.info.turn) {
1025 /* Tried to set endturn earlier than current turn */
1026 settings_snprintf(reject_msg, reject_msg_len,
1027 _("Cannot set endturn earlier than current turn."));
1028 return FALSE;
1029 }
1030 return TRUE;
1031}
1032
1033/************************************************************************/
1036static bool maxplayers_callback(int value, struct connection *caller,
1037 char *reject_msg, size_t reject_msg_len)
1038{
1039 if (value < player_count()) {
1040 settings_snprintf(reject_msg, reject_msg_len,
1041 _("Number of players (%d) is higher than requested "
1042 "value (%d). Keeping old value."), player_count(),
1043 value);
1044 return FALSE;
1045 }
1046 /* If any start positions are defined by a scenario, we can only
1047 * accommodate as many players as we have start positions. */
1048 if (server_state() < S_S_RUNNING
1049 && 0 < map_startpos_count() && value > map_startpos_count()) {
1050 settings_snprintf(reject_msg, reject_msg_len,
1051 _("Requested value (%d) is greater than number of "
1052 "available start positions (%d). Keeping old value."),
1053 value, map_startpos_count());
1054 return FALSE;
1055 }
1056
1057 return TRUE;
1058}
1059
1060/************************************************************************/
1063static bool nationset_callback(const char *value,
1064 struct connection *caller,
1065 char *reject_msg,
1066 size_t reject_msg_len)
1067{
1068 if (strlen(value) == 0) {
1069 return TRUE;
1070 } else if (nation_set_by_rule_name(value)) {
1071 return TRUE;
1072 } else {
1073 settings_snprintf(reject_msg, reject_msg_len,
1074 /* TRANS: do not translate 'list nationsets' */
1075 _("Unknown nation set \"%s\". See '%slist nationsets' "
1076 "for possible values."), value, caller ? "/" : "");
1077 return FALSE;
1078 }
1079}
1080
1081/************************************************************************/
1084static bool timeout_callback(int value, struct connection *caller,
1085 char *reject_msg, size_t reject_msg_len)
1086{
1087 /* Disallow low timeout values for non-hack connections. */
1088 if (caller && caller->access_level < ALLOW_HACK
1089 && value < 30 && value != 0) {
1090 settings_snprintf(reject_msg, reject_msg_len,
1091 _("You are not allowed to set timeout values less "
1092 "than 30 seconds."));
1093 return FALSE;
1094 }
1095
1096 if (value == -1 && game.server.unitwaittime != 0) {
1097 /* autogame only with 'unitwaittime' = 0 */
1098 settings_snprintf(reject_msg, reject_msg_len,
1099 /* TRANS: Do not translate setting names in ''. */
1100 _("For autogames ('timeout' = -1) 'unitwaittime' "
1101 "should be deactivated (= 0)."));
1102 return FALSE;
1103 }
1104
1105 if (value > 0 && value < game.server.unitwaittime * 3 / 2) {
1106 /* for normal games 'timeout' should be at least 3/2 times the value
1107 * of 'unitwaittime' */
1108 settings_snprintf(reject_msg, reject_msg_len,
1109 /* TRANS: Do not translate setting names in ''. */
1110 _("'timeout' can not be lower than 3/2 of the "
1111 "'unitwaittime' setting (= %d). Please change "
1112 "'unitwaittime' first."), game.server.unitwaittime);
1113 return FALSE;
1114 }
1115
1116 return TRUE;
1117}
1118
1119/************************************************************************/
1122static bool first_timeout_callback(int value, struct connection *caller,
1123 char *reject_msg, size_t reject_msg_len)
1124{
1125 /* Disallow low timeout values for non-hack connections. */
1126 if (caller && caller->access_level < ALLOW_HACK
1127 && value < 30 && value != 0) {
1128 settings_snprintf(reject_msg, reject_msg_len,
1129 _("You are not allowed to set timeout values less "
1130 "than 30 seconds."));
1131 return FALSE;
1132 }
1133
1134 return TRUE;
1135}
1136
1137/************************************************************************/
1140static bool unitwaittime_callback(int value, struct connection *caller,
1141 char *reject_msg, size_t reject_msg_len)
1142{
1143 if (game.info.timeout == -1 && value != 0) {
1144 settings_snprintf(reject_msg, reject_msg_len,
1145 /* TRANS: Do not translate setting names in ''. */
1146 _("For autogames ('timeout' = -1) 'unitwaittime' "
1147 "should be deactivated (= 0)."));
1148 return FALSE;
1149 }
1150
1151 if (game.info.timeout > 0 && value > game.info.timeout * 2 / 3) {
1152 settings_snprintf(reject_msg, reject_msg_len,
1153 /* TRANS: Do not translate setting names in ''. */
1154 _("'unitwaittime' has to be lower than 2/3 of the "
1155 "'timeout' setting (= %d). Please change 'timeout' "
1156 "first."), game.info.timeout);
1157 return FALSE;
1158 }
1159
1160 return TRUE;
1161}
1162
1163/************************************************************************/
1166static bool mapsize_callback(int value, struct connection *caller,
1167 char *reject_msg, size_t reject_msg_len)
1168{
1169 if (value == MAPSIZE_XYSIZE && MAP_IS_ISOMETRIC
1170 && wld.map.ysize % 2 != 0) {
1171 /* An isometric map needs a even ysize. It is calculated automatically
1172 * for all settings but mapsize=XYSIZE. */
1173 settings_snprintf(reject_msg, reject_msg_len,
1174 _("For an isometric or hexagonal map the ysize must be "
1175 "even."));
1176 return FALSE;
1177 }
1178
1179 return TRUE;
1180}
1181
1182/************************************************************************/
1185static bool xsize_callback(int value, struct connection *caller,
1186 char *reject_msg, size_t reject_msg_len)
1187{
1188 int size = value * wld.map.ysize;
1189
1190 if (size < MAP_MIN_SIZE * 1000) {
1191 settings_snprintf(reject_msg, reject_msg_len,
1192 _("The map size (%d * %d = %d) must be larger than "
1193 "%d tiles."), value, wld.map.ysize, size,
1194 MAP_MIN_SIZE * 1000);
1195 return FALSE;
1196 } else if (size > MAP_MAX_SIZE * 1000) {
1197 settings_snprintf(reject_msg, reject_msg_len,
1198 _("The map size (%d * %d = %d) must be lower than "
1199 "%d tiles."), value, wld.map.ysize, size,
1200 MAP_MAX_SIZE * 1000);
1201 return FALSE;
1202 }
1203
1204 return TRUE;
1205}
1206
1207/************************************************************************/
1210static bool ysize_callback(int value, struct connection *caller,
1211 char *reject_msg, size_t reject_msg_len)
1212{
1213 int size = wld.map.xsize * value;
1214
1215 if (size < MAP_MIN_SIZE * 1000) {
1216 settings_snprintf(reject_msg, reject_msg_len,
1217 _("The map size (%d * %d = %d) must be larger than "
1218 "%d tiles."), wld.map.xsize, value, size,
1219 MAP_MIN_SIZE * 1000);
1220 return FALSE;
1221 } else if (size > MAP_MAX_SIZE * 1000) {
1222 settings_snprintf(reject_msg, reject_msg_len,
1223 _("The map size (%d * %d = %d) must be lower than "
1224 "%d tiles."), wld.map.xsize, value, size,
1225 MAP_MAX_SIZE * 1000);
1226 return FALSE;
1228 && value % 2 != 0) {
1229 /* An isometric map needs a even ysize. It is calculated automatically
1230 * for all settings but mapsize=XYSIZE. */
1231 settings_snprintf(reject_msg, reject_msg_len,
1232 _("For an isometric or hexagonal map the ysize must be "
1233 "even."));
1234 return FALSE;
1235 }
1236
1237 return TRUE;
1238}
1239
1240/************************************************************************/
1243static bool topology_callback(unsigned value, struct connection *caller,
1244 char *reject_msg, size_t reject_msg_len)
1245{
1247 && ((value & (TF_ISO)) != 0 || (value & (TF_HEX)) != 0)
1248 && wld.map.ysize % 2 != 0) {
1249 /* An isometric map needs a even ysize. It is calculated automatically
1250 * for all settings but mapsize=XYSIZE. */
1251 settings_snprintf(reject_msg, reject_msg_len,
1252 _("For an isometric or hexagonal map the ysize must be "
1253 "even."));
1254 return FALSE;
1255 }
1256
1257#ifdef FREECIV_WEB
1258 /* Remember to update the help text too if Freeciv-web gets the ability
1259 * to display other map topologies. */
1260 if ((value & (TF_WRAPY)) != 0
1261 /* Are you removing this because Freeciv-web gained the ability to
1262 * display isometric maps? Why don't you remove the Freeciv-web
1263 * specific MAP_DEFAULT_TOPO too? */
1264 || (value & (TF_ISO)) != 0
1265 || (value & (TF_HEX)) != 0) {
1266 /* The Freeciv-web client can't display these topologies yet. */
1267 settings_snprintf(reject_msg, reject_msg_len,
1268 _("Freeciv-web doesn't support this topology."));
1269 return FALSE;
1270 }
1271#endif /* FREECIV_WEB */
1272
1273 return TRUE;
1274}
1275
1276/************************************************************************/
1279static bool compresstype_callback(int value,
1280 struct connection *caller,
1281 char *reject_msg,
1282 size_t reject_msg_len)
1283{
1284#ifdef FREECIV_HAVE_LIBBZ2
1285 if (value == FZ_BZIP2) {
1286 log_warn(_("Bzip2 is deprecated as compresstype. Consider "
1287 "other options."));
1288 }
1289#endif /* FREECIV_HAVE_LIBBZ2 */
1290
1291 return TRUE;
1292}
1293
1294/************************************************************************/
1297static bool plrcol_validate(int value, struct connection *caller,
1298 char *reject_msg, size_t reject_msg_len)
1299{
1300 enum plrcolor_mode mode = value;
1301 if (mode == PLRCOL_NATION_ORDER) {
1302 nations_iterate(pnation) {
1303 if (nation_color(pnation)) {
1304 /* At least one nation has a color. Allow this mode. */
1305 return TRUE;
1306 }
1308 settings_snprintf(reject_msg, reject_msg_len,
1309 _("No nations in the currently loaded ruleset have "
1310 "associated colors."));
1311 return FALSE;
1312 }
1313 return TRUE;
1314}
1315
1316#define GEN_BOOL(name, value, sclass, scateg, slevel, al_read, al_write, \
1317 short_help, extra_help, func_validate, func_action, \
1318 _default) \
1319 {name, sclass, al_read, al_write, short_help, extra_help, NULL, SST_BOOL, \
1320 scateg, slevel, \
1321 INIT_BRACE_BEGIN \
1322 .boolean = {&value, _default, func_validate, bool_name, \
1323 FALSE} INIT_BRACE_END , func_action, FALSE, TRUE},
1324
1325#define GEN_INT(name, value, sclass, scateg, slevel, al_read, al_write, \
1326 short_help, extra_help, func_help, \
1327 func_validate, func_action, \
1328 _min, _max, _default) \
1329 {name, sclass, al_read, al_write, short_help, extra_help, func_help, \
1330 SST_INT, scateg, slevel, \
1331 INIT_BRACE_BEGIN \
1332 .integer = {(int *) &value, _default, _min, _max, func_validate, \
1333 0} INIT_BRACE_END, \
1334 func_action, FALSE, TRUE},
1335
1336#define GEN_STRING(name, value, sclass, scateg, slevel, al_read, al_write, \
1337 short_help, extra_help, func_validate, func_action, \
1338 _default) \
1339 {name, sclass, al_read, al_write, short_help, extra_help, NULL, \
1340 SST_STRING, scateg, slevel, \
1341 INIT_BRACE_BEGIN \
1342 .string = {value, _default, sizeof(value), func_validate, ""} \
1343 INIT_BRACE_END, \
1344 func_action, FALSE, TRUE},
1345
1346#define GEN_STRING_NRS(name, value, sclass, scateg, slevel, al_read, al_write, \
1347 short_help, extra_help, func_validate, func_action, \
1348 _default) \
1349 {name, sclass, al_read, al_write, short_help, extra_help, NULL, \
1350 SST_STRING, scateg, slevel, \
1351 INIT_BRACE_BEGIN \
1352 .string = {value, _default, sizeof(value), func_validate, ""} \
1353 INIT_BRACE_END, \
1354 func_action, FALSE, FALSE},
1355
1356#define GEN_ENUM(name, value, sclass, scateg, slevel, al_read, al_write, \
1357 short_help, extra_help, func_help, func_validate, \
1358 func_action, func_name, _default) \
1359 { name, sclass, al_read, al_write, short_help, extra_help, func_help, \
1360 SST_ENUM, scateg, slevel, \
1361 INIT_BRACE_BEGIN \
1362 .enumerator = { &value, sizeof(value), _default, \
1363 func_validate, \
1364 (val_name_func_t) func_name, 0 } INIT_BRACE_END, \
1365 func_action, FALSE, TRUE},
1366
1367#define GEN_BITWISE(name, value, sclass, scateg, slevel, al_read, al_write, \
1368 short_help, extra_help, func_validate, func_action, \
1369 func_name, _default) \
1370 { name, sclass, al_read, al_write, short_help, extra_help, NULL, \
1371 SST_BITWISE, scateg, slevel, \
1372 INIT_BRACE_BEGIN \
1373 .bitwise = { (unsigned *) (void *) &value, _default, func_validate, \
1374 func_name, 0 } INIT_BRACE_END, \
1375 func_action, FALSE, TRUE},
1376
1377/* game settings */
1378static struct setting settings[] = {
1379
1380 /* These should be grouped by sclass */
1381
1382 /* Map size parameters: adjustable if we don't yet have a map */
1384 SSET_GEOLOGY, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1385 N_("Map size definition"),
1386 /* TRANS: The strings between double quotes are also translated
1387 * separately (they must match!). The strings between single
1388 * quotes are setting names and shouldn't be translated. The
1389 * strings between parentheses and in uppercase must stay as
1390 * untranslated. */
1391 N_("Chooses the method used to define the map size. Other options "
1392 "specify the parameters for each method.\n"
1393 "- \"Number of tiles\" (FULLSIZE): Map area (option 'size').\n"
1394 "- \"Tiles per player\" (PLAYER): Number of (land) tiles per "
1395 "player (option 'tilesperplayer').\n"
1396 "- \"Width and height\" (XYSIZE): Map width and height in "
1397 "tiles (options 'xsize' and 'ysize')."), NULL,
1399
1401 SSET_GEOLOGY, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1402 N_("Map area (in thousands of tiles)"),
1403 /* TRANS: The strings between double quotes are also translated
1404 * separately (they must match!). The strings between single
1405 * quotes are setting names and shouldn't be translated. The
1406 * strings between parentheses and in uppercase must stay as
1407 * untranslated. */
1408 N_("This value is used to determine the map area.\n"
1409 " size = 4 is a normal map of 4,000 tiles (default)\n"
1410 " size = 20 is a huge map of 20,000 tiles\n"
1411 "For this option to take effect, the \"Map size definition\" "
1412 "option ('mapsize') must be set to \"Number of tiles\" "
1413 "(FULLSIZE)."), NULL, NULL, NULL,
1415
1416 GEN_INT("tilesperplayer", wld.map.server.tilesperplayer, SSET_MAP_SIZE,
1417 SSET_GEOLOGY, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1418 N_("Number of (land) tiles per player"),
1419 /* TRANS: The strings between double quotes are also translated
1420 * separately (they must match!). The strings between single
1421 * quotes are setting names and shouldn't be translated. The
1422 * strings between parentheses and in uppercase must stay as
1423 * untranslated. */
1424 N_("This value is used to determine the map dimensions. It "
1425 "calculates the map size at game start based on the number "
1426 "of players and the value of the setting 'landmass'.\n"
1427 "For this option to take effect, the \"Map size definition\" "
1428 "option ('mapsize') must be set to \"Tiles per player\" "
1429 "(PLAYER)."),
1430 NULL, NULL, NULL, MAP_MIN_TILESPERPLAYER,
1432
1433 GEN_INT("xsize", wld.map.xsize, SSET_MAP_SIZE,
1434 SSET_GEOLOGY, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1435 N_("Map width in tiles"),
1436 /* TRANS: The strings between double quotes are also translated
1437 * separately (they must match!). The strings between single
1438 * quotes are setting names and shouldn't be translated. The
1439 * strings between parentheses and in uppercase must stay as
1440 * untranslated. */
1441 N_("Defines the map width.\n"
1442 "For this option to take effect, the \"Map size definition\" "
1443 "option ('mapsize') must be set to \"Width and height\" "
1444 "(XYSIZE)."),
1445 NULL, xsize_callback, NULL,
1447 GEN_INT("ysize", wld.map.ysize, SSET_MAP_SIZE,
1448 SSET_GEOLOGY, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1449 N_("Map height in tiles"),
1450 /* TRANS: The strings between double quotes are also translated
1451 * separately (they must match!). The strings between single
1452 * quotes are setting names and shouldn't be translated. The
1453 * strings between parentheses and in uppercase must stay as
1454 * untranslated. */
1455 N_("Defines the map height.\n"
1456 "For this option to take effect, the \"Map size definition\" "
1457 "option ('mapsize') must be set to \"Width and height\" "
1458 "(XYSIZE)."),
1459 NULL, ysize_callback, NULL,
1461
1463 SSET_GEOLOGY, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1464 N_("Map topology"),
1465#ifdef FREECIV_WEB
1466 /* TRANS: Freeciv-web version of the help text. */
1467 N_("Freeciv-web maps are always two-dimensional. They may wrap "
1468 "at the east-west directions to form a flat map or a "
1469 "cylinder.\n"),
1470#else /* FREECIV_WEB */
1471 /* TRANS: do not edit the ugly ASCII art */
1472 N_("Freeciv maps are always two-dimensional. They may wrap at "
1473 "the north-south and east-west directions to form a flat "
1474 "map, a cylinder, or a torus (donut). Individual tiles may "
1475 "be rectangular or hexagonal, with either an overhead "
1476 "(\"classic\") or isometric alignment.\n"
1477 "To play with a particular topology, clients will need a "
1478 "matching tileset.\n"
1479 "Overhead rectangular: Isometric rectangular:\n"
1480 " _________ /\\/\\/\\/\\/\\\n"
1481 " |_|_|_|_|_| /\\/\\/\\/\\/\\/\n"
1482 " |_|_|_|_|_| \\/\\/\\/\\/\\/\\\n"
1483 " |_|_|_|_|_| /\\/\\/\\/\\/\\/\n"
1484 " \\/\\/\\/\\/\\/\n"
1485 "Hex: Iso-hex:\n"
1486 " /\\/\\/\\/\\/\\/\\ _ _ _ _ _\n"
1487 " | | | | | | | / \\_/ \\_/ \\_/ \\_/ \\\n"
1488 " \\/\\/\\/\\/\\/\\/\\"
1489 " \\_/ \\_/ \\_/ \\_/ \\_/\n"
1490 " | | | | | | | / \\_/ \\_/ \\_/ \\_/ \\\n"
1491 " \\/\\/\\/\\/\\/\\/"
1492 " \\_/ \\_/ \\_/ \\_/ \\_/\n"),
1493#endif /* FREECIV_WEB */
1495
1496 GEN_ENUM("generator", wld.map.server.generator,
1497 SSET_MAP_GEN, SSET_GEOLOGY, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1498 N_("Method used to generate map"),
1499 /* TRANS: The strings between double quotes are also translated
1500 * separately (they must match!). The strings between single
1501 * quotes (except 'fair') are setting names and shouldn't be
1502 * translated. The strings between parentheses and in uppercase
1503 * must stay as untranslated. */
1504 N_("Specifies the algorithm used to generate the map. If the "
1505 "default value of the 'startpos' option is used, then the "
1506 "chosen generator chooses an appropriate 'startpos' setting; "
1507 "otherwise, the generated map tries to accommodate the "
1508 "chosen 'startpos' setting.\n"
1509 "- \"Scenario map\" (SCENARIO): indicates a pre-generated map. "
1510 "By default, if the scenario does not specify start positions, "
1511 "they will be allocated depending on the size of continents.\n"
1512 "- \"Fully random height\" (RANDOM): generates maps with a "
1513 "number of equally spaced, relatively small islands. By default, "
1514 "start positions are allocated depending on continent size.\n"
1515 "- \"Pseudo-fractal height\" (FRACTAL): generates Earthlike "
1516 "worlds with one or more large continents and a scattering of "
1517 "smaller islands. By default, players are all placed on a "
1518 "single continent.\n"
1519 "- \"Island-based\" (ISLAND): generates 'fair' maps with a "
1520 "number of similarly-sized and -shaped islands, each with "
1521 "approximately the same ratios of terrain types. By default, "
1522 "each player gets their own island.\n"
1523 "- \"Fair islands\" (FAIR): generates the exact copy of the "
1524 "same island for every player or every team.\n"
1525 "- \"Fracture map\" (FRACTURE): generates maps from a fracture "
1526 "pattern. Tends to place hills and mountains along the edges "
1527 "of the continents.\n"
1528 "If the requested generator is incompatible with other server "
1529 "settings, the server may fall back to another generator."),
1531
1532 GEN_ENUM("startpos", wld.map.server.startpos,
1533 SSET_MAP_GEN, SSET_GEOLOGY, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1534 N_("Method used to choose start positions"),
1535 /* TRANS: The strings between double quotes are also translated
1536 * separately (they must match!). The strings between single
1537 * quotes (except 'best') are setting names and shouldn't be
1538 * translated. The strings between parentheses and in uppercase
1539 * must stay as untranslated. */
1540 N_("The method used to choose where each player's initial units "
1541 "start on the map. (For scenarios which include pre-set "
1542 "start positions, this setting is ignored.)\n"
1543 "- \"Generator's choice\" (DEFAULT): the start position "
1544 "placement will depend on the map generator chosen. See the "
1545 "'generator' setting.\n"
1546 "- \"One player per continent\" (SINGLE): one player is "
1547 "placed on each of a set of continents of approximately "
1548 "equivalent value (if possible).\n"
1549 "- \"Two or three players per continent\" (2or3): similar "
1550 "to SINGLE except that two players will be placed on each "
1551 "continent, with three on the 'best' continent if there is an "
1552 "odd number of players.\n"
1553 "- \"All players on a single continent\" (ALL): all players "
1554 "will start on the 'best' available continent.\n"
1555 "- \"Depending on size of continents\" (VARIABLE): players "
1556 "will be placed on the 'best' available continents such that, "
1557 "as far as possible, the number of players on each continent "
1558 "is proportional to its value.\n"
1559 "If the server cannot satisfy the requested setting due to "
1560 "there being too many players for continents, it may fall "
1561 "back to one of the others. (However, map generators try to "
1562 "create the right number of continents for the choice of this "
1563 "'startpos' setting and the number of players, so this is "
1564 "unlikely to occur.)"),
1565 NULL, NULL, NULL, startpos_name, MAP_DEFAULT_STARTPOS)
1566
1567 GEN_ENUM("teamplacement", wld.map.server.team_placement,
1568 SSET_MAP_GEN, SSET_GEOLOGY, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1569 N_("Method used for placement of team mates"),
1570 /* TRANS: The strings between double quotes are also translated
1571 * separately (they must match!). The strings between single
1572 * quotes are setting names and shouldn't be translated. The
1573 * strings between parentheses and in uppercase must stay as
1574 * untranslated. */
1575 N_("After start positions have been generated thanks to the "
1576 "'startpos' setting, this setting controls how the start "
1577 "positions will be assigned to the different players of the "
1578 "same team.\n"
1579 "- \"Disabled\" (DISABLED): the start positions will be "
1580 "randomly assigned to players, regardless of teams.\n"
1581 "- \"As close as possible\" (CLOSEST): players will be "
1582 "placed as close as possible, regardless of continents.\n"
1583 "- \"On the same continent\" (CONTINENT): if possible, place "
1584 "all players of the same team onto the same "
1585 "island/continent.\n"
1586 "- \"Horizontal placement\" (HORIZONTAL): players of the same "
1587 "team will be placed horizontally.\n"
1588 "- \"Vertical placement\" (VERTICAL): players of the same "
1589 "team will be placed vertically."),
1591
1592 GEN_BOOL("tinyisles", wld.map.server.tinyisles,
1593 SSET_MAP_GEN, SSET_GEOLOGY, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
1594 N_("Presence of 1x1 islands"),
1595 N_("This setting controls whether the map generator is allowed "
1596 "to make islands of one only tile size."), NULL, NULL,
1598
1599 GEN_BOOL("separatepoles", wld.map.server.separatepoles,
1600 SSET_MAP_GEN, SSET_GEOLOGY, SSET_SITUATIONAL,
1601 ALLOW_NONE, ALLOW_BASIC,
1602 N_("Whether the poles are separate continents"),
1603 N_("If this setting is disabled, the continents may attach to "
1604 "poles."), NULL, NULL, MAP_DEFAULT_SEPARATE_POLES)
1605
1606 GEN_INT("flatpoles", wld.map.server.flatpoles,
1607 SSET_MAP_GEN, SSET_GEOLOGY, SSET_SITUATIONAL, ALLOW_NONE, ALLOW_BASIC,
1608 N_("How much the land at the poles is flattened"),
1609 /* TRANS: The strings in quotes shouldn't be translated. */
1610 N_("Controls how much the height of the poles is flattened "
1611 "during map generation, preventing a diversity of land "
1612 "terrain there. 0 is no flattening, 100 is maximum "
1613 "flattening. Only affects the 'RANDOM' and 'FRACTAL' "
1614 "map generators."), NULL,
1615 NULL, NULL,
1617
1618 GEN_BOOL("singlepole", wld.map.server.single_pole,
1619 SSET_MAP_GEN, SSET_GEOLOGY, SSET_SITUATIONAL,
1620 ALLOW_NONE, ALLOW_BASIC,
1621 N_("Whether there's just one pole generated"),
1622 N_("If this setting is enabled, only one side of the map will have "
1623 "a pole. This setting has no effect if the map wraps both "
1624 "directions."), NULL, NULL, MAP_DEFAULT_SINGLE_POLE)
1625
1626 GEN_BOOL("alltemperate", wld.map.server.alltemperate,
1627 SSET_MAP_GEN, SSET_GEOLOGY, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
1628 N_("All the map is temperate"),
1629 N_("If this setting is enabled, the temperature will be "
1630 "equivalent everywhere on the map. As a result, the "
1631 "poles won't be generated."),
1632 NULL, NULL, MAP_DEFAULT_ALLTEMPERATE)
1633
1634 GEN_INT("temperature", wld.map.server.temperature,
1635 SSET_MAP_GEN, SSET_GEOLOGY, SSET_SITUATIONAL,
1636 ALLOW_NONE, ALLOW_BASIC,
1637 N_("Average temperature of the planet"),
1638 N_("Small values will give a cold map, while larger values will "
1639 "give a hotter map.\n"
1640 "\n"
1641 "100 means a very dry and hot planet with no polar arctic "
1642 "zones, only tropical and dry zones.\n"
1643 " 70 means a hot planet with little polar ice.\n"
1644 " 50 means a temperate planet with normal polar, cold, "
1645 "temperate, and tropical zones; a desert zone overlaps "
1646 "tropical and temperate zones.\n"
1647 " 30 means a cold planet with small tropical zones.\n"
1648 " 0 means a very cold planet with large polar zones and no "
1649 "tropics."),
1650 NULL, NULL, NULL,
1652
1653 GEN_INT("landmass", wld.map.server.landpercent,
1654 SSET_MAP_GEN, SSET_GEOLOGY, SSET_SITUATIONAL,
1655 ALLOW_NONE, ALLOW_BASIC,
1656 N_("Percentage of the map that is land"),
1657 N_("This setting gives the approximate percentage of the map "
1658 "that will be made into land."), NULL, NULL, NULL,
1660
1661 GEN_INT("steepness", wld.map.server.steepness,
1662 SSET_MAP_GEN, SSET_GEOLOGY, SSET_SITUATIONAL,
1663 ALLOW_NONE, ALLOW_BASIC,
1664 N_("Amount of hills/mountains"),
1665 N_("Small values give flat maps, while higher values give a "
1666 "steeper map with more hills and mountains."),
1667 NULL, NULL, NULL,
1669
1670 GEN_INT("wetness", wld.map.server.wetness,
1671 SSET_MAP_GEN, SSET_GEOLOGY, SSET_SITUATIONAL,
1672 ALLOW_NONE, ALLOW_BASIC,
1673 N_("Amount of water on landmasses"),
1674 N_("Small values mean lots of dry, desert-like land; "
1675 "higher values give a wetter map with more swamps, "
1676 "jungles, and rivers."), NULL, NULL, NULL,
1678
1679 GEN_BOOL("globalwarming", game.info.global_warming,
1680 SSET_RULES, SSET_GEOLOGY, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1681 N_("Global warming"),
1682 N_("If turned off, global warming will not occur "
1683 "as a result of pollution. This setting does not "
1684 "affect pollution."), NULL, NULL,
1686
1687 GEN_INT("globalwarming_percent", game.server.global_warming_percent,
1688 SSET_RULES, SSET_GEOLOGY, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1689 N_("Global warming percent"),
1690 N_("This is a multiplier for the rate of accumulation of global "
1691 "warming."), NULL, NULL, NULL,
1695
1696 GEN_BOOL("nuclearwinter", game.info.nuclear_winter,
1697 SSET_RULES, SSET_GEOLOGY, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1698 N_("Nuclear winter"),
1699 N_("If turned off, nuclear winter will not occur "
1700 "as a result of nuclear war."), NULL, NULL,
1702
1703 GEN_INT("nuclearwinter_percent", game.server.nuclear_winter_percent,
1704 SSET_RULES, SSET_GEOLOGY, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1705 N_("Nuclear winter percent"),
1706 N_("This is a multiplier for the rate of accumulation of nuclear "
1707 "winter."), NULL, NULL, NULL,
1711
1712 GEN_INT("mapseed", wld.map.server.seed_setting,
1713 SSET_MAP_GEN, SSET_INTERNAL, SSET_RARE,
1714#ifdef FREECIV_WEB
1715 ALLOW_NONE, ALLOW_BASIC,
1716#else /* FREECIV_WEB */
1717 ALLOW_HACK, ALLOW_HACK,
1718#endif /* FREECIV_WEB */
1719 N_("Map generation random seed"),
1720 N_("The same seed will always produce the same map; "
1721 "for zero (the default) a seed will be generated randomly, "
1722 "based on gameseed. If also gameseed is zero, "
1723 "the map will be completely random."),
1724 NULL, NULL, NULL,
1726
1727 /* Map additional stuff: huts and specials. gameseed also goes here
1728 * because huts and specials are the first time the gameseed gets used (?)
1729 * These are done when the game starts, so these are historical and
1730 * fixed after the game has started.
1731 */
1732 GEN_INT("gameseed", game.server.seed_setting,
1733 SSET_MAP_ADD, SSET_INTERNAL, SSET_RARE,
1734#ifdef FREECIV_WEB
1735 ALLOW_NONE, ALLOW_BASIC,
1736#else /* FREECIV_WEB */
1737 ALLOW_HACK, ALLOW_HACK,
1738#endif /* FREECIV_WEB */
1739 N_("Game random seed"),
1740 N_("For zero (the default) a seed will be chosen based "
1741 "on system entropy or, failing that, the current time."),
1742 NULL, NULL, NULL,
1744
1745 GEN_INT("specials", wld.map.server.riches,
1746 SSET_MAP_ADD, SSET_GEOLOGY, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1747 N_("Amount of \"special\" resource tiles"),
1748 N_("Special resources improve the basic terrain type they "
1749 "are on. The server variable's scale is parts per "
1750 "thousand."), NULL, NULL, NULL,
1752
1753 GEN_INT("huts", wld.map.server.huts,
1754 SSET_MAP_ADD, SSET_GEOLOGY, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1755 N_("Amount of huts (bonus extras)"),
1756 N_("Huts are tile extras that usually may be investigated by "
1757 "units. "
1758 "The server variable's scale is huts per thousand tiles."),
1759 huts_help, NULL, huts_action,
1761
1762 GEN_INT("animals", wld.map.server.animals,
1763 SSET_MAP_ADD, SSET_GEOLOGY, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1764 N_("Amount of animals"),
1765 N_("Number of animals initially created on terrains "
1766 "defined for them in the ruleset (if the ruleset supports it). "
1767 "The server variable's scale is animals per "
1768 "thousand tiles."), NULL, NULL, NULL,
1770
1771 /* Options affecting numbers of players and AI players. These only
1772 * affect the start of the game and can not be adjusted after that.
1773 */
1774 GEN_INT("minplayers", game.server.min_players,
1775 SSET_PLAYERS, SSET_INTERNAL, SSET_VITAL,
1776 ALLOW_NONE, ALLOW_BASIC,
1777 N_("Minimum number of players"),
1778 N_("There must be at least this many players (connected "
1779 "human players) before the game can start."),
1780 NULL, NULL, NULL,
1782
1783 GEN_INT("maxplayers", game.server.max_players,
1784 SSET_PLAYERS_CHANGEABLE, SSET_INTERNAL, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1785 N_("Maximum number of players"),
1786 N_("The maximal number of human and AI players who can be in "
1787 "the game. When this number of players are connected in "
1788 "the pregame state, any new players who try to connect "
1789 "will be rejected.\n"
1790 "When playing a scenario which defines player start positions, "
1791 "this setting cannot be set to greater than the number of "
1792 "defined start positions."),
1793 NULL, maxplayers_callback, NULL,
1795
1796 GEN_INT("aifill", game.info.aifill,
1797 SSET_PLAYERS, SSET_INTERNAL, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1798 N_("Limited number of AI players"),
1799 N_("If set to a positive value, then AI players will be "
1800 "automatically created or removed to keep the total "
1801 "number of players at this amount. As more players join, "
1802 "these AI players will be replaced. When set to zero, "
1803 "all AI players will be removed."),
1804 NULL, NULL, aifill_action,
1806
1807 GEN_ENUM("persistentready", game.info.persistent_ready,
1808 SSET_META, SSET_NETWORK, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
1809 N_("When the Readiness of a player gets autotoggled off"),
1810 N_("In pre-game, usually when new players join or old ones leave, "
1811 "those who have already accepted game to start by toggling \"Ready\" "
1812 "get that autotoggled off in the changed situation. This setting "
1813 "can be used to make readiness more persistent."),
1815
1816 GEN_STRING("nationset", game.server.nationset,
1817 SSET_PLAYERS, SSET_INTERNAL, SSET_RARE,
1818 ALLOW_NONE, ALLOW_BASIC,
1819 N_("Set of nations to choose from"),
1820 /* TRANS: do not translate '/list nationsets' */
1821 N_("Controls the set of nations allowed in the game. The "
1822 "choices are defined by the ruleset.\n"
1823 "Only nations in the set selected here will be allowed in "
1824 "any circumstances, including new players and civil war; "
1825 "small sets may thus limit the number of players in a game.\n"
1826 "If this is left blank, the ruleset's default nation set is "
1827 "used.\n"
1828 "See '/list nationsets' for possible choices for the "
1829 "currently loaded ruleset."),
1831
1832 GEN_INT("ec_turns", game.server.event_cache.turns,
1833 SSET_META, SSET_INTERNAL, SSET_SITUATIONAL,
1834 ALLOW_NONE, ALLOW_BASIC,
1835 N_("Event cache for this number of turns"),
1836 N_("Event messages are saved for this number of turns. A value of "
1837 "0 deactivates the event cache."),
1840
1841 GEN_INT("ec_max_size", game.server.event_cache.max_size,
1842 SSET_META, SSET_INTERNAL, SSET_SITUATIONAL,
1843 ALLOW_NONE, ALLOW_BASIC,
1844 N_("Size of the event cache"),
1845 N_("This defines the maximal number of events in the event cache."),
1846 NULL, NULL, NULL, GAME_MIN_EVENT_CACHE_MAX_SIZE,
1848
1849 GEN_BOOL("ec_chat", game.server.event_cache.chat,
1850 SSET_META, SSET_INTERNAL, SSET_SITUATIONAL,
1851 ALLOW_NONE, ALLOW_BASIC,
1852 N_("Save chat messages in the event cache"),
1853 N_("If turned on, chat messages will be saved in the event "
1854 "cache."), NULL, NULL, GAME_DEFAULT_EVENT_CACHE_CHAT)
1855
1856 GEN_BOOL("ec_info", game.server.event_cache.info,
1857 SSET_META, SSET_INTERNAL, SSET_SITUATIONAL,
1858 ALLOW_NONE, ALLOW_BASIC,
1859 N_("Print turn and time for each cached event"),
1860 /* TRANS: Don't translate the text between single quotes. */
1861 N_("If turned on, all cached events will be marked by the turn "
1862 "and time of the event like '(T2 - 15:29:52)'."),
1864
1865 /* Game initialization parameters (only affect the first start of the game,
1866 * and not reloads). Can not be changed after first start of game.
1867 */
1868 GEN_STRING("startunits", game.server.start_units,
1869 SSET_GAME_INIT, SSET_SOCIOLOGY, SSET_VITAL,
1870 ALLOW_NONE, ALLOW_BASIC,
1871 N_("List of players' initial units"),
1872 N_("This should be a string of characters, each of which "
1873 "specifies a unit role. The first character must be native to "
1874 "at least one \"Starter\" terrain. The characters and their "
1875 "meanings are:\n"
1876 " c = City founder (eg., Settlers)\n"
1877 " w = Terrain worker (eg., Engineers)\n"
1878 " x = Explorer (eg., Explorer)\n"
1879 " k = Gameloss (eg., King)\n"
1880 " s = Diplomat (eg., Diplomat)\n"
1881 " f = Ferryboat (eg., Trireme)\n"
1882 " d = Ok defense unit (eg., Warriors)\n"
1883 " D = Good defense unit (eg., Phalanx)\n"
1884 " a = Fast attack unit (eg., Horsemen)\n"
1885 " A = Strong attack unit (eg., Catapult)\n"),
1887
1888 GEN_BOOL("startcity", game.server.start_city,
1889 SSET_GAME_INIT, SSET_SOCIOLOGY, SSET_VITAL,
1890 ALLOW_NONE, ALLOW_BASIC,
1891 N_("Whether player starts with a city"),
1892 N_("If this is set, game will start with player's first "
1893 "city already founded to starting location."),
1894 NULL, NULL, GAME_DEFAULT_START_CITY)
1895
1896 GEN_INT("dispersion", game.server.dispersion,
1897 SSET_GAME_INIT, SSET_SOCIOLOGY, SSET_SITUATIONAL,
1898 ALLOW_NONE, ALLOW_BASIC,
1899 N_("Area where initial units are located"),
1900 N_("This is the radius within "
1901 "which the initial units are dispersed."),
1902 NULL, NULL, NULL,
1904
1905 GEN_INT("gold", game.info.gold,
1906 SSET_GAME_INIT, SSET_ECONOMICS, SSET_VITAL,
1907 ALLOW_NONE, ALLOW_BASIC,
1908 N_("Starting gold per player"),
1909 N_("At the beginning of the game, each player is given this "
1910 "much gold."), NULL, NULL, NULL,
1912
1913 GEN_INT("infrapoints", game.info.infrapoints,
1914 SSET_GAME_INIT, SSET_ECONOMICS, SSET_VITAL,
1915 ALLOW_NONE, ALLOW_BASIC,
1916 N_("Starting infrapoints per player"),
1917 N_("At the beginning of the game, each player is given this "
1918 "many infrapoints."), NULL, NULL, NULL,
1920
1921 GEN_INT("techlevel", game.info.tech,
1922 SSET_GAME_INIT, SSET_SCIENCE, SSET_VITAL,
1923 ALLOW_NONE, ALLOW_BASIC,
1924 N_("Number of initial techs per player"),
1925 /* TRANS: The string between single quotes is a setting name and
1926 * should not be translated. */
1927 N_("At the beginning of the game, each player is given this "
1928 "many technologies. The technologies chosen are random for "
1929 "each player. Depending on the value of tech_cost_style in "
1930 "the ruleset, a big value for 'techlevel' can make the next "
1931 "techs really expensive."), NULL, NULL, NULL,
1933
1934 GEN_INT("sciencebox", game.info.sciencebox,
1935 SSET_RULES_SCENARIO, SSET_SCIENCE, SSET_SITUATIONAL,
1936 ALLOW_NONE, ALLOW_BASIC,
1937 N_("Technology cost multiplier percentage"),
1938 N_("This affects how quickly players can research new "
1939 "technology. All tech costs are multiplied by this amount "
1940 "(as a percentage). The base tech costs are determined by "
1941 "the ruleset or other game settings."),
1942 NULL, NULL, NULL, GAME_MIN_SCIENCEBOX, GAME_MAX_SCIENCEBOX,
1944
1945 GEN_BOOL("multiresearch", game.server.multiresearch,
1946 SSET_RULES, SSET_SCIENCE, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
1947 N_("Allow researching multiple technologies"),
1948 N_("Allows switching to any technology without wasting old "
1949 "research. Bulbs are never transferred to new technology. "
1950 "Techpenalty options are ineffective after enabling that "
1951 "option."), NULL, NULL,
1953
1954 GEN_INT("techpenalty", game.server.techpenalty,
1955 SSET_RULES, SSET_SCIENCE, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
1956 N_("Percentage penalty when changing tech"),
1957 N_("If you change your current research technology, and you have "
1958 "positive research points, you lose this percentage of those "
1959 "research points. This does not apply when you have just gained "
1960 "a technology this turn."), NULL, NULL, NULL,
1963
1964 GEN_INT("techlost_recv", game.server.techlost_recv,
1965 SSET_RULES, SSET_SCIENCE, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
1966 N_("Chance to lose a technology while receiving it"),
1967 N_("The chance that learning a technology by treaty or theft "
1968 "will fail."),
1971
1972 GEN_INT("techlost_donor", game.server.techlost_donor,
1973 SSET_RULES, SSET_SCIENCE, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
1974 N_("Chance to lose a technology while giving it"),
1975 N_("The chance that your civilization will lose a technology if "
1976 "you teach it to someone else by treaty, or if it is stolen "
1977 "from you."),
1980
1981 GEN_INT("techleak", game.info.tech_leak_pct,
1982 SSET_RULES, SSET_SCIENCE, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
1983 N_("Tech leakage percent"),
1984 N_("The rate of the tech leakage. This multiplied by the "
1985 "percentage of players who know the tech tell which "
1986 "percentage of tech's bulb cost gets leaked each turn. "
1987 "This setting has no effect if the ruleset has disabled "
1988 "tech leakage."),
1989 NULL, NULL, NULL, GAME_MIN_TECHLEAK, GAME_MAX_TECHLEAK,
1991
1992 GEN_BOOL("team_pooled_research", game.info.team_pooled_research,
1993 SSET_RULES, SSET_SCIENCE, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
1994 N_("Team pooled research"),
1995 N_("If this setting is turned on, then the team mates will share "
1996 "the science research. Else, every player of the team will "
1997 "have to make its own."),
1999
2000 GEN_INT("diplbulbcost", game.server.diplbulbcost,
2001 SSET_RULES, SSET_SCIENCE, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2002 N_("Penalty when getting tech from treaty"),
2003 N_("For each technology you gain from a diplomatic treaty, you "
2004 "lose research points equal to this percentage of the cost to "
2005 "research a new technology. If this is non-zero, you can end up "
2006 "with negative research points."),
2007 NULL, NULL, NULL,
2009
2010 GEN_INT("diplgoldcost", game.server.diplgoldcost,
2011 SSET_RULES, SSET_SCIENCE, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2012 N_("Penalty when getting gold from treaty"),
2013 N_("When transferring gold in diplomatic treaties, this percentage "
2014 "of the agreed sum is lost to both parties; it is deducted from "
2015 "the donor but not received by the recipient."),
2016 NULL, NULL, NULL,
2018
2019 GEN_INT("incite_gold_loss_chance", game.server.incite_gold_loss_chance,
2020 SSET_RULES, SSET_SCIENCE, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2021 N_("Probability of gold loss during inciting revolt"),
2022 N_("When unit trying to incite revolt is eliminated, half of the gold "
2023 "(or quarter, if unit was caught), prepared to bribe citizens, "
2024 "can be lost or captured by enemy."),
2025 NULL, NULL, NULL,
2028
2029 GEN_INT("incite_gold_capt_chance", game.server.incite_gold_capt_chance,
2030 SSET_RULES, SSET_SCIENCE, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2031 N_("Probability of gold capture during inciting revolt"),
2032 N_("When unit trying to incite revolt is eliminated and lose its "
2033 "gold, there is chance that this gold would be captured by "
2034 "city defender. Transfer tax would be applied, though. "
2035 "This setting is irrelevant, if incite_gold_loss_chance is zero."),
2036 NULL, NULL, NULL,
2039
2040 GEN_INT("conquercost", game.server.conquercost,
2041 SSET_RULES, SSET_SCIENCE, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2042 N_("Penalty when getting tech from conquering"),
2043 N_("For each technology you gain by conquering an enemy city, you "
2044 "lose research points equal to this percentage of the cost to "
2045 "research a new technology. If this is non-zero, you can end up "
2046 "with negative research points."),
2047 NULL, NULL, NULL,
2050
2051 GEN_INT("freecost", game.server.freecost,
2052 SSET_RULES, SSET_SCIENCE, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2053 N_("Penalty when getting a free tech"),
2054 /* TRANS: The strings between single quotes are setting names and
2055 * shouldn't be translated. */
2056 N_("For each technology you gain \"for free\" (other than "
2057 "covered by 'diplcost' or 'conquercost': for instance, from huts "
2058 "or from Great Library effects), you lose research points "
2059 "equal to this percentage of the cost to research a new "
2060 "technology. If this is non-zero, you can end up "
2061 "with negative research points."),
2062 NULL, NULL, NULL,
2064
2065 GEN_INT("techlossforgiveness", game.info.techloss_forgiveness,
2066 SSET_RULES, SSET_SCIENCE, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2067 N_("Research point debt threshold for losing tech"),
2068 N_("When you have negative research points, and your shortfall is "
2069 "greater than this percentage of the cost of your current "
2070 "research, you forget a technology you already knew.\n"
2071 "The special value -1 prevents loss of technology regardless of "
2072 "research points."),
2073 NULL, NULL, NULL,
2076
2077 GEN_INT("techlossrestore", game.server.techloss_restore,
2078 SSET_RULES, SSET_SCIENCE, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2079 N_("Research points restored after losing a tech"),
2080 N_("When you lose a technology due to a negative research balance "
2081 "(see 'techlossforgiveness'), this percentage of its research "
2082 "cost is credited to your research balance (this may not be "
2083 "sufficient to make it positive).\n"
2084 "The special value -1 means that your research balance is always "
2085 "restored to zero, regardless of your previous shortfall."),
2086 NULL, NULL, NULL,
2089
2090 GEN_INT("foodbox", game.info.foodbox,
2091 SSET_RULES, SSET_ECONOMICS, SSET_SITUATIONAL,
2092 ALLOW_NONE, ALLOW_BASIC,
2093 N_("Food required for a city to grow"),
2094 N_("This is the base amount of food required to grow a city. "
2095 "This value is multiplied by another factor that comes from "
2096 "the ruleset and is dependent on the size of the city."),
2097 NULL, NULL, NULL,
2099
2100 GEN_INT("aqueductloss", game.server.aqueductloss,
2101 SSET_RULES, SSET_ECONOMICS, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2102 N_("Percentage food lost when city can't grow"),
2103 N_("If a city would expand, but it can't because it lacks some "
2104 "prerequisite (traditionally an Aqueduct or Sewer System), "
2105 "this is the base percentage of its foodbox that is lost "
2106 "each turn; the penalty may be reduced by buildings or other "
2107 "circumstances, depending on the ruleset."),
2108 NULL, NULL, NULL,
2111
2112 GEN_INT("shieldbox", game.info.shieldbox,
2113 SSET_RULES, SSET_ECONOMICS, SSET_SITUATIONAL,
2114 ALLOW_NONE, ALLOW_BASIC,
2115 N_("Multiplier percentage for production costs"),
2116 N_("This affects how quickly units and buildings can be "
2117 "produced. The base costs are multiplied by this value (as "
2118 "a percentage)."),
2119 NULL, NULL, NULL,
2121
2122 /* Notradesize and fulltradesize used to have callbacks to prevent them
2123 * from being set illegally (notradesize > fulltradesize). However this
2124 * provided a problem when setting them both through the client's settings
2125 * dialog, since they cannot both be set atomically. So the callbacks were
2126 * removed and instead the game now knows how to deal with invalid
2127 * settings. */
2128 GEN_INT("fulltradesize", game.info.fulltradesize,
2129 SSET_RULES, SSET_ECONOMICS, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2130 N_("Minimum city size to get full trade"),
2131 /* TRANS: The strings between single quotes are setting names and
2132 * shouldn't be translated. */
2133 N_("There is a trade penalty in all cities smaller than this. "
2134 "The penalty is 100% (no trade at all) for sizes up to "
2135 "'notradesize', and decreases gradually to 0% (no penalty "
2136 "except the normal corruption) for size='fulltradesize'. "
2137 "See also 'notradesize'."), NULL, NULL, NULL,
2140
2141 GEN_INT("notradesize", game.info.notradesize,
2142 SSET_RULES, SSET_ECONOMICS, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2143 N_("Maximum size of a city without trade"),
2144 /* TRANS: The strings between single quotes are setting names and
2145 * shouldn't be translated. */
2146 N_("Cities do not produce any trade at all unless their size "
2147 "is larger than this amount. The produced trade increases "
2148 "gradually for cities larger than 'notradesize' and smaller "
2149 "than 'fulltradesize'. See also 'fulltradesize'."),
2150 NULL, NULL, NULL,
2153
2154 GEN_INT("tradeworldrelpct", game.info.trade_world_rel_pct,
2155 SSET_RULES, SSET_ECONOMICS, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2156 N_("How largely trade distance is relative to world size"),
2157 /* TRANS: The strings between single quotes are setting names and
2158 * shouldn't be translated. */
2159 N_("When determining trade between cities, the distance factor "
2160 "can be partly or fully relative to world size. This setting "
2161 "determines how big percentage of the bonus calculation is "
2162 "relative to world size, and how much only absolute distance "
2163 "matters."),
2164 NULL, NULL, NULL,
2167
2168 GEN_INT("citymindist", game.info.citymindist,
2169 SSET_RULES, SSET_SOCIOLOGY, SSET_SITUATIONAL,
2170 ALLOW_NONE, ALLOW_BASIC,
2171 N_("Minimum distance between cities"),
2172 N_("When a player attempts to found a new city, it is prevented "
2173 "if the distance from any existing city is less than this "
2174 "setting. For example, when this setting is 3, there must be "
2175 "at least two clear tiles in any direction between all existing "
2176 "cities and the new city site. A value of 1 removes any such "
2177 "restriction on city placement."),
2178 NULL, NULL, NULL,
2181
2182 GEN_BOOL("trading_tech", game.info.trading_tech,
2183 SSET_RULES, SSET_SOCIOLOGY, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2184 N_("Technology trading"),
2185 N_("If turned off, trading technologies in the diplomacy dialog "
2186 "is not allowed."), NULL, NULL,
2188
2189 GEN_BOOL("trading_gold", game.info.trading_gold,
2190 SSET_RULES, SSET_SOCIOLOGY, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2191 N_("Gold trading"),
2192 N_("If turned off, trading gold in the diplomacy dialog "
2193 "is not allowed."), NULL, NULL,
2195
2196 GEN_BOOL("trading_city", game.info.trading_city,
2197 SSET_RULES, SSET_SOCIOLOGY, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2198 N_("City trading"),
2199 N_("If turned off, trading cities in the diplomacy dialog "
2200 "is not allowed."), NULL, NULL,
2202
2203 GEN_ENUM("caravan_bonus_style", game.info.caravan_bonus_style,
2204 SSET_RULES, SSET_ECONOMICS, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2205 N_("Caravan bonus style"),
2206 N_("The formula for the bonus when a caravan enters a city. "
2207 "CLASSIC bonuses are proportional to distance and trade "
2208 "of source and destination with multipliers for overseas and "
2209 "international destinations. LOGARITHMIC bonuses are "
2210 "proportional to log^2(distance + trade)."),
2211 NULL, NULL, NULL, caravanbonusstyle_name,
2213
2214 GEN_ENUM("trade_revenue_style", game.info.trade_revenue_style,
2215 SSET_RULES, SSET_ECONOMICS, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2216 N_("Trade revenue style"),
2217 N_("The formula for the trade a city receives from a trade route. "
2218 "CLASSIC revenues are given by the sum of the two city sizes "
2219 "plus the distance between them, with multipliers for overseas "
2220 "and international routes. "
2221 "SIMPLE revenues are proportional to the average trade of the "
2222 "two cities."),
2223 NULL, NULL, NULL, traderevenuestyle_name,
2225
2226 GEN_INT("trademindist", game.info.trademindist,
2227 SSET_RULES, SSET_ECONOMICS, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2228 N_("Minimum distance for trade routes"),
2229 N_("In order for two cities in the same civilization to establish "
2230 "a trade route, they must be at least this far apart on the "
2231 "map. For square grids, the distance is calculated as "
2232 "\"Manhattan distance\", that is, the sum of the displacements "
2233 "along the x and y directions."), NULL, NULL, NULL,
2236
2237 GEN_INT("rapturedelay", game.info.rapturedelay,
2238 SSET_RULES, SSET_SOCIOLOGY, SSET_SITUATIONAL,
2239 ALLOW_NONE, ALLOW_BASIC,
2240 N_("Number of turns between rapture effect"),
2241 N_("Sets the number of turns between rapture growth of a city. "
2242 "If set to n a city will grow after celebrating for n+1 "
2243 "turns."),
2244 NULL, NULL, NULL,
2247
2248 GEN_INT("disasters", game.info.disasters,
2249 SSET_RULES_FLEXIBLE, SSET_SOCIOLOGY, SSET_VITAL,
2250 ALLOW_NONE, ALLOW_BASIC,
2251 N_("Frequency of disasters"),
2252 N_("Affects how often random disasters happen to cities, "
2253 "if any are defined by the ruleset. The relative frequency "
2254 "of disaster types is set by the ruleset. Zero prevents "
2255 "any random disasters from occurring."),
2256 NULL, NULL, NULL,
2259
2260 GEN_ENUM("traitdistribution", game.server.trait_dist,
2261 SSET_RULES, SSET_SOCIOLOGY, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2262 N_("AI trait distribution method"),
2263 N_("How trait values are given to AI players."),
2265
2266 GEN_INT("razechance", game.server.razechance,
2267 SSET_RULES, SSET_MILITARY, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2268 N_("Chance for conquered building destruction"),
2269 N_("When a player conquers a city, each city improvement has this "
2270 "percentage chance to be destroyed."), NULL, NULL, NULL,
2272
2273 GEN_INT("occupychance", game.server.occupychance,
2274 SSET_RULES, SSET_MILITARY, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2275 N_("Chance of moving into tile after attack"),
2276 N_("If set to 0, combat is Civ1/2-style (when you attack, "
2277 "you remain in place). If set to 100, attacking units "
2278 "will always move into the tile they attacked when they win "
2279 "the combat (and no enemy units remain in the tile). If "
2280 "set to a value between 0 and 100, this will be used as "
2281 "the percent chance of \"occupying\" territory."),
2282 NULL, NULL, NULL,
2285
2286 GEN_BOOL("autoattack", game.server.autoattack, SSET_RULES_FLEXIBLE, SSET_MILITARY,
2287 SSET_SITUATIONAL, ALLOW_NONE, ALLOW_BASIC,
2288 N_("Turn on/off server-side autoattack"),
2289 N_("If set to on, units with moves left will automatically "
2290 "consider attacking enemy units that move adjacent to them."),
2291 NULL, NULL, GAME_DEFAULT_AUTOATTACK)
2292
2293 GEN_BOOL("killstack", game.info.killstack,
2294 SSET_RULES_SCENARIO, SSET_MILITARY, SSET_RARE,
2295 ALLOW_NONE, ALLOW_BASIC,
2296 N_("Do all units in tile die with defender"),
2297 N_("If this is enabled, each time a defender unit loses in combat, "
2298 "and is not inside a city or suitable base, all units in the same "
2299 "tile are destroyed along with the defender. If this is disabled, "
2300 "only the defender unit is destroyed."),
2301 NULL, NULL, GAME_DEFAULT_KILLSTACK)
2302
2303 GEN_BOOL("killcitizen", game.info.killcitizen,
2304 SSET_RULES, SSET_MILITARY, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2305 N_("Reduce city population after attack"),
2306 N_("This flag indicates whether a city's population is reduced "
2307 "after a successful attack by an enemy unit. If this is "
2308 "disabled, population is never reduced. Even when this is "
2309 "enabled, only some units may kill citizens."),
2310 NULL, NULL, GAME_DEFAULT_KILLCITIZEN)
2311
2312 GEN_INT("killunhomed", game.server.killunhomed,
2313 SSET_RULES, SSET_MILITARY, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2314 N_("Slowly kill units without home cities (e.g., starting units)"),
2315 N_("If greater than 0, then every unit without a homecity will "
2316 "lose hitpoints each turn. The number of hitpoints lost is "
2317 "given by 'killunhomed' percent of the hitpoints of the unit "
2318 "type. At least one hitpoint is lost every turn until the "
2319 "death of the unit."),
2320 NULL, NULL, NULL, GAME_MIN_KILLUNHOMED, GAME_MAX_KILLUNHOMED,
2322
2323 GEN_ENUM("borders", game.info.borders,
2324 SSET_RULES, SSET_MILITARY, SSET_SITUATIONAL,
2325 ALLOW_NONE, ALLOW_BASIC,
2326 N_("National borders"),
2327 N_("If this is not disabled, then any land tiles around a "
2328 "city or border-claiming extra (like the classic ruleset's "
2329 "Fortress base) will be owned by that nation. "
2330 "SEE_INSIDE and EXPAND makes everything inside a player's "
2331 "borders visible at once. ENABLED will, in some rulesets, "
2332 "grant the same visibility if certain conditions are met."),
2333 NULL, NULL, NULL, borders_name, GAME_DEFAULT_BORDERS)
2334
2335 GEN_ENUM("happyborders", game.info.happyborders,
2336 SSET_RULES, SSET_MILITARY, SSET_SITUATIONAL,
2337 ALLOW_NONE, ALLOW_BASIC,
2338 N_("Units inside borders cause no unhappiness"),
2339 N_("If this is set, units will not cause unhappiness when "
2340 "inside your borders, or even allies borders, depending "
2341 "on value."), NULL, NULL, NULL,
2343
2344 GEN_ENUM("diplomacy", game.info.diplomacy,
2345 SSET_RULES, SSET_MILITARY, SSET_SITUATIONAL,
2346 ALLOW_NONE, ALLOW_BASIC,
2347 N_("Ability to do diplomacy with other players"),
2348 N_("This setting controls the ability to do diplomacy with "
2349 "other players."),
2350 NULL, NULL, NULL, diplomacy_name, GAME_DEFAULT_DIPLOMACY)
2351
2353 SSET_RULES, SSET_SOCIOLOGY, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2354 N_("Allowed city names"),
2355 /* TRANS: The strings between double quotes are also translated
2356 * separately (they must match!). The strings between parentheses
2357 * and in uppercase must not be translated. */
2358 N_("- \"No restrictions\" (NO_RESTRICTIONS): players can have "
2359 "multiple cities with the same names.\n"
2360 "- \"Unique to a player\" (PLAYER_UNIQUE): one player can't "
2361 "have multiple cities with the same name.\n"
2362 "- \"Globally unique\" (GLOBAL_UNIQUE): all cities in a game "
2363 "have to have different names.\n"
2364 "- \"No city name stealing\" (NO_STEALING): like "
2365 "\"Globally unique\", but a player isn't allowed to use a "
2366 "default city name of another nation unless it is a default "
2367 "for their nation also."),
2369
2370 GEN_ENUM("plrcolormode", game.server.plrcolormode,
2371 SSET_RULES, SSET_INTERNAL, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2372 N_("How to pick player colors"),
2373 /* TRANS: The strings between double quotes are also translated
2374 * separately (they must match!). The strings between single quotes
2375 * are setting names and shouldn't be translated. The strings
2376 * between parentheses and in uppercase must not be translated. */
2377 N_("This setting determines how player colors are chosen. Player "
2378 "colors are used in the Nations report, for national borders on "
2379 "the map, and so on.\n"
2380 "- \"Per-player, in order\" (PLR_ORDER): colors are assigned to "
2381 "individual players in order from a list defined by the "
2382 "ruleset.\n"
2383 "- \"Per-player, random\" (PLR_RANDOM): colors are assigned "
2384 "to individual players randomly from the set defined by the "
2385 "ruleset.\n"
2386 "- \"Set manually\" (PLR_SET): colors can be set with the "
2387 "'playercolor' command before the game starts; these are not "
2388 "restricted to the ruleset colors. Any players for which no "
2389 "color is set when the game starts get a random color from the "
2390 "ruleset.\n"
2391 "- \"Per-team, in order\" (TEAM_ORDER): colors are assigned to "
2392 "teams from the list in the ruleset. Every player on the same "
2393 "team gets the same color.\n"
2394 "- \"Per-nation, in order\" (NATION_ORDER): if the ruleset "
2395 "defines a color for a player's nation, the player takes that "
2396 "color. Any players whose nations don't have associated colors "
2397 "get a random color from the list in the ruleset.\n"
2398 "Regardless of this setting, individual player colors can be "
2399 "changed after the game starts with the 'playercolor' command."),
2402
2403 /* Flexible rules: these can be changed after the game has started.
2404 *
2405 * The distinction between "rules" and "flexible rules" is not always
2406 * clearcut, and some existing cases may be largely historical or
2407 * accidental. However some generalizations can be made:
2408 *
2409 * -- Low-level game mechanics should not be flexible (eg, rulesets).
2410 * -- Options which would affect the game "state" (city production etc)
2411 * should not be flexible (eg, foodbox).
2412 * -- Options which are explicitly sent to the client (eg, in
2413 * packet_game_info) should probably not be flexible, or at
2414 * least need extra care to be flexible.
2415 */
2416 GEN_ENUM("barbarians", game.server.barbarianrate,
2417 SSET_RULES_FLEXIBLE, SSET_MILITARY, SSET_VITAL,
2418 ALLOW_NONE, ALLOW_BASIC,
2419 N_("Barbarian appearance frequency"),
2420 /* TRANS: The string between single quotes is a setting name and
2421 * should not be translated. */
2422 N_("This setting controls how frequently the barbarians appear "
2423 "in the game. See also the 'onsetbarbs' setting."),
2425
2426 GEN_INT("onsetbarbs", game.server.onsetbarbarian,
2427 SSET_RULES_FLEXIBLE, SSET_MILITARY, SSET_VITAL,
2428 ALLOW_NONE, ALLOW_BASIC,
2429 N_("Barbarian onset turn"),
2430 N_("Barbarians will not appear before this turn."),
2431 NULL, NULL, NULL,
2434
2435 GEN_ENUM("revolentype", game.info.revolentype,
2436 SSET_RULES, SSET_SOCIOLOGY, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2437 N_("Way to determine revolution length"),
2438 N_("Which method is used in determining how long period of anarchy "
2439 "lasts when changing government. The actual value is set with "
2440 "'revolen' setting. The 'quickening' methods depend on how "
2441 "many times any player has changed to this type of government "
2442 "before, so it becomes easier to establish a new system of "
2443 "government if it has been done before."),
2444 NULL, NULL, NULL, revolentype_name, GAME_DEFAULT_REVOLENTYPE)
2445
2447 SSET_RULES_FLEXIBLE, SSET_SOCIOLOGY, SSET_RARE,
2448 ALLOW_NONE, ALLOW_BASIC,
2449 N_("Length of revolution"),
2450 N_("When changing governments, a period of anarchy will occur. "
2451 "Value of this setting, used the way 'revolentype' setting "
2452 "dictates, defines the length of the anarchy."),
2453 NULL, NULL, NULL,
2456
2457 GEN_BOOL("fogofwar", game.info.fogofwar,
2458 SSET_RULES, SSET_MILITARY, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2459 N_("Whether to enable fog of war"),
2460 N_("If this is enabled, only those units and cities within "
2461 "the vision range of your own units and cities will be "
2462 "revealed to you. You will not see new cities or terrain "
2463 "changes in tiles not observed."),
2464 NULL, NULL, GAME_DEFAULT_FOGOFWAR)
2465
2466 GEN_BOOL("foggedborders", game.server.foggedborders,
2467 SSET_RULES, SSET_MILITARY, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2468 N_("Whether fog of war applies to border changes"),
2469 N_("If this setting is enabled, players will not be able "
2470 "to see changes in tile ownership if they do not have "
2471 "direct sight of the affected tiles. Otherwise, players "
2472 "can see any or all changes to borders as long as they "
2473 "have previously seen the tiles."),
2474 NULL, NULL, GAME_DEFAULT_FOGGEDBORDERS)
2475
2476 GEN_BITWISE("airliftingstyle", game.info.airlifting_style,
2477 SSET_RULES_FLEXIBLE, SSET_MILITARY, SSET_SITUATIONAL,
2478 ALLOW_NONE, ALLOW_BASIC, N_("Airlifting style"),
2479 /* TRANS: The strings between double quotes are also
2480 * translated separately (they must match!). The strings
2481 * between parenthesis and in uppercase must not be
2482 * translated. */
2483 N_("This setting affects airlifting units between cities. It "
2484 "can be a set of the following values:\n"
2485 "- \"Allows units to be airlifted from allied cities\" "
2486 "(FROM_ALLIES).\n"
2487 "- \"Allows units to be airlifted to allied cities\" "
2488 "(TO_ALLIES).\n"
2489 "- \"Unlimited units from source city\" (SRC_UNLIMITED): "
2490 "airlifting from a city doesn't reduce the "
2491 "airlifted counter. It depends on the ruleset whether "
2492 "this is possible even with zero airlift capacity.\n"
2493 "- \"Unlimited units to destination city\" "
2494 "(DEST_UNLIMITED): airlifting to a city doesn't "
2495 "reduce the airlifted counter. It depends on the ruleset "
2496 "whether this is possible even with zero airlift capacity."),
2498
2499 GEN_INT("diplchance", game.server.diplchance,
2500 SSET_RULES_FLEXIBLE, SSET_MILITARY, SSET_SITUATIONAL,
2501 ALLOW_NONE, ALLOW_BASIC,
2502 N_("Base chance for diplomats and spies to succeed"),
2503 N_("The base chance of a spy returning from a successful mission and "
2504 "the base chance of success for diplomats and spies for most "
2505 "aggressive mission types. Not all the mission types use diplchance "
2506 "as a base chance – a ruleset can even say that no action at all does. "
2507 "Unit Bribing, and Unit Sabotaging never do. "
2508 "Non-aggressive missions typically have no base chance "
2509 "at all, but always success."),
2510 NULL, NULL, NULL,
2512
2514 SSET_RULES_FLEXIBLE, SSET_INTERNAL, SSET_VITAL,
2515 ALLOW_NONE, ALLOW_BASIC,
2516 N_("What kinds of victories are possible"),
2517 /* TRANS: The strings between double quotes are also translated
2518 * separately (they must match!). The strings between single
2519 * quotes are setting names and shouldn't be translated. The
2520 * strings between parentheses and in uppercase must stay as
2521 * untranslated. */
2522 N_("This setting controls how game can be won. One can always "
2523 "win by conquering entire planet, but other victory conditions "
2524 "can be enabled or disabled:\n"
2525 "- \"Spacerace\" (SPACERACE): Spaceship is built and travels to "
2526 "Alpha Centauri.\n"
2527 "- \"Allied\" (ALLIED): After defeating enemies, all remaining "
2528 "players are allied.\n"
2529 "- \"Culture\" (CULTURE): Player meets ruleset defined cultural "
2530 "domination criteria.\n"),
2532
2534 SSET_SCIENCE, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
2535 N_("Should the game end if the spaceship arrives?"),
2536 N_("If this option is turned on, the game will end with the "
2537 "arrival of a spaceship at Alpha Centauri."),
2538 NULL, NULL, GAME_DEFAULT_END_SPACESHIP)
2539
2540 GEN_INT("spaceship_travel_time", game.server.spaceship_travel_time,
2541 SSET_RULES_FLEXIBLE, SSET_SCIENCE, SSET_VITAL, ALLOW_NONE,
2542 ALLOW_BASIC,
2543 N_("Percentage to multiply spaceship travel time by"),
2544 N_("This percentage is multiplied onto the time it will take for "
2545 "a spaceship to arrive at Alpha Centauri."), NULL, NULL, NULL,
2548
2549 GEN_INT("civilwarsize", game.server.civilwarsize,
2550 SSET_RULES_FLEXIBLE, SSET_SOCIOLOGY, SSET_RARE,
2551 ALLOW_NONE, ALLOW_BASIC,
2552 N_("Minimum number of cities for civil war"),
2553 N_("A civil war is triggered when a player has at least this "
2554 "many cities and the player's capital is captured. If "
2555 "this option is set to the maximum value, civil wars are "
2556 "turned off altogether."), NULL, NULL, NULL,
2559
2560 GEN_BOOL("restrictinfra", game.info.restrictinfra,
2561 SSET_RULES_FLEXIBLE, SSET_MILITARY, SSET_RARE,
2562 ALLOW_NONE, ALLOW_BASIC,
2563 N_("Restrict the use of the infrastructure for enemy units"),
2564 N_("If this option is enabled, the use of roads and rails "
2565 "will be restricted for enemy units."), NULL, NULL,
2567
2568 GEN_BOOL("unreachableprotects", game.info.unreachable_protects,
2569 SSET_RULES_FLEXIBLE, SSET_MILITARY, SSET_RARE,
2570 ALLOW_NONE, ALLOW_BASIC,
2571 N_("Does unreachable unit protect reachable ones"),
2572 N_("This option controls whether tiles with both unreachable "
2573 "and reachable units can be attacked. If disabled, any "
2574 "tile with reachable units can be attacked. If enabled, "
2575 "tiles with an unreachable unit in them cannot be attacked. "
2576 "Some units in some rulesets may override this, never "
2577 "protecting reachable units on their tile."),
2578 NULL, NULL, GAME_DEFAULT_UNRPROTECTS)
2579
2580 GEN_INT("contactturns", game.server.contactturns,
2581 SSET_RULES_FLEXIBLE, SSET_MILITARY, SSET_RARE,
2582 ALLOW_NONE, ALLOW_BASIC,
2583 N_("Turns until player contact is lost"),
2584 N_("Players may meet for diplomacy this number of turns "
2585 "after their units have last met, even when they do not have "
2586 "an embassy. If set to zero, then players cannot meet unless "
2587 "they have an embassy."),
2588 NULL, NULL, NULL,
2591
2592 GEN_BOOL("savepalace", game.server.savepalace,
2593 SSET_RULES_FLEXIBLE, SSET_MILITARY, SSET_RARE,
2594 ALLOW_NONE, ALLOW_BASIC,
2595 N_("Rebuild palace whenever capital is conquered"),
2596 N_("If this is turned on, when the capital is conquered the "
2597 "palace is automatically rebuilt for free in another randomly "
2598 "chosen city. This is significant because the technology "
2599 "requirement for building a palace will be ignored. (In "
2600 "some rulesets, buildings other than the palace are affected "
2601 "by this setting.)"),
2602 NULL, NULL, GAME_DEFAULT_SAVEPALACE)
2603
2604 GEN_BOOL("homecaughtunits", game.server.homecaughtunits,
2605 SSET_RULES_FLEXIBLE, SSET_MILITARY, SSET_RARE,
2606 ALLOW_NONE, ALLOW_BASIC,
2607 N_("Give caught units a homecity"),
2608 /* TRANS: The string between single quotes is a setting name and
2609 * should not be translated. */
2610 N_("If unset, caught units will have no homecity and will be "
2611 "subject to the 'killunhomed' option."),
2612 NULL, NULL, GAME_DEFAULT_HOMECAUGHTUNITS)
2613
2614 GEN_BOOL("naturalcitynames", game.server.natural_city_names,
2615 SSET_RULES_FLEXIBLE, SSET_SOCIOLOGY, SSET_RARE,
2616 ALLOW_NONE, ALLOW_BASIC,
2617 N_("Whether to use natural city names"),
2618 N_("If enabled, the default city names will be determined based "
2619 "on the surrounding terrain."),
2621
2622 GEN_BOOL("migration", game.server.migration,
2623 SSET_RULES_FLEXIBLE, SSET_SOCIOLOGY, SSET_RARE,
2624 ALLOW_NONE, ALLOW_BASIC,
2625 N_("Whether to enable citizen migration"),
2626 /* TRANS: The strings between single quotes are setting names
2627 * and should not be translated. */
2628 N_("This is the master setting that controls whether citizen "
2629 "migration is active in the game. If enabled, citizens may "
2630 "automatically move from less desirable cities to more "
2631 "desirable ones. The \"desirability\" of a given city is "
2632 "calculated from a number of factors. In general larger "
2633 "cities with more income and improvements will be preferred. "
2634 "Citizens will never migrate out of the capital, or cause "
2635 "a wonder to be lost by disbanding a city. A number of other "
2636 "settings control how migration behaves:\n"
2637 " 'mgr_turninterval' - How often citizens try to migrate.\n"
2638 " 'mgr_foodneeded' - Whether destination food is checked.\n"
2639 " 'mgr_distance' - How far citizens will migrate.\n"
2640 " 'mgr_worldchance' - Chance for inter-nation migration.\n"
2641 " 'mgr_nationchance' - Chance for intra-nation migration."),
2642 NULL, NULL, GAME_DEFAULT_MIGRATION)
2643
2644 GEN_INT("mgr_turninterval", game.server.mgr_turninterval,
2645 SSET_RULES_FLEXIBLE, SSET_SOCIOLOGY, SSET_RARE,
2646 ALLOW_NONE, ALLOW_BASIC,
2647 N_("Number of turns between migrations from a city"),
2648 /* TRANS: Do not translate 'migration' setting name. */
2649 N_("This setting controls the number of turns between migration "
2650 "checks for a given city. The interval is calculated from "
2651 "the founding turn of the city. So for example if this "
2652 "setting is 5, citizens will look for a suitable migration "
2653 "destination every five turns from the founding of their "
2654 "current city. Migration will never occur the same turn "
2655 "that a city is built. This setting has no effect unless "
2656 "migration is enabled by the 'migration' setting."),
2657 NULL, NULL, NULL,
2660
2661 GEN_BOOL("mgr_foodneeded", game.server.mgr_foodneeded,
2662 SSET_RULES_FLEXIBLE, SSET_SOCIOLOGY, SSET_RARE,
2663 ALLOW_NONE, ALLOW_BASIC,
2664 N_("Whether migration is limited by food"),
2665 /* TRANS: Do not translate 'migration' setting name. */
2666 N_("If this setting is enabled, citizens will not migrate to "
2667 "cities which would not have enough food to support them. "
2668 "This setting has no effect unless migration is enabled by "
2669 "the 'migration' setting."), NULL, NULL,
2671
2672 GEN_INT("mgr_distance", game.server.mgr_distance,
2673 SSET_RULES_FLEXIBLE, SSET_SOCIOLOGY, SSET_RARE,
2674 ALLOW_NONE, ALLOW_BASIC,
2675 N_("Maximum distance citizens may migrate"),
2676 /* TRANS: Do not translate 'migration' setting name. */
2677 N_("This setting controls how far citizens may look for a "
2678 "suitable migration destination when deciding which city "
2679 "to migrate to. The value is added to the candidate target "
2680 "city's radius and compared to the distance between the "
2681 "two cities. If the distance is lower or equal, migration "
2682 "is possible. (So with a setting of 0, citizens will only "
2683 "consider migrating if their city's center is within the "
2684 "destination city's working radius.) This setting has no "
2685 "effect unless migration is enabled by the 'migration' "
2686 "setting."),
2689
2690 GEN_INT("mgr_nationchance", game.server.mgr_nationchance,
2691 SSET_RULES_FLEXIBLE, SSET_SOCIOLOGY, SSET_RARE,
2692 ALLOW_NONE, ALLOW_BASIC,
2693 N_("Percent probability for migration within the same nation"),
2694 /* TRANS: Do not translate 'migration' setting name. */
2695 N_("This setting controls how likely it is for citizens to "
2696 "migrate between cities owned by the same player. Zero "
2697 "indicates migration will never occur, 100 means that "
2698 "migration will always occur if the citizens find a suitable "
2699 "destination. This setting has no effect unless migration "
2700 "is activated by the 'migration' setting."),
2701 NULL, NULL, NULL,
2704
2705 GEN_INT("mgr_worldchance", game.server.mgr_worldchance,
2706 SSET_RULES_FLEXIBLE, SSET_SOCIOLOGY, SSET_RARE,
2707 ALLOW_NONE, ALLOW_BASIC,
2708 N_("Percent probability for migration between foreign cities"),
2709 /* TRANS: Do not translate 'migration' setting name. */
2710 N_("This setting controls how likely it is for migration "
2711 "to occur between cities owned by different players. "
2712 "Zero indicates migration will never occur, 100 means "
2713 "that citizens will always migrate if they find a suitable "
2714 "destination. This setting has no effect if migration is "
2715 "not enabled by the 'migration' setting."),
2716 NULL, NULL, NULL,
2719
2720 /* Meta options: these don't affect the internal rules of the game, but
2721 * do affect players. Also options which only produce extra server
2722 * "output" and don't affect the actual game.
2723 * ("endturn" is here, and not RULES_FLEXIBLE, because it doesn't
2724 * affect what happens in the game, it just determines when the
2725 * players stop playing and look at the score.)
2726 */
2727 GEN_STRING("allowtake", game.server.allow_take,
2728 SSET_META, SSET_NETWORK, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2729 N_("Players that users are allowed to take"),
2730 /* TRANS: the strings in double quotes are server command names
2731 * and should not be translated. */
2732 N_("This should be a string of characters, each of which "
2733 "specifies a type or status of a civilization (player).\n"
2734 "Clients will only be permitted to take or observe those "
2735 "players which match one of the specified letters. This "
2736 "only affects future uses of the \"take\" or \"observe\" "
2737 "commands; it is not retroactive. The characters and their "
2738 "meanings are:\n"
2739 " o,O = Global observer\n"
2740 " b = Barbarian players\n"
2741 " d = Dead players\n"
2742 " a,A = AI players\n"
2743 " h,H = Human players\n"
2744 "The first description on this list which matches a "
2745 "player is the one which applies. Thus 'd' does not "
2746 "include dead barbarians, 'a' does not include dead AI "
2747 "players, and so on. Upper case letters apply before "
2748 "the game has started, lower case letters afterwards.\n"
2749 "Each character above may be followed by one of the "
2750 "following numbers to allow or restrict the manner "
2751 "of connection:\n"
2752 "(none) = Controller allowed, observers allowed, "
2753 "can displace connections. (Displacing a connection means "
2754 "that you may take over a player, even when another user "
2755 "already controls that player.)\n"
2756 " 1 = Controller allowed, observers allowed, "
2757 "can't displace connections;\n"
2758 " 2 = Controller allowed, no observers allowed, "
2759 "can displace connections;\n"
2760 " 3 = Controller allowed, no observers allowed, "
2761 "can't displace connections;\n"
2762 " 4 = No controller allowed, observers allowed"),
2764
2765 GEN_BOOL("autotoggle", game.server.auto_ai_toggle,
2766 SSET_META, SSET_NETWORK, SSET_SITUATIONAL,
2767 ALLOW_NONE, ALLOW_BASIC,
2768 N_("Whether AI-status toggles with connection"),
2769 N_("If enabled, AI status is turned off when a player "
2770 "connects, and on when a player disconnects."),
2772
2773 GEN_INT("endturn", game.server.end_turn,
2774 SSET_META, SSET_SOCIOLOGY, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
2775 N_("Turn the game ends"),
2776 N_("The game will end at the end of the given turn."),
2777 NULL, endturn_callback, NULL,
2779
2781 SSET_MILITARY, SSET_SITUATIONAL, ALLOW_NONE, ALLOW_BASIC,
2782 N_("Reveal the map"),
2783 /* TRANS: The strings between double quotes are also translated
2784 * separately (they must match!). The strings between single
2785 * quotes are setting names and shouldn't be translated. The
2786 * strings between parentheses and in uppercase must not be
2787 * translated. */
2788 N_("If \"Reveal map at game start\" (START) is set, the "
2789 "initial state of the entire map will be known to all "
2790 "players from the start of the game, although it may "
2791 "still be fogged (depending on the 'fogofwar' setting). "
2792 "If \"Unfog map for dead players\" (DEAD) is set, dead "
2793 "players can see the entire map, if they are alone in "
2794 "their team."),
2796
2797 GEN_INT("timeout", game.info.timeout,
2798 SSET_META, SSET_INTERNAL, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
2799 N_("Maximum seconds per turn"),
2800 /* TRANS: \"Turn Done\" refers to the client button; it is also
2801 * translated separately, the translation should be the same.
2802 * \"timeoutincrease\" is a command name and must not to be
2803 * translated. */
2804 N_("If all players have not hit \"Turn Done\" before this "
2805 "time is up, then the turn ends automatically. Zero "
2806 "means there is no timeout. In servers compiled with "
2807 "debugging, a timeout of -1 sets the autogame test mode. "
2808 "Only connections with hack level access may set the "
2809 "timeout to fewer than 30 seconds. Use this with the "
2810 "command \"timeoutincrease\" to have a dynamic timer. "
2811 "The first turn is treated as a special case and is controlled "
2812 "by the 'first_timeout' setting."),
2815
2816 GEN_INT("first_timeout", game.info.first_timeout,
2817 SSET_META, SSET_INTERNAL, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
2818 N_("First turn timeout"),
2819 /* TRANS: The strings between single quotes are setting names and
2820 * should not be translated. */
2821 N_("If greater than 0, T1 will last for 'first_timeout' seconds.\n"
2822 "If set to 0, T1 will not have a timeout.\n"
2823 "If set to -1, the special treatment of T1 will be disabled.\n"
2824 "See also 'timeout'."),
2828
2829 GEN_INT("timeaddenemymove", game.server.timeoutaddenemymove,
2830 SSET_META, SSET_INTERNAL, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC,
2831 N_("Timeout at least n seconds when enemy moved"),
2832 N_("Any time a unit moves while in sight of an enemy player, "
2833 "the remaining timeout is increased to this value."),
2834 NULL, NULL, NULL,
2836
2837 GEN_INT("unitwaittime", game.server.unitwaittime,
2838 SSET_RULES_FLEXIBLE, SSET_INTERNAL, SSET_VITAL,
2839 ALLOW_NONE, ALLOW_BASIC,
2840 N_("Minimum time between unit actions over turn change"),
2841 /* TRANS: The string between single quotes is a setting name and
2842 * should not be translated. */
2843 N_("This setting gives the minimum amount of time in seconds "
2844 "between unit moves and other significant actions (such as "
2845 "building cities) after a turn change occurs. For example, "
2846 "if this setting is set to 20 and a unit moves 5 seconds "
2847 "before the turn change, it will not be able to move or act "
2848 "in the next turn for at least 15 seconds. This value is "
2849 "limited to a maximum value of 2/3 'timeout'."),
2852
2853 /* This setting points to the "stored" value; changing it won't have
2854 * an effect until the next synchronization point (i.e., the start of
2855 * the next turn). */
2857 SSET_META, SSET_INTERNAL, SSET_SITUATIONAL,
2858 ALLOW_NONE, ALLOW_BASIC,
2859 N_("Control of simultaneous player/team phases"),
2860 N_("This setting controls whether players may make "
2861 "moves at the same time during a turn. Change "
2862 "in setting takes effect next turn."),
2864
2865 GEN_INT("nettimeout", game.server.tcptimeout,
2866 SSET_META, SSET_NETWORK, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2867 N_("Seconds to let a client's network connection block"),
2868 N_("If a network connection is blocking for a time greater than "
2869 "this value, then the connection is closed. Zero "
2870 "means there is no timeout (although connections will be "
2871 "automatically disconnected eventually)."),
2872 NULL, NULL, NULL,
2874
2875 GEN_INT("netwait", game.server.netwait,
2876 SSET_META, SSET_NETWORK, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2877 N_("Max seconds for network buffers to drain"),
2878 N_("The server will wait for up to the value of this "
2879 "parameter in seconds, for all client connection network "
2880 "buffers to unblock. Zero means the server will not "
2881 "wait at all."), NULL, NULL, NULL,
2883
2884 GEN_INT("pingtime", game.server.pingtime,
2885 SSET_META, SSET_NETWORK, SSET_RARE, ALLOW_NONE, ALLOW_BASIC,
2886 N_("Seconds between PINGs"),
2887 N_("The server will poll the clients with a PING request "
2888 "each time this period elapses."), NULL, NULL, NULL,
2890
2891 GEN_INT("pingtimeout", game.server.pingtimeout,
2892 SSET_META, SSET_NETWORK, SSET_RARE,
2893 ALLOW_NONE, ALLOW_BASIC,
2894 N_("Time to cut a client"),
2895 N_("If a client doesn't reply to a PING in this time the "
2896 "client is disconnected."), NULL, NULL, NULL,
2898
2899 GEN_BOOL("iphide", game.server.ip_hide,
2900 SSET_META, SSET_NETWORK, SSET_RARE,
2901 ALLOW_NONE, ALLOW_HACK,
2902 N_("Keep client IP hidden"),
2903 N_("Don't tell client IP address to other clients. Server operator "
2904 "can still see it. Also, changing this setting cannot do anything "
2905 "to the information already sent before."),
2906 NULL, NULL, GAME_DEFAULT_IPHIDE)
2907
2908 GEN_BOOL("turnblock", game.server.turnblock,
2909 SSET_META, SSET_INTERNAL, SSET_SITUATIONAL,
2910 ALLOW_NONE, ALLOW_BASIC,
2911 N_("Turn-blocking game play mode"),
2912 N_("If this is turned on, the game turn is not advanced "
2913 "until all players have finished their turn, including "
2914 "disconnected players."),
2915 NULL, NULL, GAME_DEFAULT_TURNBLOCK)
2916
2917 GEN_BOOL("fixedlength", game.server.fixedlength,
2918 SSET_META, SSET_INTERNAL, SSET_SITUATIONAL,
2919 ALLOW_NONE, ALLOW_BASIC,
2920 N_("Fixed-length turns play mode"),
2921 /* TRANS: \"Turn Done\" refers to the client button; it is also
2922 * translated separately, the translation should be the same. */
2923 N_("If this is turned on the game turn will not advance "
2924 "until the timeout has expired, even after all players "
2925 "have clicked on \"Turn Done\"."),
2926 NULL, NULL, FALSE)
2927
2928 GEN_STRING("demography", game.server.demography,
2929 SSET_META, SSET_INTERNAL, SSET_SITUATIONAL,
2930 ALLOW_NONE, ALLOW_BASIC,
2931 N_("What is in the Demographics report"),
2932 /* TRANS: The strings between double quotes should be
2933 * translated. */
2934 N_("This should be a string of characters, each of which "
2935 "specifies the inclusion of a line of information "
2936 "in the Demographics report.\n"
2937 "The characters and their meanings are:\n"
2938 " N = include Population\n"
2939 " P = include Production\n"
2940 " A = include Land Area\n"
2941 " L = include Literacy\n"
2942 " R = include Research Speed\n"
2943 " S = include Settled Area\n"
2944 " E = include Economics\n"
2945 " M = include Military Service\n"
2946 " O = include Pollution\n"
2947 " C = include Culture\n"
2948 "Additionally, the following characters control whether "
2949 "or not certain columns are displayed in the report:\n"
2950 " q = display \"quantity\" column\n"
2951 " r = display \"rank\" column\n"
2952 " b = display \"best nation\" column\n"
2953 "The order of characters is not significant, but "
2954 "their capitalization is."),
2956
2957 GEN_INT("saveturns", game.server.save_nturns,
2958 SSET_META, SSET_INTERNAL, SSET_VITAL, ALLOW_HACK, ALLOW_HACK,
2959 N_("Turns per auto-save"),
2960 /* TRANS: The string between double quotes is also translated
2961 * separately (it must match!). The string between single
2962 * quotes is a setting name and shouldn't be translated. */
2963 N_("How many turns elapse between automatic game saves. This "
2964 "setting only has an effect when the 'autosaves' setting "
2965 "includes \"New turn\"."), NULL, NULL, NULL,
2967
2968 GEN_INT("savefrequency", game.server.save_frequency,
2969 SSET_META, SSET_INTERNAL, SSET_VITAL, ALLOW_HACK, ALLOW_HACK,
2970 N_("Minutes per auto-save"),
2971 /* TRANS: The string between double quotes is also translated
2972 * separately (it must match!). The string between single
2973 * quotes is a setting name and shouldn't be translated. */
2974 N_("How many minutes elapse between automatic game saves. "
2975 "Unlike other save types, this save is only meant as backup "
2976 "for computer memory, and it always uses the same name, older "
2977 "saves are not kept. This setting only has an effect when the "
2978 "'autosaves' setting includes \"Timer\"."), NULL, NULL, NULL,
2980
2981 GEN_BITWISE("autosaves", game.server.autosaves,
2982 SSET_META, SSET_INTERNAL, SSET_VITAL, ALLOW_HACK, ALLOW_HACK,
2983 N_("Which savegames are generated automatically"),
2984 /* TRANS: The strings between double quotes are also translated
2985 * separately (they must match!). The strings between single
2986 * quotes are setting names and shouldn't be translated. The
2987 * strings between parentheses and in uppercase must stay as
2988 * untranslated. */
2989 N_("This setting controls which autosave types get generated:\n"
2990 "- \"New turn\" (TURN): Save when turn begins, once every "
2991 "'saveturns' turns.\n"
2992 "- \"Game over\" (GAMEOVER): Final save when game ends.\n"
2993 "- \"No player connections\" (QUITIDLE): "
2994 "Save before server restarts due to lack of players.\n"
2995 "- \"Server interrupted\" (INTERRUPT): Save when server "
2996 "quits due to interrupt.\n"
2997 "- \"Timer\" (TIMER): Save every 'savefrequency' minutes."),
2999
3000 GEN_BOOL("threaded_save", game.server.threaded_save,
3001 SSET_META, SSET_INTERNAL, SSET_RARE, ALLOW_HACK, ALLOW_HACK,
3002 N_("Whether to do saving in separate thread"),
3003 /* TRANS: The string between single quotes is a setting name and
3004 * should not be translated. */
3005 N_("If this is turned in, compressing and saving the actual "
3006 "file containing the game situation takes place in "
3007 "the background while game otherwise continues. This way "
3008 "users are not required to wait for the save to finish."),
3009 NULL, NULL, GAME_DEFAULT_THREADED_SAVE)
3010
3012 SSET_META, SSET_INTERNAL, SSET_RARE, ALLOW_HACK, ALLOW_HACK,
3013 N_("Savegame compression level"),
3014 /* TRANS: 'compresstype' setting name should not be translated. */
3015 N_("If non-zero, saved games will be compressed depending on the "
3016 "'compresstype' setting. Larger values will give better "
3017 "compression but take longer."),
3018 NULL, NULL, NULL,
3020
3021 GEN_ENUM("compresstype", game.server.save_compress_type,
3022 SSET_META, SSET_INTERNAL, SSET_RARE, ALLOW_HACK, ALLOW_HACK,
3023 N_("Savegame compression algorithm"),
3024 N_("Compression library to use for savegames."),
3026
3027 GEN_STRING("savename", game.server.save_name,
3028 SSET_META, SSET_INTERNAL, SSET_VITAL, ALLOW_HACK, ALLOW_HACK,
3029 N_("Definition of the save file name"),
3030 /* TRANS: %R, %S, %T and %Y must not be translated. The
3031 * strings (examples and setting names) between single quotes
3032 * neither. The strings between <> should be translated.
3033 * xgettext:no-c-format */
3034 N_("Within the string the following custom formats are "
3035 "allowed:\n"
3036 " %R = <reason>\n"
3037 " %S = <suffix>\n"
3038 " %T = <turn-number>\n"
3039 " %Y = <game-year>\n"
3040 "\n"
3041 "Example: 'freeciv-T%04T-Y%+05Y-%R' => "
3042 "'freeciv-T0100-Y00001-manual'\n"
3043 "\n"
3044 "Be careful to use at least one of %T and %Y, else newer "
3045 "savegames will overwrite old ones. If none of the formats "
3046 "is used '-T%04T-Y%05Y-%R' is appended to the value of "
3047 "'savename'."),
3049
3050 GEN_BOOL("scorelog", game.server.scorelog,
3051 SSET_META, SSET_INTERNAL, SSET_SITUATIONAL,
3052#ifdef FREECIV_WEB
3053 ALLOW_NONE, ALLOW_CTRL,
3054#else /* FREECIV_WEB */
3055 ALLOW_HACK, ALLOW_HACK,
3056#endif /* FREECIV_WEB */
3057 N_("Whether to log player statistics"),
3058 /* TRANS: The string between single quotes is a setting name and
3059 * should not be translated. */
3060 N_("If this is turned on, player statistics are appended to "
3061 "the file defined by the option 'scorefile' every turn. "
3062 "These statistics can be used to create power graphs after "
3063 "the game."), NULL, scorelog_action, GAME_DEFAULT_SCORELOG)
3064
3065 GEN_ENUM("scoreloglevel", game.server.scoreloglevel,
3066 SSET_META, SSET_INTERNAL, SSET_SITUATIONAL,
3067 ALLOW_HACK, ALLOW_HACK,
3068 N_("Scorelog level"),
3069 N_("Whether scores are logged for all players including AIs, "
3070 "or only for human players."), NULL, NULL, NULL,
3072
3073#ifndef FREECIV_WEB
3074 GEN_STRING("scorefile", game.server.scorefile,
3075 SSET_META, SSET_INTERNAL, SSET_SITUATIONAL,
3076 ALLOW_HACK, ALLOW_HACK,
3077 N_("Name for the score log file"),
3078 /* TRANS: Don't translate the string in single quotes. */
3079 N_("The default name for the score log file is "
3080 "'freeciv-score.log'."),
3082#endif /* !FREECIV_WEB */
3083
3084 GEN_INT("maxconnectionsperhost", game.server.maxconnectionsperhost,
3085 SSET_RULES_FLEXIBLE, SSET_NETWORK, SSET_RARE,
3086 ALLOW_NONE, ALLOW_BASIC,
3087 N_("Maximum number of connections to the server per host"),
3088 N_("New connections from a given host will be rejected if "
3089 "the total number of connections from the very same host "
3090 "equals or exceeds this value. A value of 0 means that "
3091 "there is no limit, at least up to the maximum number of "
3092 "connections supported by the server."), NULL, NULL, NULL,
3095
3096 GEN_INT("kicktime", game.server.kick_time,
3097 SSET_RULES_FLEXIBLE, SSET_NETWORK, SSET_RARE,
3098 ALLOW_HACK, ALLOW_HACK,
3099 N_("Time before a kicked user can reconnect"),
3100 /* TRANS: the string in double quotes is a server command name and
3101 * should not be translated */
3102 N_("Gives the time in seconds before a user kicked using the "
3103 "\"kick\" command may reconnect. Changing this setting will "
3104 "affect users kicked in the past."), NULL, NULL, NULL,
3106
3108 SSET_META, SSET_INTERNAL, SSET_RARE, ALLOW_CTRL, ALLOW_CTRL,
3109 N_("Metaserver info line"),
3110 N_("User defined metaserver info line. For most of the time "
3111 "a user defined metamessage will be used instead of an "
3112 "automatically generated message. "
3113 "Set to empty (\"\", not \"empty\") to always use an "
3114 "automatically generated meta server message."),
3116};
3117
3118#undef GEN_BOOL
3119#undef GEN_INT
3120#undef GEN_STRING
3121#undef GEN_ENUM
3122#undef GEN_BITWISE
3123
3124/* The number of settings, not including the END. */
3126
3127/************************************************************************/
3131{
3132 return (0 <= id && id < SETTINGS_NUM ? settings + id : NULL);
3133}
3134
3135/************************************************************************/
3138struct setting *setting_by_name(const char *name)
3139{
3140 fc_assert_ret_val(name, NULL);
3141
3142 settings_iterate(SSET_ALL, pset) {
3143 if (0 == strcmp(name, pset->name)) {
3144 return pset;
3145 }
3147 return NULL;
3148}
3149
3150/************************************************************************/
3153int setting_number(const struct setting *pset)
3154{
3155 fc_assert_ret_val(pset != NULL, -1);
3156 return pset - settings;
3157}
3158
3159/************************************************************************/
3162const char *setting_name(const struct setting *pset)
3163{
3164 return pset->name;
3165}
3166
3167/************************************************************************/
3170const char *setting_short_help(const struct setting *pset)
3171{
3172 return pset->short_help;
3173}
3174
3175/************************************************************************/
3179const char *setting_extra_help(const struct setting *pset, bool constant)
3180{
3181 if (!constant && pset->help_func != NULL) {
3182 return pset->help_func(pset);
3183 }
3184
3185 return _(pset->extra_help);
3186}
3187
3188/************************************************************************/
3191enum sset_type setting_type(const struct setting *pset)
3192{
3193 return pset->stype;
3194}
3195
3196/************************************************************************/
3199enum sset_level setting_level(const struct setting *pset)
3200{
3201 return pset->slevel;
3202}
3203
3204/************************************************************************/
3207enum sset_category setting_category(const struct setting *pset)
3208{
3209 return pset->scategory;
3210}
3211
3212/************************************************************************/
3217static bool setting_is_free_to_change(const struct setting *pset,
3218 char *reject_msg,
3219 size_t reject_msg_len)
3220{
3221 switch (pset->sclass) {
3222 case SSET_MAP_SIZE:
3223 case SSET_MAP_GEN:
3224 /* Only change map options if we don't yet have a map: */
3225 if (map_is_empty()) {
3226 return TRUE;
3227 }
3228
3229 settings_snprintf(reject_msg, reject_msg_len,
3230 _("The setting '%s' can't be modified after the map "
3231 "is fixed."), setting_name(pset));
3232 return FALSE;
3233
3235 /* Like SSET_RULES except that it can be changed before the game starts
3236 * for heavy scenarios. A heavy scenario comes with players. It can
3237 * include cities, units, diplomatic relations and other complex
3238 * state. Make sure that changing a setting can't make the state of a
3239 * heavy scenario illegal if you want to change it from SSET_RULES to
3240 * SSET_RULES_SCENARIO. */
3241
3243 && server_state() == S_S_INITIAL) {
3244 /* Special case detected. */
3245 return TRUE;
3246 }
3247
3248 /* The special case didn't make it legal to change the setting. Don't
3249 * give up. It could still be legal. Fall through so the non special
3250 * cases are checked too. */
3252
3253 case SSET_MAP_ADD:
3254 case SSET_PLAYERS:
3255 case SSET_GAME_INIT:
3256 case SSET_RULES:
3257 /* Only change start params and most rules if we don't yet have a map,
3258 * or if we do have a map but its a scenario one (ie, the game has
3259 * never actually been started).
3260 */
3261 if (map_is_empty() || game.info.is_new_game) {
3262 return TRUE;
3263 }
3264
3265 settings_snprintf(reject_msg, reject_msg_len,
3266 _("The setting '%s' can't be modified after the game "
3267 "has started."), setting_name(pset));
3268 return FALSE;
3269
3272 case SSET_META:
3273 /* These can always be changed: */
3274 return TRUE;
3275 }
3276
3277 log_error("Wrong class variant for setting %s (%d): %d.",
3278 setting_name(pset), setting_number(pset), pset->sclass);
3279 settings_snprintf(reject_msg, reject_msg_len, _("Internal error."));
3280
3281 return FALSE;
3282}
3283
3284/************************************************************************/
3289bool setting_is_changeable(const struct setting *pset,
3290 struct connection *caller, char *reject_msg,
3291 size_t reject_msg_len)
3292{
3293 if (caller
3294 && (caller->access_level < pset->access_level_write)) {
3295 settings_snprintf(reject_msg, reject_msg_len,
3296 _("You are not allowed to change the setting '%s'."),
3297 setting_name(pset));
3298 return FALSE;
3299 }
3300
3301 if (setting_locked(pset)) {
3302 /* setting is locked by the ruleset */
3303 settings_snprintf(reject_msg, reject_msg_len,
3304 _("The setting '%s' is locked by the ruleset."),
3305 setting_name(pset));
3306 return FALSE;
3307 }
3308
3309 return setting_is_free_to_change(pset, reject_msg, reject_msg_len);
3310}
3311
3312/************************************************************************/
3316bool setting_is_visible_at_level(const struct setting *pset,
3317 enum cmdlevel plevel)
3318{
3319 return (plevel >= pset->access_level_read);
3320}
3321
3322/************************************************************************/
3326bool setting_is_visible(const struct setting *pset,
3327 struct connection *caller)
3328{
3329 return (!caller
3330 || setting_is_visible_at_level(pset, caller->access_level));
3331}
3332
3333/************************************************************************/
3339static enum m_pre_result
3341 const char *prefix, int *ind_result,
3342 const char **matches, size_t max_matches,
3343 size_t *pnum_matches)
3344{
3345 const struct sset_val_name *name;
3346 size_t len = strlen(prefix);
3347 size_t num_matches;
3348 int i;
3349
3350 *pnum_matches = 0;
3351
3352 if (0 == len) {
3353 return M_PRE_EMPTY;
3354 }
3355
3356 for (i = 0, num_matches = 0; (name = name_fn(i)); i++) {
3357 if (0 == fc_strncasecmp(name->support, prefix, len)) {
3358 if (strlen(name->support) == len) {
3359 *ind_result = i;
3360 return M_PRE_EXACT;
3361 }
3362 if (num_matches < max_matches) {
3363 matches[num_matches] = name->support;
3364 (*pnum_matches)++;
3365 }
3366 if (0 == num_matches++) {
3367 *ind_result = i;
3368 }
3369 }
3370 }
3371
3372 if (1 == num_matches) {
3373 return M_PRE_ONLY;
3374 } else if (1 < num_matches) {
3375 return M_PRE_AMBIGUOUS;
3376 } else {
3377 return M_PRE_FAIL;
3378 }
3379}
3380
3381/************************************************************************/
3385static bool setting_match_prefix(const val_name_func_t name_fn,
3386 const char *prefix, int *pvalue,
3387 char *reject_msg,
3388 size_t reject_msg_len)
3389{
3390 const char *matches[16];
3391 size_t num_matches;
3392
3393 switch (setting_match_prefix_base(name_fn, prefix, pvalue, matches,
3394 ARRAY_SIZE(matches), &num_matches)) {
3395 case M_PRE_EXACT:
3396 case M_PRE_ONLY:
3397 return TRUE; /* Ok. */
3398 case M_PRE_AMBIGUOUS:
3399 {
3400 struct astring astr = ASTRING_INIT;
3401
3402 fc_assert(2 <= num_matches);
3403 settings_snprintf(reject_msg, reject_msg_len,
3404 _("\"%s\" prefix is ambiguous. Candidates are: %s."),
3405 prefix,
3406 astr_build_and_list(&astr, matches, num_matches));
3407 astr_free(&astr);
3408 }
3409 return FALSE;
3410 case M_PRE_EMPTY:
3411 settings_snprintf(reject_msg, reject_msg_len, _("Missing value."));
3412 return FALSE;
3413 case M_PRE_LONG:
3414 case M_PRE_FAIL:
3415 case M_PRE_LAST:
3416 break;
3417 }
3418
3419 settings_snprintf(reject_msg, reject_msg_len,
3420 _("No match for \"%s\"."), prefix);
3421 return FALSE;
3422}
3423
3424/************************************************************************/
3427static const char *setting_bool_to_str(const struct setting *pset,
3428 bool value, bool pretty,
3429 char *buf, size_t buf_len)
3430{
3431 const struct sset_val_name *name = pset->boolean.name(value);
3432
3433 if (pretty) {
3434 fc_snprintf(buf, buf_len, "%s", Q_(name->pretty));
3435 } else {
3436 fc_strlcpy(buf, name->support, buf_len);
3437 }
3438 return buf;
3439}
3440
3441/************************************************************************/
3448static bool setting_bool_validate_base(const struct setting *pset,
3449 const char *val, int *pint_val,
3450 struct connection *caller,
3451 char *reject_msg,
3452 size_t reject_msg_len)
3453{
3454 char buf[256];
3455
3456 if (SST_BOOL != pset->stype) {
3457 settings_snprintf(reject_msg, reject_msg_len,
3458 _("This setting is not a boolean."));
3459 return FALSE;
3460 }
3461
3462 sz_strlcpy(buf, val);
3464
3465 return (setting_match_prefix(pset->boolean.name, buf, pint_val,
3466 reject_msg, reject_msg_len)
3467 && (NULL == pset->boolean.validate
3468 || pset->boolean.validate(0 != *pint_val, caller, reject_msg,
3469 reject_msg_len)));
3470}
3471
3472/************************************************************************/
3477bool setting_bool_set(struct setting *pset, const char *val,
3478 struct connection *caller, char *reject_msg,
3479 size_t reject_msg_len)
3480{
3481 int int_val;
3482
3483 if (!setting_is_changeable(pset, caller, reject_msg, reject_msg_len)
3484 || !setting_bool_validate_base(pset, val, &int_val, caller,
3485 reject_msg, reject_msg_len)) {
3486 return FALSE;
3487 }
3488
3489 *pset->boolean.pvalue = (0 != int_val);
3490 return TRUE;
3491}
3492
3493/************************************************************************/
3496bool setting_bool_get(struct setting *pset)
3497{
3498 fc_assert(setting_type(pset) == SST_BOOL);
3499
3500 return *pset->boolean.pvalue;
3501}
3502
3503/************************************************************************/
3508bool setting_bool_validate(const struct setting *pset, const char *val,
3509 struct connection *caller, char *reject_msg,
3510 size_t reject_msg_len)
3511{
3512 int int_val;
3513
3514 return setting_bool_validate_base(pset, val, &int_val, caller,
3515 reject_msg, reject_msg_len);
3516}
3517
3518/************************************************************************/
3522static const char *setting_bool_secfile_str(secfile_data_t data, int val)
3523{
3524 const struct sset_val_name *name =
3525 ((const struct setting *) data)->boolean.name(val);
3526
3527 return (NULL != name ? name->support : NULL);
3528}
3529
3530/************************************************************************/
3533static const char *setting_int_to_str(const struct setting *pset,
3534 int value, bool pretty,
3535 char *buf, size_t buf_len)
3536{
3537 fc_snprintf(buf, buf_len, "%d", value);
3538 return buf;
3539}
3540
3541/************************************************************************/
3544int setting_int_min(const struct setting *pset)
3545{
3546 fc_assert_ret_val(pset->stype == SST_INT, 0);
3547 return pset->integer.min_value;
3548}
3549
3550/************************************************************************/
3553int setting_int_max(const struct setting *pset)
3554{
3555 fc_assert_ret_val(pset->stype == SST_INT, 0);
3556 return pset->integer.max_value;
3557}
3558
3559/************************************************************************/
3563bool setting_int_set(struct setting *pset, int val,
3564 struct connection *caller, char *reject_msg,
3565 size_t reject_msg_len)
3566{
3567 if (!setting_is_changeable(pset, caller, reject_msg, reject_msg_len)
3568 || !setting_int_validate(pset, val, caller, reject_msg,
3569 reject_msg_len)) {
3570 return FALSE;
3571 }
3572
3573 *pset->integer.pvalue = val;
3574 return TRUE;
3575}
3576
3577/************************************************************************/
3583bool setting_int_validate(const struct setting *pset, int val,
3584 struct connection *caller, char *reject_msg,
3585 size_t reject_msg_len)
3586{
3587 if (SST_INT != pset->stype) {
3588 settings_snprintf(reject_msg, reject_msg_len,
3589 _("This setting is not an integer."));
3590 return FALSE;
3591 }
3592
3593 if (val < pset->integer.min_value || val > pset->integer.max_value) {
3594 settings_snprintf(reject_msg, reject_msg_len,
3595 _("Value out of range: %d (min: %d; max: %d)."),
3596 val, pset->integer.min_value, pset->integer.max_value);
3597 return FALSE;
3598 }
3599
3600 return (!pset->integer.validate
3601 || pset->integer.validate(val, caller, reject_msg,
3602 reject_msg_len));
3603}
3604
3605/************************************************************************/
3608int setting_int_get(struct setting *pset)
3609{
3610 fc_assert(setting_type(pset) == SST_INT);
3611
3612 return *pset->integer.pvalue;
3613}
3614
3615/************************************************************************/
3618static const char *setting_str_to_str(const struct setting *pset,
3619 const char *value, bool pretty,
3620 char *buf, size_t buf_len)
3621{
3622 if (pretty) {
3623 fc_snprintf(buf, buf_len, "\"%s\"", value);
3624 } else {
3625 fc_strlcpy(buf, value, buf_len);
3626 }
3627 return buf;
3628}
3629
3630/************************************************************************/
3634bool setting_str_set(struct setting *pset, const char *val,
3635 struct connection *caller, char *reject_msg,
3636 size_t reject_msg_len)
3637{
3638 if (!setting_is_changeable(pset, caller, reject_msg, reject_msg_len)
3639 || !setting_str_validate(pset, val, caller, reject_msg,
3640 reject_msg_len)) {
3641 return FALSE;
3642 }
3643
3644 fc_strlcpy(pset->string.value, val, pset->string.value_size);
3645 return TRUE;
3646}
3647
3648/************************************************************************/
3654bool setting_str_validate(const struct setting *pset, const char *val,
3655 struct connection *caller, char *reject_msg,
3656 size_t reject_msg_len)
3657{
3658 if (SST_STRING != pset->stype) {
3659 settings_snprintf(reject_msg, reject_msg_len,
3660 _("This setting is not a string."));
3661 return FALSE;
3662 }
3663
3664 if (strlen(val) >= pset->string.value_size) {
3665 settings_snprintf(reject_msg, reject_msg_len,
3666 _("String value too long (max length: %lu)."),
3667 (unsigned long) pset->string.value_size);
3668 return FALSE;
3669 }
3670
3671 return (!pset->string.validate
3672 || pset->string.validate(val, caller, reject_msg,
3673 reject_msg_len));
3674}
3675
3676/************************************************************************/
3679char *setting_str_get(struct setting *pset)
3680{
3681 fc_assert(setting_type(pset) == SST_STRING);
3682
3683 return pset->string.value;
3684}
3685
3686/************************************************************************/
3691{
3692 const struct sset_val_name *name =
3693 ((const struct setting *) data)->enumerator.name(val);
3694
3695 return (NULL != name ? name->support : NULL);
3696}
3697
3698/************************************************************************/
3702const char *setting_enum_val(const struct setting *pset, int val,
3703 bool pretty)
3704{
3705 const struct sset_val_name *name;
3706
3707 fc_assert_ret_val(SST_ENUM == pset->stype, NULL);
3708 name = pset->enumerator.name(val);
3709 if (NULL == name) {
3710 return NULL;
3711 } else if (pretty) {
3712 return _(name->pretty);
3713 } else {
3714 return name->support;
3715 }
3716}
3717
3718/************************************************************************/
3722static const char *setting_enum_to_str(const struct setting *pset,
3723 int value, bool pretty,
3724 char *buf, size_t buf_len)
3725{
3726 const struct sset_val_name *name = pset->enumerator.name(value);
3727
3728 if (pretty) {
3729 fc_snprintf(buf, buf_len, "\"%s\" (%s)",
3730 Q_(name->pretty), name->support);
3731 } else {
3732 fc_strlcpy(buf, name->support, buf_len);
3733 }
3734 return buf;
3735}
3736
3737/************************************************************************/
3744static bool setting_enum_validate_base(const struct setting *pset,
3745 const char *val, int *pint_val,
3746 struct connection *caller,
3747 char *reject_msg,
3748 size_t reject_msg_len)
3749{
3750 char buf[256];
3751
3752 if (SST_ENUM != pset->stype) {
3753 settings_snprintf(reject_msg, reject_msg_len,
3754 _("This setting is not an enumerator."));
3755 return FALSE;
3756 }
3757
3758 sz_strlcpy(buf, val);
3760
3761 return (setting_match_prefix(pset->enumerator.name, buf, pint_val,
3762 reject_msg, reject_msg_len)
3763 && (NULL == pset->enumerator.validate
3764 || pset->enumerator.validate(*pint_val, caller, reject_msg,
3765 reject_msg_len)));
3766}
3767
3768/************************************************************************/
3771static bool set_enum_value(struct setting *pset, int val)
3772{
3773 switch (pset->enumerator.store_size) {
3774 case sizeof(int):
3775 {
3776 int *to_int = pset->enumerator.pvalue;
3777
3778 *to_int = val;
3779 }
3780 break;
3781 case sizeof(char):
3782 {
3783 char *to_char = pset->enumerator.pvalue;
3784
3785 *to_char = (char) val;
3786 }
3787 break;
3788 case sizeof(short):
3789 {
3790 short *to_short = pset->enumerator.pvalue;
3791
3792 *to_short = (short) val;
3793 }
3794 break;
3795 default:
3796 return FALSE;
3797 }
3798
3799 return TRUE;
3800}
3801
3802/************************************************************************/
3805int read_enum_value(const struct setting *pset)
3806{
3807 int val;
3808
3809 switch (pset->enumerator.store_size) {
3810 case sizeof(int):
3811 val = *((int *)pset->enumerator.pvalue);
3812 break;
3813 case sizeof(char):
3814 val = *((char *)pset->enumerator.pvalue);
3815 break;
3816 case sizeof(short):
3817 val = *((short *)pset->enumerator.pvalue);
3818 break;
3819 default:
3820 log_error("Illegal enum store size %d, can't read value", pset->enumerator.store_size);
3821 return 0;
3822 }
3823
3824 return val;
3825}
3826
3827/************************************************************************/
3832bool setting_enum_set(struct setting *pset, const char *val,
3833 struct connection *caller, char *reject_msg,
3834 size_t reject_msg_len)
3835{
3836 int int_val;
3837
3838 if (!setting_is_changeable(pset, caller, reject_msg, reject_msg_len)) {
3839 return FALSE;
3840 }
3841
3842 if (!setting_enum_validate_base(pset, val, &int_val, caller,
3843 reject_msg, reject_msg_len)) {
3844 return FALSE;
3845 }
3846
3847 if (!set_enum_value(pset, int_val)) {
3848 log_error("Illegal enumerator value size %d for %s",
3849 pset->enumerator.store_size, val);
3850 return FALSE;
3851 }
3852
3853 return TRUE;
3854}
3855
3856/************************************************************************/
3861bool setting_enum_validate(const struct setting *pset, const char *val,
3862 struct connection *caller, char *reject_msg,
3863 size_t reject_msg_len)
3864{
3865 int int_val;
3866
3867 return setting_enum_validate_base(pset, val, &int_val, caller,
3868 reject_msg, reject_msg_len);
3869}
3870
3871/************************************************************************/
3876{
3877 const struct sset_val_name *name =
3878 ((const struct setting *) data)->bitwise.name(bit);
3879
3880 return (NULL != name ? name->support : NULL);
3881}
3882
3883/************************************************************************/
3887const char *setting_bitwise_bit(const struct setting *pset,
3888 int bit, bool pretty)
3889{
3890 const struct sset_val_name *name;
3891
3892 fc_assert_ret_val(SST_BITWISE == pset->stype, NULL);
3893 name = pset->bitwise.name(bit);
3894 if (NULL == name) {
3895 return NULL;
3896 } else if (pretty) {
3897 return _(name->pretty);
3898 } else {
3899 return name->support;
3900 }
3901}
3902
3903/************************************************************************/
3906static const char *setting_bitwise_to_str(const struct setting *pset,
3907 unsigned value, bool pretty,
3908 char *buf, size_t buf_len)
3909{
3910 const struct sset_val_name *name;
3911 char *old_buf = buf;
3912 int bit;
3913
3914 if (pretty) {
3915 char buf2[256];
3916 struct astring astr = ASTRING_INIT;
3917 struct strvec *vec = strvec_new();
3918 size_t len;
3919
3920 for (bit = 0; (name = pset->bitwise.name(bit)); bit++) {
3921 if ((1 << bit) & value) {
3922 /* TRANS: only emphasizing a string. */
3923 fc_snprintf(buf2, sizeof(buf2), _("\"%s\""), Q_(name->pretty));
3924 strvec_append(vec, buf2);
3925 }
3926 }
3927
3928 if (0 == strvec_size(vec)) {
3929 /* No value. */
3930 fc_assert(0 == value);
3931 /* TRANS: Bitwise setting has no bits set. */
3932 fc_strlcpy(buf, _("empty value"), buf_len);
3934 return buf;
3935 }
3936
3937 strvec_to_and_list(vec, &astr);
3939 fc_strlcpy(buf, astr_str(&astr), buf_len);
3940 astr_free(&astr);
3941 fc_strlcat(buf, " (", buf_len);
3942 len = strlen(buf);
3943 buf += len;
3944 buf_len -= len;
3945 }
3946
3947 /* Long support part. */
3948 buf[0] = '\0';
3949 for (bit = 0; (name = pset->bitwise.name(bit)); bit++) {
3950 if ((1 << bit) & value) {
3951 if ('\0' != buf[0]) {
3952 fc_strlcat(buf, "|", buf_len);
3953 }
3954 fc_strlcat(buf, name->support, buf_len);
3955 }
3956 }
3957
3958 if (pretty) {
3959 fc_strlcat(buf, ")", buf_len);
3960 }
3961 return old_buf;
3962}
3963
3964/************************************************************************/
3971static bool setting_bitwise_validate_base(const struct setting *pset,
3972 const char *val,
3973 unsigned *pint_val,
3974 struct connection *caller,
3975 char *reject_msg,
3976 size_t reject_msg_len)
3977{
3978 char buf[256];
3979 const char *p;
3980 int bit;
3981
3982 if (SST_BITWISE != pset->stype) {
3983 settings_snprintf(reject_msg, reject_msg_len,
3984 _("This setting is not a bitwise."));
3985 return FALSE;
3986 }
3987
3988 *pint_val = 0;
3989
3990 /* Value names are separated by '|'. */
3991 do {
3992 p = strchr(val, '|');
3993 if (NULL != p) {
3994 p++;
3995 fc_strlcpy(buf, val, MIN(p - val, sizeof(buf)));
3996 } else {
3997 /* Last segment, full copy. */
3998 sz_strlcpy(buf, val);
3999 }
4001 if (NULL == p && '\0' == buf[0] && 0 == *pint_val) {
4002 /* Empty string = value 0. */
4003 break;
4004 } else if (!setting_match_prefix(pset->bitwise.name, buf, &bit,
4005 reject_msg, reject_msg_len)) {
4006 return FALSE;
4007 }
4008 *pint_val |= 1 << bit;
4009 val = p;
4010 } while (NULL != p);
4011
4012 return (NULL == pset->bitwise.validate
4013 || pset->bitwise.validate(*pint_val, caller,
4014 reject_msg, reject_msg_len));
4015}
4016
4017/************************************************************************/
4022bool setting_bitwise_set(struct setting *pset, const char *val,
4023 struct connection *caller, char *reject_msg,
4024 size_t reject_msg_len)
4025{
4026 unsigned int_val;
4027
4028 if (!setting_is_changeable(pset, caller, reject_msg, reject_msg_len)
4029 || !setting_bitwise_validate_base(pset, val, &int_val, caller,
4030 reject_msg, reject_msg_len)) {
4031 return FALSE;
4032 }
4033
4034 *pset->bitwise.pvalue = int_val;
4035 return TRUE;
4036}
4037
4038/************************************************************************/
4043bool setting_bitwise_validate(const struct setting *pset, const char *val,
4044 struct connection *caller, char *reject_msg,
4045 size_t reject_msg_len)
4046{
4047 unsigned int_val;
4048
4049 return setting_bitwise_validate_base(pset, val, &int_val, caller,
4050 reject_msg, reject_msg_len);
4051}
4052
4053/************************************************************************/
4057{
4058 fc_assert(setting_type(pset) == SST_BITWISE);
4059
4060 return *pset->bitwise.pvalue;
4061}
4062
4063/************************************************************************/
4066const char *setting_value_name(const struct setting *pset, bool pretty,
4067 char *buf, size_t buf_len)
4068{
4069 fc_assert_ret_val(NULL != pset, NULL);
4070 fc_assert_ret_val(NULL != buf, NULL);
4071 fc_assert_ret_val(0 < buf_len, NULL);
4072
4073 switch (pset->stype) {
4074 case SST_BOOL:
4075 return setting_bool_to_str(pset, *pset->boolean.pvalue,
4076 pretty, buf, buf_len);
4077 case SST_INT:
4078 return setting_int_to_str(pset, *pset->integer.pvalue,
4079 pretty, buf, buf_len);
4080 case SST_STRING:
4081 return setting_str_to_str(pset, pset->string.value,
4082 pretty, buf, buf_len);
4083 case SST_ENUM:
4084 return setting_enum_to_str(pset, read_enum_value(pset),
4085 pretty, buf, buf_len);
4086 case SST_BITWISE:
4087 return setting_bitwise_to_str(pset, *pset->bitwise.pvalue,
4088 pretty, buf, buf_len);
4089 case SST_COUNT:
4090 /* Error logged below. */
4091 break;
4092 }
4093
4094 log_error("%s(): Setting \"%s\" (nb %d) not handled in switch statement.",
4095 __FUNCTION__, setting_name(pset), setting_number(pset));
4096 return NULL;
4097}
4098
4099/************************************************************************/
4102const char *setting_default_name(const struct setting *pset, bool pretty,
4103 char *buf, size_t buf_len)
4104{
4105 fc_assert_ret_val(NULL != pset, NULL);
4106 fc_assert_ret_val(NULL != buf, NULL);
4107 fc_assert_ret_val(0 < buf_len, NULL);
4108
4109 switch (pset->stype) {
4110 case SST_BOOL:
4111 return setting_bool_to_str(pset, pset->boolean.default_value,
4112 pretty, buf, buf_len);
4113 case SST_INT:
4114 return setting_int_to_str(pset, pset->integer.default_value,
4115 pretty, buf, buf_len);
4116 case SST_STRING:
4117 return setting_str_to_str(pset, pset->string.default_value,
4118 pretty, buf, buf_len);
4119 case SST_ENUM:
4120 return setting_enum_to_str(pset, pset->enumerator.default_value,
4121 pretty, buf, buf_len);
4122 case SST_BITWISE:
4123 return setting_bitwise_to_str(pset, pset->bitwise.default_value,
4124 pretty, buf, buf_len);
4125 case SST_COUNT:
4126 /* Error logged below. */
4127 break;
4128 }
4129
4130 log_error("%s(): Setting \"%s\" (nb %d) not handled in switch statement.",
4131 __FUNCTION__, setting_name(pset), setting_number(pset));
4132 return NULL;
4133}
4134
4135/************************************************************************/
4139{
4140 switch (pset->stype) {
4141 case SST_BOOL:
4142 (*pset->boolean.pvalue) = pset->boolean.default_value;
4143 break;
4144 case SST_INT:
4145 (*pset->integer.pvalue) = pset->integer.default_value;
4146 break;
4147 case SST_STRING:
4149 pset->string.value_size);
4150 break;
4151 case SST_ENUM:
4153 break;
4154 case SST_BITWISE:
4155 (*pset->bitwise.pvalue) = pset->bitwise.default_value;
4156 break;
4157 case SST_COUNT:
4158 fc_assert(pset->stype != SST_COUNT);
4159 break;
4160 }
4161
4162 pset->setdef = SETDEF_INTERNAL;
4163}
4164
4165/************************************************************************/
4168void setting_action(const struct setting *pset)
4169{
4170 if (pset->action != NULL) {
4171 pset->action(pset);
4172 }
4173}
4174
4175/************************************************************************/
4178bool settings_ruleset(struct section_file *file, const char *section,
4179 bool act)
4180{
4181 const char *name;
4182 int j;
4183
4184 /* Unlock all settings. */
4185 settings_iterate(SSET_ALL, pset) {
4186 setting_lock_set(pset, FALSE);
4187 if (pset->ruleset_settable) {
4189 }
4191
4192 /* settings */
4193 if (NULL == secfile_section_by_name(file, section)) {
4194 /* no settings in ruleset file */
4195 log_verbose("no [%s] section for game settings in %s", section,
4196 secfile_name(file));
4197 } else {
4198 for (j = 0; (name = secfile_lookup_str_default(file, NULL, "%s.set%d.name",
4199 section, j)); j++) {
4200 char path[256];
4201
4202 fc_snprintf(path, sizeof(path), "%s.set%d", section, j);
4203
4204 if (!setting_ruleset_one(file, name, path)) {
4205 log_error("Unknown unsettable setting in '%s': %s",
4206 secfile_name(file), name);
4207 }
4208 }
4209 }
4210
4211 /* Execute all setting actions to consider actions due to the
4212 * default values. */
4213 if (act) {
4214 settings_iterate(SSET_ALL, pset) {
4215 if (pset->ruleset_settable) {
4216 setting_action(pset);
4217 }
4219 }
4220
4222
4223 /* send game settings */
4225
4226 return TRUE;
4227}
4228
4229/************************************************************************/
4232static bool setting_ruleset_one(struct section_file *file,
4233 const char *name, const char *path)
4234{
4235 struct setting *pset = NULL;
4236 char reject_msg[256], buf[256];
4237 bool lock;
4238
4239 settings_iterate(SSET_ALL, pset_check) {
4240 if (0 == fc_strcasecmp(setting_name(pset_check), name)) {
4241 pset = pset_check;
4242 break;
4243 }
4245
4246 if (pset == NULL || !pset->ruleset_settable) {
4247 /* No setting found or it's not settable by ruleset */
4248 return FALSE;
4249 }
4250
4251 switch (pset->stype) {
4252 case SST_BOOL:
4253 {
4254 int ival;
4255 bool val;
4256
4257 /* Allow string with same boolean representation as accepted on
4258 * server command line */
4259 if (secfile_lookup_enum_data(file, &ival, FALSE,
4261 "%s.value", path)) {
4262 val = (ival != 0);
4263 } else if (!secfile_lookup_bool(file, &val, "%s.value", path)) {
4264 log_error("Can't read value for setting '%s': %s", name,
4265 secfile_error());
4266 break;
4267 }
4268 if (val != *pset->boolean.pvalue) {
4269 if (NULL == pset->boolean.validate
4270 || pset->boolean.validate(val, NULL, reject_msg,
4271 sizeof(reject_msg))) {
4272 *pset->boolean.pvalue = val;
4273 log_normal(_("Ruleset: '%s' has been set to %s."),
4274 setting_name(pset),
4275 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4276 } else {
4277 log_error("%s", reject_msg);
4278 }
4279 }
4280 }
4281 break;
4282
4283 case SST_INT:
4284 {
4285 int val;
4286
4287 if (!secfile_lookup_int(file, &val, "%s.value", path)) {
4288 log_error("Can't read value for setting '%s': %s", name,
4289 secfile_error());
4290 } else if (val != *pset->integer.pvalue) {
4291 if (setting_int_set(pset, val, NULL, reject_msg,
4292 sizeof(reject_msg))) {
4293 log_normal(_("Ruleset: '%s' has been set to %s."),
4294 setting_name(pset),
4295 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4296 } else {
4297 log_error("%s", reject_msg);
4298 }
4299 }
4300 }
4301 break;
4302
4303 case SST_STRING:
4304 {
4305 const char *val = secfile_lookup_str(file, "%s.value", path);
4306
4307 if (NULL == val) {
4308 log_error("Can't read value for setting '%s': %s", name,
4309 secfile_error());
4310 } else if (0 != strcmp(val, pset->string.value)) {
4311 if (setting_str_set(pset, val, NULL, reject_msg,
4312 sizeof(reject_msg))) {
4313 log_normal(_("Ruleset: '%s' has been set to %s."),
4314 setting_name(pset),
4315 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4316 } else {
4317 log_error("%s", reject_msg);
4318 }
4319 }
4320 }
4321 break;
4322
4323 case SST_ENUM:
4324 {
4325 int val;
4326
4327 if (!secfile_lookup_enum_data(file, &val, FALSE,
4329 "%s.value", path)) {
4330 log_error("Can't read value for setting '%s': %s",
4331 name, secfile_error());
4332 } else if (val != read_enum_value(pset)) {
4333 if (NULL == pset->enumerator.validate
4334 || pset->enumerator.validate(val, NULL, reject_msg,
4335 sizeof(reject_msg))) {
4336 set_enum_value(pset, val);
4337 log_normal(_("Ruleset: '%s' has been set to %s."),
4338 setting_name(pset),
4339 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4340 } else {
4341 log_error("%s", reject_msg);
4342 }
4343 }
4344 }
4345 break;
4346
4347 case SST_BITWISE:
4348 {
4349 int val;
4350
4351 if (!secfile_lookup_enum_data(file, &val, TRUE,
4353 "%s.value", path)) {
4354 log_error("Can't read value for setting '%s': %s",
4355 name, secfile_error());
4356 } else if (val != *pset->bitwise.pvalue) {
4357 if (NULL == pset->bitwise.validate
4358 || pset->bitwise.validate((unsigned) val, NULL,
4359 reject_msg, sizeof(reject_msg))) {
4360 *pset->bitwise.pvalue = val;
4361 log_normal(_("Ruleset: '%s' has been set to %s."),
4362 setting_name(pset),
4363 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4364 } else {
4365 log_error("%s", reject_msg);
4366 }
4367 }
4368 }
4369 break;
4370
4371 case SST_COUNT:
4372 fc_assert(pset->stype != SST_COUNT);
4373 break;
4374 }
4375
4376 pset->setdef = SETDEF_RULESET;
4377
4378 /* set lock */
4379 lock = secfile_lookup_bool_default(file, FALSE, "%s.lock", path);
4380
4381 if (lock) {
4382 /* set lock */
4383 setting_lock_set(pset, lock);
4384 log_normal(_("Ruleset: '%s' has been locked by the ruleset."),
4385 setting_name(pset));
4386 }
4387
4388 return TRUE;
4389}
4390
4391/************************************************************************/
4394bool setting_non_default(const struct setting *pset)
4395{
4396 switch (setting_type(pset)) {
4397 case SST_BOOL:
4398 return (*pset->boolean.pvalue != pset->boolean.default_value);
4399 case SST_INT:
4400 return (*pset->integer.pvalue != pset->integer.default_value);
4401 case SST_STRING:
4402 return (0 != strcmp(pset->string.value, pset->string.default_value));
4403 case SST_ENUM:
4404 return (read_enum_value(pset) != pset->enumerator.default_value);
4405 case SST_BITWISE:
4406 return (*pset->bitwise.pvalue != pset->bitwise.default_value);
4407 case SST_COUNT:
4408 /* Error logged below. */
4409 break;
4410 }
4411
4412 log_error("%s(): Setting \"%s\" (nb %d) not handled in switch statement.",
4413 __FUNCTION__, setting_name(pset), setting_number(pset));
4414 return FALSE;
4415}
4416
4417/************************************************************************/
4420bool setting_locked(const struct setting *pset)
4421{
4422 return pset->locked;
4423}
4424
4425/************************************************************************/
4428void setting_lock_set(struct setting *pset, bool lock)
4429{
4430 pset->locked = lock;
4431}
4432
4433/************************************************************************/
4436static void setting_game_set(struct setting *pset, bool init)
4437{
4438 switch (setting_type(pset)) {
4439 case SST_BOOL:
4440 pset->boolean.game_value = *pset->boolean.pvalue;
4441 break;
4442
4443 case SST_INT:
4444 pset->integer.game_value = *pset->integer.pvalue;
4445 break;
4446
4447 case SST_STRING:
4448 if (init) {
4449 pset->string.game_value
4450 = fc_calloc(1, pset->string.value_size
4451 * sizeof(pset->string.game_value));
4452 }
4454 pset->string.value_size);
4455 break;
4456
4457 case SST_ENUM:
4459 break;
4460
4461 case SST_BITWISE:
4462 pset->bitwise.game_value = *pset->bitwise.pvalue;
4463 break;
4464
4465 case SST_COUNT:
4466 fc_assert(setting_type(pset) != SST_COUNT);
4467 break;
4468 }
4469
4470 pset->game_setdef = pset->setdef;
4471}
4472
4473/************************************************************************/
4476static void setting_game_free(struct setting *pset)
4477{
4478 if (setting_type(pset) == SST_STRING) {
4479 FC_FREE(pset->string.game_value);
4480 }
4481}
4482
4483/************************************************************************/
4486static void setting_game_restore(struct setting *pset)
4487{
4488 char reject_msg[256] = "", buf[256];
4489 bool res = FALSE;
4490
4491 if (!setting_is_changeable(pset, NULL, reject_msg, sizeof(reject_msg))) {
4492 log_debug("Can't restore '%s': %s", setting_name(pset),
4493 reject_msg);
4494 return;
4495 }
4496
4497 if (pset->game_setdef == SETDEF_INTERNAL) {
4499 return;
4500 }
4501
4502 switch (setting_type(pset)) {
4503 case SST_BOOL:
4504 res = (NULL != setting_bool_to_str(pset, pset->boolean.game_value,
4505 FALSE, buf, sizeof(buf))
4506 && setting_bool_set(pset, buf, NULL, reject_msg,
4507 sizeof(reject_msg)));
4508 break;
4509
4510 case SST_INT:
4511 res = setting_int_set(pset, pset->integer.game_value, NULL, reject_msg,
4512 sizeof(reject_msg));
4513 break;
4514
4515 case SST_STRING:
4516 res = setting_str_set(pset, pset->string.game_value, NULL, reject_msg,
4517 sizeof(reject_msg));
4518 break;
4519
4520 case SST_ENUM:
4521 res = (NULL != setting_enum_to_str(pset, pset->enumerator.game_value,
4522 FALSE, buf, sizeof(buf))
4523 && setting_enum_set(pset, buf, NULL, reject_msg,
4524 sizeof(reject_msg)));
4525 break;
4526
4527 case SST_BITWISE:
4528 res = (NULL != setting_bitwise_to_str(pset, pset->bitwise.game_value,
4529 FALSE, buf, sizeof(buf))
4530 && setting_bitwise_set(pset, buf, NULL, reject_msg,
4531 sizeof(reject_msg)));
4532 break;
4533
4534 case SST_COUNT:
4535 res = FALSE;
4536 break;
4537 }
4538
4539 if (!res) {
4540 log_error("Error restoring setting '%s' to the value from game start: "
4541 "%s", setting_name(pset), reject_msg);
4542 }
4543}
4544
4545/************************************************************************/
4549{
4550 settings_iterate(SSET_ALL, pset) {
4551 setting_game_set(pset, FALSE);
4553
4554 /* Settings from the start of the game are saved. */
4556}
4557
4558/************************************************************************/
4561void settings_game_save(struct section_file *file, const char *section)
4562{
4563 int set_count = 0;
4564
4565 settings_iterate(SSET_ALL, pset) {
4566 char errbuf[200];
4567
4568 if (/* It's explicitly set to some value to save */
4569 setting_get_setdef(pset) == SETDEF_CHANGED
4570 /* It must be same at loading time as it was saving time, even if
4571 * freeciv's default has changed. */
4572 || !setting_is_free_to_change(pset, errbuf, sizeof(errbuf))) {
4573 bool gamestart = game.server.settings_gamestart_valid;
4574
4575 secfile_insert_str(file, setting_name(pset),
4576 "%s.set%d.name", section, set_count);
4577 switch (setting_type(pset)) {
4578 case SST_BOOL:
4579 secfile_insert_bool(file, *pset->boolean.pvalue,
4580 "%s.set%d.value", section, set_count);
4581 if (gamestart) {
4582 secfile_insert_bool(file, pset->boolean.game_value,
4583 "%s.set%d.gamestart", section, set_count);
4584 }
4585 break;
4586 case SST_INT:
4587 secfile_insert_int(file, *pset->integer.pvalue,
4588 "%s.set%d.value", section, set_count);
4589 if (gamestart) {
4590 secfile_insert_int(file, pset->integer.game_value,
4591 "%s.set%d.gamestart", section, set_count);
4592 }
4593 break;
4594 case SST_STRING:
4595 secfile_insert_str(file, pset->string.value,
4596 "%s.set%d.value", section, set_count);
4597 if (gamestart) {
4598 secfile_insert_str(file, pset->string.game_value,
4599 "%s.set%d.gamestart", section, set_count);
4600 }
4601 break;
4602 case SST_ENUM:
4605 "%s.set%d.value", section, set_count);
4606 if (gamestart) {
4607 secfile_insert_enum_data(file, pset->enumerator.game_value, FALSE,
4609 "%s.set%d.gamestart", section, set_count);
4610 }
4611 break;
4612 case SST_BITWISE:
4613 secfile_insert_enum_data(file, *pset->bitwise.pvalue, TRUE,
4615 "%s.set%d.value", section, set_count);
4616 if (gamestart) {
4617 secfile_insert_enum_data(file, pset->bitwise.game_value, TRUE,
4619 "%s.set%d.gamestart", section, set_count);
4620 }
4621 break;
4622 case SST_COUNT:
4623 fc_assert(setting_type(pset) != SST_COUNT);
4624 secfile_insert_str(file, "Unknown setting type",
4625 "%s.set%d.value", section, set_count);
4626 if (gamestart) {
4627 secfile_insert_str(file, "Unknown setting type",
4628 "%s.set%d.gamestart", section, set_count);
4629 }
4630 break;
4631 }
4632 if (gamestart) {
4633 secfile_insert_str(file, setting_default_level_name(pset->game_setdef),
4634 "%s.set%d.gamesetdef", section, set_count);
4635 }
4636 set_count++;
4637 }
4639
4640 secfile_insert_int(file, set_count, "%s.set_count", section);
4642 "%s.gamestart_valid", section);
4643}
4644
4645/************************************************************************/
4648void settings_game_load(struct section_file *file, const char *section)
4649{
4650 const char *name;
4651 char reject_msg[256], buf[256];
4652 int i, set_count;
4653 int oldcitymindist = game.info.citymindist; /* backwards compat, see below */
4654
4655 /* Compatibility with savegames created with older versions is usually
4656 * handled as conversions in savecompat.c compat_load_<version>() */
4657
4658 if (!secfile_lookup_int(file, &set_count, "%s.set_count", section)) {
4659 /* Old savegames and scenarios doesn't contain this, not an error. */
4660 log_verbose("Can't read the number of settings in the save file.");
4661 return;
4662 }
4663
4664 /* Check if the saved settings are valid settings from game start. */
4666 = secfile_lookup_bool_default(file, FALSE, "%s.gamestart_valid",
4667 section);
4668
4669 for (i = 0; i < set_count; i++) {
4670 name = secfile_lookup_str(file, "%s.set%d.name", section, i);
4671
4672 settings_iterate(SSET_ALL, pset) {
4673 if (fc_strcasecmp(setting_name(pset), name) != 0) {
4674 continue;
4675 }
4676
4677 /* Load the current value of the setting. */
4678 switch (pset->stype) {
4679 case SST_BOOL:
4680 {
4681 bool val;
4682
4683 if (!secfile_lookup_bool(file, &val, "%s.set%d.value", section,
4684 i)) {
4685 log_verbose("Option '%s' not defined in the savegame: %s", name,
4686 secfile_error());
4687 } else {
4688 pset->setdef = SETDEF_CHANGED;
4689
4690 if (val != *pset->boolean.pvalue) {
4691 if (setting_is_changeable(pset, NULL, reject_msg,
4692 sizeof(reject_msg))
4693 && (NULL == pset->boolean.validate
4694 || pset->boolean.validate(val, NULL, reject_msg,
4695 sizeof(reject_msg)))) {
4696 *pset->boolean.pvalue = val;
4697 log_normal(_("Savegame: '%s' has been set to %s."),
4698 setting_name(pset),
4699 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4700 } else {
4701 log_error("Savegame: error restoring '%s' . (%s)",
4702 setting_name(pset), reject_msg);
4703 }
4704 } else {
4705 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
4706 setting_name(pset));
4707 }
4708 }
4709 }
4710 break;
4711
4712 case SST_INT:
4713 {
4714 int val;
4715
4716 if (!secfile_lookup_int(file, &val, "%s.set%d.value", section, i)) {
4717 log_verbose("Option '%s' not defined in the savegame: %s", name,
4718 secfile_error());
4719 } else {
4720 pset->setdef = SETDEF_CHANGED;
4721
4722 if (val != *pset->integer.pvalue) {
4723 if (setting_is_changeable(pset, NULL, reject_msg,
4724 sizeof(reject_msg))
4725 && (NULL == pset->integer.validate
4726 || pset->integer.validate(val, NULL, reject_msg,
4727 sizeof(reject_msg)))) {
4728 *pset->integer.pvalue = val;
4729 log_normal(_("Savegame: '%s' has been set to %s."),
4730 setting_name(pset),
4731 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4732 } else {
4733 log_error("Savegame: error restoring '%s' . (%s)",
4734 setting_name(pset), reject_msg);
4735 }
4736 } else {
4737 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
4738 setting_name(pset));
4739 }
4740 }
4741 }
4742 break;
4743
4744 case SST_STRING:
4745 {
4746 const char *val = secfile_lookup_str(file, "%s.set%d.value",
4747 section, i);
4748
4749 if (NULL == val) {
4750 log_verbose("Option '%s' not defined in the savegame: %s", name,
4751 secfile_error());
4752 } else {
4753 pset->setdef = SETDEF_CHANGED;
4754
4755 if (0 != strcmp(val, pset->string.value)) {
4756 if (setting_str_set(pset, val, NULL, reject_msg,
4757 sizeof(reject_msg))) {
4758 log_normal(_("Savegame: '%s' has been set to %s."),
4759 setting_name(pset),
4760 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4761 } else {
4762 log_error("Savegame: error restoring '%s' . (%s)",
4763 setting_name(pset), reject_msg);
4764 }
4765 } else {
4766 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
4767 setting_name(pset));
4768 }
4769 }
4770 }
4771 break;
4772
4773 case SST_ENUM:
4774 {
4775 int val;
4776
4777 if (!secfile_lookup_enum_data(file, &val, FALSE,
4779 "%s.set%d.value", section, i)) {
4780 log_verbose("Option '%s' not defined in the savegame: %s", name,
4781 secfile_error());
4782 } else {
4783 pset->setdef = SETDEF_CHANGED;
4784
4785 if (val != read_enum_value(pset)) {
4786 if (setting_is_changeable(pset, NULL, reject_msg,
4787 sizeof(reject_msg))
4788 && (NULL == pset->enumerator.validate
4789 || pset->enumerator.validate(val, NULL, reject_msg,
4790 sizeof(reject_msg)))) {
4791 set_enum_value(pset, val);
4792 log_normal(_("Savegame: '%s' has been set to %s."),
4793 setting_name(pset),
4794 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4795 } else {
4796 log_error("Savegame: error restoring '%s' . (%s)",
4797 setting_name(pset), reject_msg);
4798 }
4799 } else {
4800 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
4801 setting_name(pset));
4802 }
4803 }
4804 }
4805 break;
4806
4807 case SST_BITWISE:
4808 {
4809 int val;
4810
4811 if (!secfile_lookup_enum_data(file, &val, TRUE,
4813 "%s.set%d.value", section, i)) {
4814 log_verbose("Option '%s' not defined in the savegame: %s", name,
4815 secfile_error());
4816 } else {
4817 pset->setdef = SETDEF_CHANGED;
4818
4819 if (val != *pset->bitwise.pvalue) {
4820 if (setting_is_changeable(pset, NULL, reject_msg,
4821 sizeof(reject_msg))
4822 && (NULL == pset->bitwise.validate
4823 || pset->bitwise.validate(val, NULL, reject_msg,
4824 sizeof(reject_msg)))) {
4825 *pset->bitwise.pvalue = val;
4826 log_normal(_("Savegame: '%s' has been set to %s."),
4827 setting_name(pset),
4828 setting_value_name(pset, TRUE, buf, sizeof(buf)));
4829 } else {
4830 log_error("Savegame: error restoring '%s' . (%s)",
4831 setting_name(pset), reject_msg);
4832 }
4833 } else {
4834 log_normal(_("Savegame: '%s' explicitly set to value same as default."),
4835 setting_name(pset));
4836 }
4837 }
4838 }
4839 break;
4840
4841 case SST_COUNT:
4842 fc_assert(pset->stype != SST_COUNT);
4843 break;
4844 }
4845
4847 const char *sdname;
4848
4849 /* Load the value of the setting at the start of the game. */
4850 switch (pset->stype) {
4851 case SST_BOOL:
4852 pset->boolean.game_value =
4853 secfile_lookup_bool_default(file, *pset->boolean.pvalue,
4854 "%s.set%d.gamestart", section, i);
4855 break;
4856
4857 case SST_INT:
4858 pset->integer.game_value =
4859 secfile_lookup_int_default(file, *pset->integer.pvalue,
4860 "%s.set%d.gamestart", section, i);
4861 break;
4862
4863 case SST_STRING:
4864 fc_strlcpy(pset->string.game_value,
4865 secfile_lookup_str_default(file, pset->string.value,
4866 "%s.set%d.gamestart",
4867 section, i),
4868 pset->string.value_size);
4869 break;
4870
4871 case SST_ENUM:
4872 pset->enumerator.game_value =
4875 pset, "%s.set%d.gamestart", section, i);
4876 break;
4877
4878 case SST_BITWISE:
4879 pset->bitwise.game_value =
4881 *pset->bitwise.pvalue, TRUE, setting_bitwise_secfile_str,
4882 pset, "%s.set%d.gamestart", section, i);
4883 break;
4884
4885 case SST_COUNT:
4886 fc_assert(pset->stype != SST_COUNT);
4887 break;
4888 }
4889
4890 sdname
4892 setting_default_level_name(SETDEF_CHANGED),
4893 "%s.set%d.gamesetdef", section, i);
4894 pset->game_setdef = setting_default_level_by_name(sdname,
4896
4897 if (!setting_default_level_is_valid(pset->game_setdef)) {
4898 log_error("Setting %s has invalid gamesetdef value %s",
4899 setting_name(pset), sdname);
4900 pset->game_setdef = SETDEF_CHANGED;
4901 }
4902 } else {
4903 /* These values are saved even when they are not valid.
4904 * Silence warnings caused by them. */
4905 (void) secfile_entry_lookup(file, "%s.set%d.gamestart",
4906 section, i);
4907 (void) secfile_entry_lookup(file, "%s.set%d.gamesetdef",
4908 section, i);
4909
4910 pset->game_setdef = SETDEF_CHANGED;
4911 }
4913 }
4914
4915 /* Backwards compatibility for pre-2.4 savegames: citymindist=0 used to mean
4916 * take from ruleset min_dist_bw_cities, but that no longer exists.
4917 * This is here rather than in savegame2.c compat functions, as we need
4918 * to have loaded the relevant ruleset to know what to set it to (the
4919 * ruleset and any 'citymindist' setting it contains will have been loaded
4920 * before this function was called). */
4921 if (game.info.citymindist == 0) {
4922 game.info.citymindist = oldcitymindist;
4923 }
4924
4925 settings_iterate(SSET_ALL, pset) {
4926 /* Have to do this at the end due to dependencies ('aifill' and
4927 * 'maxplayer'). */
4928 setting_action(pset);
4930}
4931
4932/************************************************************************/
4936{
4938 log_debug("No saved settings from the game start available.");
4939 return FALSE;
4940 }
4941
4942 settings_iterate(SSET_ALL, pset) {
4945
4946 return TRUE;
4947}
4948
4949/************************************************************************/
4952void settings_init(bool act)
4953{
4955
4956 settings_iterate(SSET_ALL, pset) {
4957 setting_lock_set(pset, FALSE);
4959 setting_game_set(pset, TRUE);
4960 if (act) {
4961 setting_action(pset);
4962 }
4964
4966}
4967
4968/************************************************************************/
4972{
4973 settings_iterate(SSET_ALL, pset) {
4974 if (setting_is_changeable(pset, NULL, NULL, 0)) {
4976 setting_action(pset);
4977 }
4979}
4980
4981/************************************************************************/
4986{
4987 /* Nothing at the moment. */
4988}
4989
4990/************************************************************************/
4994{
4995 settings_iterate(SSET_ALL, pset) {
4996 setting_game_free(pset);
4998
5000}
5001
5002/************************************************************************/
5006{
5007 return SETTINGS_NUM;
5008}
5009
5010/************************************************************************/
5014void send_server_setting(struct conn_list *dest, const struct setting *pset)
5015{
5016 if (!dest) {
5017 dest = game.est_connections;
5018 }
5019
5020#define PACKET_COMMON_INIT(packet, pset, pconn) \
5021 memset(&packet, 0, sizeof(packet)); \
5022 packet.id = setting_number(pset); \
5023 packet.is_visible = setting_is_visible(pset, pconn); \
5024 packet.is_changeable = setting_is_changeable(pset, pconn, NULL, 0); \
5025 packet.initial_setting = game.info.is_new_game; \
5026 packet.setdef = setting_get_setdef(pset);
5027
5028 switch (setting_type(pset)) {
5029 case SST_BOOL:
5030 {
5031 struct packet_server_setting_bool packet;
5032
5033 conn_list_iterate(dest, pconn) {
5034 PACKET_COMMON_INIT(packet, pset, pconn);
5035 if (packet.is_visible) {
5036 packet.val = *pset->boolean.pvalue;
5037 packet.default_val = pset->boolean.default_value;
5038 }
5039 send_packet_server_setting_bool(pconn, &packet);
5041 }
5042 break;
5043 case SST_INT:
5044 {
5045 struct packet_server_setting_int packet;
5046
5047 conn_list_iterate(dest, pconn) {
5048 PACKET_COMMON_INIT(packet, pset, pconn);
5049 if (packet.is_visible) {
5050 packet.val = *pset->integer.pvalue;
5051 packet.default_val = pset->integer.default_value;
5052 packet.min_val = pset->integer.min_value;
5053 packet.max_val = pset->integer.max_value;
5054 }
5055 send_packet_server_setting_int(pconn, &packet);
5057 }
5058 break;
5059 case SST_STRING:
5060 {
5061 struct packet_server_setting_str packet;
5062
5063 conn_list_iterate(dest, pconn) {
5064 PACKET_COMMON_INIT(packet, pset, pconn);
5065 if (packet.is_visible) {
5066 sz_strlcpy(packet.val, pset->string.value);
5068 }
5069 send_packet_server_setting_str(pconn, &packet);
5071 }
5072 break;
5073 case SST_ENUM:
5074 {
5075 struct packet_server_setting_enum packet;
5076 const struct sset_val_name *val_name;
5077 int i;
5078
5079 conn_list_iterate(dest, pconn) {
5080 PACKET_COMMON_INIT(packet, pset, pconn);
5081 if (packet.is_visible) {
5082 packet.val = read_enum_value(pset);
5083 packet.default_val = pset->enumerator.default_value;
5084 for (i = 0; (val_name = pset->enumerator.name(i)); i++) {
5085 sz_strlcpy(packet.support_names[i], val_name->support);
5086 /* Send untranslated string */
5087 sz_strlcpy(packet.pretty_names[i], val_name->pretty);
5088 }
5089 packet.values_num = i;
5090 fc_assert(i <= ARRAY_SIZE(packet.support_names));
5091 fc_assert(i <= ARRAY_SIZE(packet.pretty_names));
5092 }
5093 send_packet_server_setting_enum(pconn, &packet);
5095 }
5096 break;
5097 case SST_BITWISE:
5098 {
5099 struct packet_server_setting_bitwise packet;
5100 const struct sset_val_name *val_name;
5101 int i;
5102
5103 conn_list_iterate(dest, pconn) {
5104 PACKET_COMMON_INIT(packet, pset, pconn);
5105 if (packet.is_visible) {
5106 packet.val = *pset->bitwise.pvalue;
5107 packet.default_val = pset->bitwise.default_value;
5108 for (i = 0; (val_name = pset->bitwise.name(i)); i++) {
5109 sz_strlcpy(packet.support_names[i], val_name->support);
5110 /* Send untranslated string */
5111 sz_strlcpy(packet.pretty_names[i], val_name->pretty);
5112 }
5113 packet.bits_num = i;
5114 fc_assert(i <= ARRAY_SIZE(packet.support_names));
5115 fc_assert(i <= ARRAY_SIZE(packet.pretty_names));
5116 }
5117 send_packet_server_setting_bitwise(pconn, &packet);
5119 }
5120 break;
5121
5122 case SST_COUNT:
5123 fc_assert(setting_type(pset) != SST_COUNT);
5124 break;
5125 }
5126
5127#undef PACKET_INIT
5128}
5129
5130/************************************************************************/
5133void send_server_settings(struct conn_list *dest)
5134{
5135 settings_iterate(SSET_ALL, pset) {
5136 send_server_setting(dest, pset);
5138}
5139
5140/************************************************************************/
5145void send_server_access_level_settings(struct conn_list *dest,
5146 enum cmdlevel old_level,
5147 enum cmdlevel new_level)
5148{
5149 enum cmdlevel min_level;
5150 enum cmdlevel max_level;
5151
5152 if (old_level == new_level) {
5153 return;
5154 }
5155
5156 if (old_level < new_level) {
5157 min_level = old_level;
5158 max_level = new_level;
5159 } else {
5160 min_level = new_level;
5161 max_level = old_level;
5162 }
5163
5164 settings_iterate(SSET_ALL, pset) {
5165 if ((pset->access_level_read >= min_level
5166 && pset->access_level_read <= max_level)
5167 || (pset->access_level_write >= min_level
5168 && pset->access_level_write <= max_level)) {
5169 send_server_setting(dest, pset);
5170 }
5172}
5173
5174/************************************************************************/
5178{
5179 struct packet_server_setting_control control;
5181 int i;
5182
5183 control.settings_num = SETTINGS_NUM;
5184
5185 /* Fill in the category strings. */
5186 fc_assert(SSET_NUM_CATEGORIES <= ARRAY_SIZE(control.category_names));
5187 control.categories_num = SSET_NUM_CATEGORIES;
5188 for (i = 0; i < SSET_NUM_CATEGORIES; i++) {
5189 /* Send untranslated name */
5190 sz_strlcpy(control.category_names[i], sset_category_name(i));
5191 }
5192
5193 /* Send off the control packet. */
5194 send_packet_server_setting_control(pconn, &control);
5195
5196 /* Send the constant and common part of the settings. */
5197 settings_iterate(SSET_ALL, pset) {
5198 setting.id = setting_number(pset);
5200 /* Send untranslated strings to client */
5203 setting.category = pset->scategory;
5204
5207}
5208
5209/************************************************************************/
5212static void settings_list_init(void)
5213{
5214 struct setting *pset;
5215 int i;
5216
5218
5219 /* Do it for all values of enum sset_level. */
5220 for (i = 0; i < OLEVELS_NUM; i++) {
5221 setting_sorted.level[i] = setting_list_new();
5222 }
5223
5224 for (i = 0; (pset = setting_by_number(i)); i++) {
5225 /* Add the setting to the list of all settings. */
5226 setting_list_append(setting_sorted.level[SSET_ALL], pset);
5227
5228 switch (setting_level(pset)) {
5229 case SSET_NONE:
5230 /* No setting should be in this level. */
5231 fc_assert_msg(setting_level(pset) != SSET_NONE,
5232 "No setting level defined for '%s'.", setting_name(pset));
5233 break;
5234 case SSET_ALL:
5235 /* Done above - list of all settings. */
5236 break;
5237 case SSET_VITAL:
5238 setting_list_append(setting_sorted.level[SSET_VITAL], pset);
5239 break;
5240 case SSET_SITUATIONAL:
5241 setting_list_append(setting_sorted.level[SSET_SITUATIONAL], pset);
5242 break;
5243 case SSET_RARE:
5244 setting_list_append(setting_sorted.level[SSET_RARE], pset);
5245 break;
5246 case SSET_CHANGED:
5247 case SSET_LOCKED:
5248 /* This is done in settings_list_update. */
5249 break;
5250 case OLEVELS_NUM:
5251 /* No setting should be in this level. */
5252 fc_assert_msg(setting_level(pset) != OLEVELS_NUM,
5253 "Invalid setting level for '%s' (%s).",
5254 setting_name(pset), sset_level_name(setting_level(pset)));
5255 break;
5256 }
5257 }
5258
5259 /* Sort the lists. */
5260 for (i = 0; i < OLEVELS_NUM; i++) {
5261 setting_list_sort(setting_sorted.level[i], settings_list_cmp);
5262 }
5263
5264 setting_sorted.init = TRUE;
5265}
5266
5267/************************************************************************/
5271{
5272 struct setting *pset;
5273 int i;
5274
5276
5277 /* Clear the lists for changed and locked values. */
5278 setting_list_clear(setting_sorted.level[SSET_CHANGED]);
5279 setting_list_clear(setting_sorted.level[SSET_LOCKED]);
5280
5281 /* Refill them. */
5282 for (i = 0; (pset = setting_by_number(i)); i++) {
5283 if (setting_non_default(pset)) {
5284 setting_list_append(setting_sorted.level[SSET_CHANGED], pset);
5285 }
5286 if (setting_locked(pset)) {
5287 setting_list_append(setting_sorted.level[SSET_LOCKED], pset);
5288 }
5289 }
5290
5291 /* Sort them. */
5292 setting_list_sort(setting_sorted.level[SSET_CHANGED], settings_list_cmp);
5293 setting_list_sort(setting_sorted.level[SSET_LOCKED], settings_list_cmp);
5294}
5295
5296/************************************************************************/
5299int settings_list_cmp(const struct setting *const *ppset1,
5300 const struct setting *const *ppset2)
5301{
5302 const struct setting *pset1 = *ppset1;
5303 const struct setting *pset2 = *ppset2;
5304
5305 return fc_strcasecmp(setting_name(pset1), setting_name(pset2));
5306}
5307
5308/************************************************************************/
5312struct setting_list *settings_list_get(enum sset_level level)
5313{
5315 fc_assert_ret_val(setting_sorted.level[level] != NULL, NULL);
5316 fc_assert_ret_val(sset_level_is_valid(level), NULL);
5317
5318 return setting_sorted.level[level];
5319}
5320
5321/************************************************************************/
5324static void settings_list_free(void)
5325{
5326 int i;
5327
5329
5330 /* Free the lists. */
5331 for (i = 0; i < OLEVELS_NUM; i++) {
5332 setting_list_destroy(setting_sorted.level[i]);
5333 }
5334
5335 setting_sorted.init = FALSE;
5336}
5337
5338/************************************************************************/
5341void setting_changed(struct setting *pset)
5342{
5343 pset->setdef = SETDEF_CHANGED;
5344}
5345
5346/************************************************************************/
5349enum setting_default_level setting_get_setdef(const struct setting *pset)
5350{
5351 return pset->setdef;
5352}
void astr_free(struct astring *astr)
Definition astring.c:153
const char * astr_build_and_list(struct astring *astr, const char *const *items, size_t number)
Definition astring.c:367
static const char * astr_str(const struct astring *astr) fc__attribute((nonnull(1)))
Definition astring.h:93
#define ASTRING_INIT
Definition astring.h:44
#define BV_ISSET(bv, bit)
Definition bitvector.h:78
#define conn_list_iterate(connlist, pconn)
Definition connection.h:113
#define conn_list_iterate_end
Definition connection.h:115
@ TDM_FIXED
Definition fc_types.h:898
@ TDM_EVEN
Definition fc_types.h:899
@ DIPLO_NO_MIXED
Definition fc_types.h:908
@ DIPLO_FOR_TEAMS
Definition fc_types.h:909
@ DIPLO_NO_AIS
Definition fc_types.h:907
@ DIPLO_FOR_HUMANS
Definition fc_types.h:905
@ DIPLO_FOR_ALL
Definition fc_types.h:904
@ DIPLO_FOR_AIS
Definition fc_types.h:906
@ DIPLO_DISABLED
Definition fc_types.h:910
@ REVOLEN_RANDOM
Definition fc_types.h:1136
@ REVOLEN_RANDQUICK
Definition fc_types.h:1138
@ REVOLEN_FIXED
Definition fc_types.h:1135
@ REVOLEN_QUICKENING
Definition fc_types.h:1137
int Unit_Class_id
Definition fc_types.h:388
@ HB_ALLIANCE
Definition fc_types.h:1144
@ HB_DISABLED
Definition fc_types.h:1142
@ HB_NATIONAL
Definition fc_types.h:1143
@ VC_SPACERACE
Definition fc_types.h:1123
@ VC_CULTURE
Definition fc_types.h:1125
@ VC_ALLIED
Definition fc_types.h:1124
@ BORDERS_ENABLED
Definition fc_types.h:892
@ BORDERS_DISABLED
Definition fc_types.h:891
@ BORDERS_SEE_INSIDE
Definition fc_types.h:893
@ BORDERS_EXPAND
Definition fc_types.h:894
#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:57
struct world wld
Definition game.c:58
int generate_save_name(const char *format, char *buf, int buflen, const char *reason)
Definition game.c:771
#define GAME_DEFAULT_TECHPENALTY
Definition game.h:532
#define GAME_MAX_RAPTUREDELAY
Definition game.h:484
#define GAME_DEFAULT_START_CITY
Definition game.h:361
#define GAME_DEFAULT_KILLSTACK
Definition game.h:525
@ 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:356
#define GAME_MAX_DIPLCHANCE
Definition game.h:443
#define GAME_MAX_SCIENCEBOX
Definition game.h:401
#define GAME_MAX_EVENT_CACHE_MAX_SIZE
Definition game.h:688
#define GAME_DEFAULT_REVOLENTYPE
Definition game.h:710
#define GAME_DEFAULT_AUTO_AI_TOGGLE
Definition game.h:571
#define GAME_MIN_RAZECHANCE
Definition game.h:548
#define GAME_MIN_GLOBAL_WARMING_PERCENT
Definition game.h:426
#define GAME_DEFAULT_CARAVAN_BONUS_STYLE
Definition game.h:631
#define GAME_MIN_SEED
Definition game.h:349
#define GAME_MAX_TECHLOSSFG
Definition game.h:455
#define GAME_DEFAULT_TCPTIMEOUT
Definition game.h:597
#define GAME_MAX_INFRA
Definition game.h:358
#define GAME_DEFAULT_EVENT_CACHE_INFO
Definition game.h:692
#define GAME_DEFAULT_MGR_FOODNEEDED
Definition game.h:504
#define GAME_DEFAULT_TECHLOST_DONOR
Definition game.h:540
#define GAME_DEFAULT_ALLOWED_CITY_NAMES
Definition game.h:706
#define GAME_MIN_TRADEWORLDRELPCT
Definition game.h:620
#define GAME_DEFAULT_SCORELOG
Definition game.h:553
#define GAME_MAX_KILLUNHOMED
Definition game.h:530
#define GAME_MIN_TECHLOST_RECV
Definition game.h:537
#define GAME_MIN_FREECOST
Definition game.h:446
#define GAME_MAX_CONTACTTURNS
Definition game.h:478
#define GAME_MIN_SPACESHIP_TRAVEL_TIME
Definition game.h:566
#define GAME_MAX_TECHLOST_RECV
Definition game.h:538
#define GAME_DEFAULT_OCCUPYCHANCE
Definition game.h:645
#define GAME_DEFAULT_USER_META_MESSAGE
Definition game.h:673
#define GAME_MAX_FOODBOX
Definition game.h:393
#define GAME_DEFAULT_GLOBAL_WARMING_PERCENT
Definition game.h:425
#define GAME_DEFAULT_TRADING_TECH
Definition game.h:627
#define GAME_MIN_SCIENCEBOX
Definition game.h:400
#define GAME_MAX_PINGTIMEOUT
Definition game.h:611
#define GAME_MAX_SAVEFREQUENCY
Definition game.h:663
#define GAME_MIN_REVOLUTION_LENGTH
Definition game.h:712
#define GAME_MAX_MGR_TURNINTERVAL
Definition game.h:502
#define GAME_DEFAULT_SAVETURNS
Definition game.h:658
#define GAME_DEFAULT_IPHIDE
Definition game.h:613
#define GAME_DEFAULT_BORDERS
Definition game.h:435
#define GAME_DEFAULT_AIRLIFTINGSTYLE
Definition game.h:717
#define GAME_MAX_CONQUERCOST
Definition game.h:451
#define GAME_MAX_AQUEDUCTLOSS
Definition game.h:523
#define GAME_DEFAULT_KILLUNHOMED
Definition game.h:528
#define GAME_DEFAULT_SCIENCEBOX
Definition game.h:399
#define GAME_MIN_DIPLGOLDCOST
Definition game.h:408
#define GAME_DEFAULT_MGR_WORLDCHANCE
Definition game.h:517
#define GAME_MIN_PINGTIME
Definition game.h:606
#define GAME_DEFAULT_ONSETBARBARIAN
Definition game.h:641
#define GAME_MIN_ONSETBARBARIAN
Definition game.h:642
#define GAME_MAX_TECHLOSSREST
Definition game.h:459
#define GAME_DEFAULT_KILLCITIZEN
Definition game.h:526
#define GAME_MIN_INCITE_GOLD_LOSS_CHANCE
Definition game.h:412
#define GAME_MIN_MGR_NATIONCHANCE
Definition game.h:514
#define GAME_MAX_COMPRESS_LEVEL
Definition game.h:696
#define GAME_DEFAULT_NATIONSET
Definition game.h:389
#define GAME_DEFAULT_SHIELDBOX
Definition game.h:395
#define GAME_MIN_NOTRADESIZE
Definition game.h:616
#define GAME_MIN_GOLD
Definition game.h:353
#define GAME_MAX_OCCUPYCHANCE
Definition game.h:647
#define GAME_DEFAULT_MAXCONNECTIONSPERHOST
Definition game.h:582
#define GAME_DEFAULT_INCITE_GOLD_CAPT_CHANCE
Definition game.h:415
#define GAME_DEFAULT_DEMOGRAPHY
Definition game.h:679
#define GAME_MIN_MAXCONNECTIONSPERHOST
Definition game.h:583
#define GAME_DEFAULT_FULLTRADESIZE
Definition game.h:623
#define GAME_MAX_DISPERSION
Definition game.h:365
#define GAME_MIN_TECHLOST_DONOR
Definition game.h:541
#define GAME_DEFAULT_RAPTUREDELAY
Definition game.h:482
#define GAME_MIN_MGR_TURNINTERVAL
Definition game.h:501
#define GAME_DEFAULT_REVOLUTION_LENGTH
Definition game.h:711
#define GAME_DEFAULT_MGR_TURNINTERVAL
Definition game.h:500
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:360
#define GAME_MAX_SPACESHIP_TRAVEL_TIME
Definition game.h:567
#define GAME_MAX_TCPTIMEOUT
Definition game.h:599
#define GAME_DEFAULT_ALLOW_TAKE
Definition game.h:680
#define GAME_DEFAULT_THREADED_SAVE
Definition game.h:671
#define GAME_MIN_INFRA
Definition game.h:357
#define GAME_MAX_TRADEWORLDRELPCT
Definition game.h:621
#define GAME_DEFAULT_MIN_PLAYERS
Definition game.h:377
#define GAME_MIN_CONQUERCOST
Definition game.h:450
#define GAME_MAX_MGR_DISTANCE
Definition game.h:511
#define GAME_DEFAULT_SPACESHIP_TRAVEL_TIME
Definition game.h:565
#define GAME_MIN_TECHLOSSREST
Definition game.h:458
#define GAME_DEFAULT_AUTOATTACK
Definition game.h:649
#define GAME_DEFAULT_SAVEFREQUENCY
Definition game.h:661
#define GAME_MAX_GOLD
Definition game.h:354
#define GAME_DEFAULT_REVEALMAP
Definition game.h:551
#define GAME_DEFAULT_SCOREFILE
Definition game.h:555
#define GAME_MAX_FIRST_TIMEOUT
Definition game.h:589
#define GAME_MIN_MGR_DISTANCE
Definition game.h:510
#define GAME_MIN_DISPERSION
Definition game.h:364
#define GAME_DEFAULT_TEAM_POOLED_RESEARCH
Definition game.h:544
#define GAME_DEFAULT_SEED
Definition game.h:348
#define GAME_DEFAULT_HOMECAUGHTUNITS
Definition game.h:494
#define GAME_MAX_GLOBAL_WARMING_PERCENT
Definition game.h:427
#define GAME_MAX_MAXCONNECTIONSPERHOST
Definition game.h:584
#define GAME_DEFAULT_NETWAIT
Definition game.h:601
#define GAME_MIN_PINGTIMEOUT
Definition game.h:610
#define GAME_MIN_TECHPENALTY
Definition game.h:533
#define GAME_MIN_CONTACTTURNS
Definition game.h:477
#define GAME_MAX_INCITE_GOLD_LOSS_CHANCE
Definition game.h:413
#define GAME_DEFAULT_KICK_TIME
Definition game.h:722
#define GAME_DEFAULT_PLRCOLORMODE
Definition game.h:708
#define GAME_MAX_CITYMINDIST
Definition game.h:467
#define GAME_DEFAULT_DIPLCHANCE
Definition game.h:441
#define GAME_MAX_NUCLEAR_WINTER_PERCENT
Definition game.h:433
#define GAME_MIN_END_TURN
Definition game.h:374
#define GAME_DEFAULT_UNRPROTECTS
Definition game.h:474
#define GAME_MIN_MGR_WORLDCHANCE
Definition game.h:518
#define GAME_DEFAULT_RAZECHANCE
Definition game.h:547
#define GAME_MIN_SHIELDBOX
Definition game.h:396
#define GAME_MIN_FIRST_TIMEOUT
Definition game.h:588
#define GAME_MAX_RAZECHANCE
Definition game.h:549
#define GAME_MIN_TIMEOUT
Definition game.h:586
#define GAME_MAX_ONSETBARBARIAN
Definition game.h:643
#define GAME_MIN_FOODBOX
Definition game.h:392
#define GAME_DEFAULT_INCITE_GOLD_LOSS_CHANCE
Definition game.h:411
#define GAME_MAX_MAX_PLAYERS
Definition game.h:383
#define GAME_DEFAULT_TRADING_CITY
Definition game.h:629
#define GAME_DEFAULT_FOODBOX
Definition game.h:391
#define GAME_DEFAULT_COMPRESS_TYPE
Definition game.h:703
#define GAME_MAX_TIMEOUT
Definition game.h:587
#define GAME_DEFAULT_PINGTIMEOUT
Definition game.h:609
#define GAME_DEFAULT_TRADE_REVENUE_STYLE
Definition game.h:637
#define GAME_DEFAULT_SAVEPALACE
Definition game.h:492
#define GAME_MIN_EVENT_CACHE_TURNS
Definition game.h:683
#define GAME_DEFAULT_GLOBAL_WARMING
Definition game.h:423
#define GAME_MAX_SEED
Definition game.h:350
#define GAME_MAX_DIPLGOLDCOST
Definition game.h:409
#define GAME_DEFAULT_TECHLOST_RECV
Definition game.h:536
#define GAME_DEFAULT_NOTRADESIZE
Definition game.h:615
#define GAME_DEFAULT_COMPRESS_LEVEL
Definition game.h:694
#define GAME_MAX_TECHLOST_DONOR
Definition game.h:542
#define GAME_MIN_SAVETURNS
Definition game.h:659
#define GAME_MAX_UNITWAITTIME
Definition game.h:592
#define GAME_DEFAULT_FIRST_TIMEOUT
Definition game.h:574
#define GAME_DEFAULT_NUCLEAR_WINTER_PERCENT
Definition game.h:431
#define GAME_MIN_CIVILWARSIZE
Definition game.h:470
#define GAME_DEFAULT_TRADING_GOLD
Definition game.h:628
#define GAME_MIN_TECHLEAK
Definition game.h:462
#define GAME_DEFAULT_TRAIT_DIST_MODE
Definition game.h:490
#define GAME_DEFAULT_NUCLEAR_WINTER
Definition game.h:429
#define GAME_MIN_DISASTERS
Definition game.h:487
#define GAME_MIN_OCCUPYCHANCE
Definition game.h:646
#define GAME_DEFAULT_FREECOST
Definition game.h:445
#define GAME_MIN_KICK_TIME
Definition game.h:723
#define GAME_DEFAULT_MAX_PLAYERS
Definition game.h:381
#define GAME_DEFAULT_CITYMINDIST
Definition game.h:465
#define GAME_MIN_NUCLEAR_WINTER_PERCENT
Definition game.h:432
#define GAME_DEFAULT_PHASE_MODE
Definition game.h:595
#define GAME_DEFAULT_AIFILL
Definition game.h:385
#define GAME_DEFAULT_TRADEWORLDRELPCT
Definition game.h:619
#define GAME_DEFAULT_MULTIRESEARCH
Definition game.h:545
#define GAME_DEFAULT_CONQUERCOST
Definition game.h:449
#define GAME_MAX_TECHPENALTY
Definition game.h:534
#define GAME_DEFAULT_TIMEOUT
Definition game.h:573
#define GAME_MAX_DISASTERS
Definition game.h:488
#define GAME_MIN_INCITE_GOLD_CAPT_CHANCE
Definition game.h:416
#define GAME_MIN_TECHLOSSFG
Definition game.h:454
#define GAME_MAX_END_TURN
Definition game.h:375
#define GAME_MIN_COMPRESS_LEVEL
Definition game.h:695
#define GAME_DEFAULT_TECHLOSSREST
Definition game.h:457
#define GAME_MIN_KILLUNHOMED
Definition game.h:529
#define GAME_MAX_NOTRADESIZE
Definition game.h:617
#define GAME_DEFAULT_CONTACTTURNS
Definition game.h:476
#define GAME_DEFAULT_SCORELOGLEVEL
Definition game.h:554
#define GAME_DEFAULT_TECHLOSSFG
Definition game.h:453
#define GAME_DEFAULT_TECHLEVEL
Definition game.h:367
#define GAME_MIN_MAX_PLAYERS
Definition game.h:382
#define GAME_DEFAULT_DISASTERS
Definition game.h:486
#define GAME_MAX_FREECOST
Definition game.h:447
#define GAME_MAX_REVOLUTION_LENGTH
Definition game.h:713
#define GAME_MAX_AIFILL
Definition game.h:387
#define GAME_DEFAULT_GOLD
Definition game.h:352
#define GAME_MIN_AQUEDUCTLOSS
Definition game.h:522
#define GAME_MIN_DIPLBULBCOST
Definition game.h:404
#define GAME_DEFAULT_MIGRATION
Definition game.h:498
@ 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:687
#define GAME_MIN_CITYMINDIST
Definition game.h:466
#define GAME_MIN_AIFILL
Definition game.h:386
#define GAME_MIN_SAVEFREQUENCY
Definition game.h:662
#define GAME_DEFAULT_NATURALCITYNAMES
Definition game.h:496
#define GAME_DEFAULT_EVENT_CACHE_TURNS
Definition game.h:682
#define GAME_DEFAULT_VICTORY_CONDITIONS
Definition game.h:562
#define GAME_MIN_UNITWAITTIME
Definition game.h:591
#define GAME_DEFAULT_FOGGEDBORDERS
Definition game.h:421
#define GAME_DEFAULT_UNITWAITTIME
Definition game.h:593
#define GAME_DEFAULT_TIMEOUTADDEMOVE
Definition game.h:579
#define GAME_DEFAULT_DISPERSION
Definition game.h:363
#define GAME_MAX_CIVILWARSIZE
Definition game.h:471
#define GAME_DEFAULT_AUTOSAVES
Definition game.h:668
#define GAME_DEFAULT_EVENT_CACHE_CHAT
Definition game.h:690
#define GAME_DEFAULT_DIPLOMACY
Definition game.h:439
#define GAME_DEFAULT_MGR_DISTANCE
Definition game.h:509
#define GAME_MIN_DIPLCHANCE
Definition game.h:442
#define GAME_DEFAULT_TURNBLOCK
Definition game.h:569
#define GAME_MAX_SAVETURNS
Definition game.h:660
#define GAME_MAX_PINGTIME
Definition game.h:607
#define GAME_DEFAULT_PINGTIME
Definition game.h:605
@ 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:521
#define GAME_DEFAULT_TRADEMINDIST
Definition game.h:633
#define GAME_DEFAULT_BARBARIANRATE
Definition game.h:639
#define GAME_DEFAULT_HAPPYBORDERS
Definition game.h:437
#define GAME_MAX_FULLTRADESIZE
Definition game.h:625
#define GAME_MAX_TECHLEAK
Definition game.h:463
#define GAME_MAX_MGR_NATIONCHANCE
Definition game.h:515
#define GAME_MAX_TECHLEVEL
Definition game.h:369
#define GAME_MAX_MGR_WORLDCHANCE
Definition game.h:519
#define GAME_MIN_MIN_PLAYERS
Definition game.h:378
#define GAME_MAX_TRADEMINDIST
Definition game.h:635
#define GAME_DEFAULT_END_TURN
Definition game.h:373
#define GAME_MAX_EVENT_CACHE_TURNS
Definition game.h:684
#define GAME_MAX_DIPLBULBCOST
Definition game.h:405
#define GAME_DEFAULT_DIPLGOLDCOST
Definition game.h:407
#define GAME_MAX_SHIELDBOX
Definition game.h:397
#define GAME_DEFAULT_TECHLEAK
Definition game.h:461
#define GAME_MAX_MIN_PLAYERS
Definition game.h:379
#define GAME_MAX_NETWAIT
Definition game.h:603
#define GAME_MIN_TCPTIMEOUT
Definition game.h:598
#define GAME_DEFAULT_END_SPACESHIP
Definition game.h:563
#define GAME_MIN_RAPTUREDELAY
Definition game.h:483
#define GAME_MIN_NETWAIT
Definition game.h:602
#define GAME_DEFAULT_EVENT_CACHE_MAX_SIZE
Definition game.h:686
#define GAME_DEFAULT_SAVE_NAME
Definition game.h:657
#define GAME_MIN_TRADEMINDIST
Definition game.h:634
#define GAME_DEFAULT_MGR_NATIONCHANCE
Definition game.h:513
#define GAME_MIN_TECHLEVEL
Definition game.h:368
#define GAME_MAX_INCITE_GOLD_CAPT_CHANCE
Definition game.h:417
#define GAME_DEFAULT_FOGOFWAR
Definition game.h:419
#define GAME_DEFAULT_PERSISTENTREADY
Definition game.h:718
#define GAME_MIN_FULLTRADESIZE
Definition game.h:624
#define GAME_DEFAULT_DIPLBULBCOST
Definition game.h:403
#define GAME_DEFAULT_RESTRICTINFRA
Definition game.h:473
#define GAME_MAX_KICK_TIME
Definition game.h:724
#define GAME_DEFAULT_CIVILWARSIZE
Definition game.h:469
void send_game_info(struct conn_list *dest)
Definition gamehand.c:905
enum unit_role_id crole_to_role_id(char crole)
Definition gamehand.c:85
const char * name
Definition inputfile.c:127
fz_method
Definition ioz.h:36
@ FZ_PLAIN
Definition ioz.h:37
static enum log_level max_level
Definition log.c:49
#define fc_assert_msg(condition, message,...)
Definition log.h:181
#define fc_assert_ret(condition)
Definition log.h:191
#define log_warn(message,...)
Definition log.h:105
#define log_verbose(message,...)
Definition log.h:109
#define fc_assert(condition)
Definition log.h:176
#define fc_assert_ret_val(condition, val)
Definition log.h:194
#define log_debug(message,...)
Definition log.h:115
#define log_normal(message,...)
Definition log.h:107
#define log_error(message,...)
Definition log.h:103
int map_startpos_count(void)
Definition map.c:1656
bool map_is_empty(void)
Definition map.c:149
#define MAP_MAX_SIZE
Definition map.h:590
#define MAP_MIN_HUTS
Definition map.h:571
#define MAP_MIN_STEEPNESS
Definition map.h:635
#define MAP_MIN_LANDMASS
Definition map.h:627
#define MAP_DEFAULT_SIZE
Definition map.h:588
#define MAP_MAX_LINEAR_SIZE
Definition map.h:606
#define MAP_MAX_TILESPERPLAYER
Definition map.h:602
#define MAP_DEFAULT_HUTS
Definition map.h:570
#define MAP_MAX_FLATPOLES
Definition map.h:656
#define MAP_MIN_TILESPERPLAYER
Definition map.h:601
#define MAP_DEFAULT_LINEAR_SIZE
Definition map.h:605
#define MAP_DEFAULT_STARTPOS
Definition map.h:644
#define MAP_DEFAULT_ANIMALS
Definition map.h:574
#define MAP_MIN_WETNESS
Definition map.h:639
#define MAP_MAX_SEED
Definition map.h:624
#define MAP_DEFAULT_TEAM_PLACEMENT
Definition map.h:670
#define MAP_DEFAULT_TOPO
Definition map.h:619
#define MAP_DEFAULT_SEED
Definition map.h:622
#define MAP_IS_ISOMETRIC
Definition map.h:40
#define MAP_MIN_TEMPERATURE
Definition map.h:667
#define MAP_DEFAULT_MAPSIZE
Definition map.h:578
#define MAP_MIN_LINEAR_SIZE
Definition map.h:607
#define MAP_MAX_STEEPNESS
Definition map.h:636
#define MAP_DEFAULT_LANDMASS
Definition map.h:626
#define MAP_MIN_FLATPOLES
Definition map.h:655
#define MAP_MAX_LANDMASS
Definition map.h:628
#define MAP_MIN_SEED
Definition map.h:623
#define MAP_MAX_ANIMALS
Definition map.h:576
#define MAP_MAX_TEMPERATURE
Definition map.h:668
#define MAP_MIN_SIZE
Definition map.h:589
#define MAP_DEFAULT_SINGLE_POLE
Definition map.h:658
#define MAP_MIN_RICHES
Definition map.h:631
#define MAP_MIN_ANIMALS
Definition map.h:575
#define MAP_DEFAULT_SEPARATE_POLES
Definition map.h:650
#define MAP_DEFAULT_RICHES
Definition map.h:630
#define MAP_DEFAULT_TINYISLES
Definition map.h:646
#define MAP_DEFAULT_TILESPERPLAYER
Definition map.h:600
#define MAP_DEFAULT_TEMPERATURE
Definition map.h:666
#define MAP_DEFAULT_ALLTEMPERATE
Definition map.h:662
#define MAP_MAX_RICHES
Definition map.h:632
#define MAP_DEFAULT_GENERATOR
Definition map.h:642
#define MAP_MAX_HUTS
Definition map.h:572
#define MAP_DEFAULT_FLATPOLES
Definition map.h:654
#define MAP_DEFAULT_WETNESS
Definition map.h:638
#define MAP_MAX_WETNESS
Definition map.h:640
#define MAP_DEFAULT_STEEPNESS
Definition map.h:634
@ 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:482
bool send_server_info_to_metaserver(enum meta_flag flag)
Definition meta.c:490
void set_user_meta_message_string(const char *string)
Definition meta.c:187
@ META_INFO
Definition meta.h:26
const struct rgbcolor * nation_color(const struct nation_type *pnation)
Definition nation.c:681
struct nation_set * nation_set_by_rule_name(const char *name)
Definition nation.c:778
#define nations_iterate_end
Definition nation.h:335
#define nations_iterate(NAME_pnation)
Definition nation.h:332
#define NO_NATION_SELECTED
Definition nation.h:29
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:125
int player_count(void)
Definition player.c:808
bool player_set_nation(struct player *pplayer, struct nation_type *pnation)
Definition player.c:852
#define players_iterate_end
Definition player.h:535
#define players_iterate(_pplayer)
Definition player.h:530
plrcolor_mode
Definition player.h:50
@ PLRCOL_PLR_RANDOM
Definition player.h:52
@ PLRCOL_PLR_SET
Definition player.h:53
@ PLRCOL_NATION_ORDER
Definition player.h:55
@ PLRCOL_TEAM_ORDER
Definition player.h:54
@ PLRCOL_PLR_ORDER
Definition player.h:51
#define is_human(plr)
Definition player.h:233
void send_nation_availability(struct conn_list *dest, bool nationset_change)
Definition plrhand.c:2471
int normal_player_count(void)
Definition plrhand.c:3034
void server_player_set_color(struct player *pplayer, const struct rgbcolor *prgbcolor)
Definition plrhand.c:1652
void send_player_info_c(struct player *src, struct conn_list *dest)
Definition plrhand.c:1000
void count_playable_nations(void)
Definition plrhand.c:2428
bool nation_is_in_current_set(const struct nation_type *pnation)
Definition plrhand.c:2419
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,...)
struct entry * secfile_entry_lookup(const struct section_file *secfile, 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:1302
bool is_valid_demography(const char *demography, int *error)
Definition report.c:946
void log_civ_score_init(void)
Definition report.c:1279
bool autolock_settings(void)
Definition rssanity.c:1639
bool setting_int_validate(const struct setting *pset, int val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3583
static void metamessage_action(const struct setting *pset)
Definition settings.c:793
static const struct sset_val_name * phasemode_name(int phasemode)
Definition settings.c:529
void settings_init(bool act)
Definition settings.c:4952
static bool savename_validate(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:813
static const char * setting_bool_to_str(const struct setting *pset, bool value, bool pretty, char *buf, size_t buf_len)
Definition settings.c:3427
#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:1021
void setting_action(const struct setting *pset)
Definition settings.c:4168
bool(* bitwise_validate_func_t)(unsigned value, struct connection *pconn, char *reject_msg, size_t reject_msg_len)
Definition settings.c:79
static const struct sset_val_name * revealmap_name(int bit)
Definition settings.c:499
#define GEN_BOOL(name, value, sclass, scateg, slevel, al_read, al_write, short_help, extra_help, func_validate, func_action, _default)
Definition settings.c:1316
int setting_int_get(struct setting *pset)
Definition settings.c:3608
static const char * setting_bool_secfile_str(secfile_data_t data, int val)
Definition settings.c:3522
static void nationset_action(const struct setting *pset)
Definition settings.c:668
const char * setting_default_name(const struct setting *pset, bool pretty, char *buf, size_t buf_len)
Definition settings.c:4102
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:3861
struct setting * setting_by_name(const char *name)
Definition settings.c:3138
static const struct sset_val_name * compresstype_name(enum fz_method compresstype)
Definition settings.c:557
void setting_set_to_default(struct setting *pset)
Definition settings.c:4138
static void timeout_action(const struct setting *pset)
Definition settings.c:733
static const struct sset_val_name * startpos_name(int startpos)
Definition settings.c:297
const char * setting_value_name(const struct setting *pset, bool pretty, char *buf, size_t buf_len)
Definition settings.c:4066
void settings_game_load(struct section_file *file, const char *section)
Definition settings.c:4648
const char * setting_extra_help(const struct setting *pset, bool constant)
Definition settings.c:3179
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:3385
const char *(* help_callback_func_t)(const struct setting *pset)
Definition settings.c:85
int setting_number(const struct setting *pset)
Definition settings.c:3153
struct setting * setting_by_number(int id)
Definition settings.c:3130
bool setting_int_set(struct setting *pset, int val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3563
enum sset_category setting_category(const struct setting *pset)
Definition settings.c:3207
bool setting_is_visible(const struct setting *pset, struct connection *caller)
Definition settings.c:3326
static bool first_timeout_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1122
bool setting_locked(const struct setting *pset)
Definition settings.c:4420
bool setting_non_default(const struct setting *pset)
Definition settings.c:4394
static bool xsize_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1185
static const struct sset_val_name * airliftingstyle_name(int bit)
Definition settings.c:511
enum sset_type setting_type(const struct setting *pset)
Definition settings.c:3191
void settings_free(void)
Definition settings.c:4993
static const struct sset_val_name * caravanbonusstyle_name(int caravanbonus)
Definition settings.c:225
static void settings_list_free(void)
Definition settings.c:5324
bool setting_str_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3634
#define GEN_STRING(name, value, sclass, scateg, slevel, al_read, al_write, short_help, extra_help, func_validate, func_action, _default)
Definition settings.c:1336
static const struct sset_val_name * bool_name(int enable)
Definition settings.c:580
bool init
Definition settings.c:182
static const struct sset_val_name * revolentype_name(int revolentype)
Definition settings.c:485
int setting_int_max(const struct setting *pset)
Definition settings.c:3553
void setting_lock_set(struct setting *pset, bool lock)
Definition settings.c:4428
enum sset_level setting_level(const struct setting *pset)
Definition settings.c:3199
static struct setting settings[]
Definition settings.c:1378
static void first_timeout_action(const struct setting *pset)
Definition settings.c:750
static bool allowtake_callback(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:921
static bool setting_ruleset_one(struct section_file *file, const char *name, const char *path)
Definition settings.c:4232
static const char * setting_bitwise_to_str(const struct setting *pset, unsigned value, bool pretty, char *buf, size_t buf_len)
Definition settings.c:3906
static const struct sset_val_name * topology_name(int topology_bit)
Definition settings.c:253
bool setting_bitwise_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:4022
static void topology_action(const struct setting *pset)
Definition settings.c:778
const char * setting_enum_secfile_str(secfile_data_t data, int val)
Definition settings.c:3690
void settings_game_save(struct section_file *file, const char *section)
Definition settings.c:4561
int settings_number(void)
Definition settings.c:5005
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:3654
static const struct sset_val_name * traderevenuestyle_name(int revenue_style)
Definition settings.c:267
bool(* string_validate_func_t)(const char *value, struct connection *pconn, char *reject_msg, size_t reject_msg_len)
Definition settings.c:72
#define NAME_CASE(_val, _support, _pretty)
Definition settings.c:215
void settings_turn(void)
Definition settings.c:4985
#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:1346
bool settings_ruleset(struct section_file *file, const char *section, bool act)
Definition settings.c:4178
static bool setting_is_free_to_change(const struct setting *pset, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3217
static const char * setting_enum_to_str(const struct setting *pset, int value, bool pretty, char *buf, size_t buf_len)
Definition settings.c:3722
const char * setting_enum_val(const struct setting *pset, int val, bool pretty)
Definition settings.c:3702
struct setting_list * level[OLEVELS_NUM]
Definition settings.c:183
static bool compresstype_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1279
void setting_changed(struct setting *pset)
Definition settings.c:5341
#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:1356
static bool startunits_callback(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:967
static void huts_action(const struct setting *pset)
Definition settings.c:770
static bool nationset_callback(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1063
enum setting_default_level setting_get_setdef(const struct setting *pset)
Definition settings.c:5349
static bool mapsize_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1166
static const char * setting_int_to_str(const struct setting *pset, int value, bool pretty, char *buf, size_t buf_len)
Definition settings.c:3533
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:3448
static bool demography_callback(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:877
bool(* enum_validate_func_t)(int value, struct connection *pconn, char *reject_msg, size_t reject_msg_len)
Definition settings.c:76
void settings_game_start(void)
Definition settings.c:4548
bool setting_enum_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3832
const char * setting_short_help(const struct setting *pset)
Definition settings.c:3170
static const struct sset_val_name * citynames_name(int citynames)
Definition settings.c:456
void send_server_setting_control(struct connection *pconn)
Definition settings.c:5177
static bool plrcol_validate(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1297
static const struct sset_val_name * generator_name(int generator)
Definition settings.c:281
const char * setting_bitwise_bit(const struct setting *pset, int bit, bool pretty)
Definition settings.c:3887
static bool autosaves_callback(unsigned value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:897
static bool maxplayers_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1036
int setting_int_min(const struct setting *pset)
Definition settings.c:3544
bool(* bool_validate_func_t)(bool value, struct connection *pconn, char *reject_msg, size_t reject_msg_len)
Definition settings.c:66
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:3744
static void autotoggle_action(const struct setting *pset)
Definition settings.c:717
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:4043
static const struct sset_val_name * victory_conditions_name(int condition_bit)
Definition settings.c:352
#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:1325
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:3508
struct setting_list * settings_list_get(enum sset_level level)
Definition settings.c:5312
bool setting_is_changeable(const struct setting *pset, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3289
static const struct sset_val_name * teamplacement_name(int team_placement)
Definition settings.c:317
int settings_list_cmp(const struct setting *const *pset1, const struct setting *const *pset2)
Definition settings.c:5299
static struct @114 setting_sorted
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:3971
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:3340
static void settings_list_init(void)
Definition settings.c:5212
void settings_reset(void)
Definition settings.c:4971
const char * setting_name(const struct setting *pset)
Definition settings.c:3162
static const int SETTINGS_NUM
Definition settings.c:3125
static const char * phasemode_help(const struct setting *pset)
Definition settings.c:598
static bool ysize_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1210
bool settings_game_reset(void)
Definition settings.c:4935
static void scorelog_action(const struct setting *pset)
Definition settings.c:643
static const struct sset_val_name * happyborders_name(int happyborders)
Definition settings.c:425
int setting_bitwise_get(struct setting *pset)
Definition settings.c:4056
static const struct sset_val_name * scoreloglevel_name(enum scorelog_level sl_level)
Definition settings.c:544
void settings_list_update(void)
Definition settings.c:5270
static bool timeout_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1084
sset_class
Definition settings.c:53
@ SSET_RULES
Definition settings.c:60
@ SSET_PLAYERS
Definition settings.c:57
@ SSET_GAME_INIT
Definition settings.c:59
@ SSET_MAP_GEN
Definition settings.c:55
@ SSET_RULES_FLEXIBLE
Definition settings.c:62
@ SSET_META
Definition settings.c:63
@ SSET_MAP_ADD
Definition settings.c:56
@ SSET_PLAYERS_CHANGEABLE
Definition settings.c:58
@ SSET_MAP_SIZE
Definition settings.c:54
@ SSET_RULES_SCENARIO
Definition settings.c:61
static bool generator_validate(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:834
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:3618
void(* action_callback_func_t)(const struct setting *pset)
Definition settings.c:84
#define settings_snprintf(_buf, _buf_len, format,...)
Definition settings.c:197
char * setting_str_get(struct setting *pset)
Definition settings.c:3679
const struct sset_val_name *(* val_name_func_t)(int value)
Definition settings.c:86
bool setting_bool_get(struct setting *pset)
Definition settings.c:3496
static bool set_enum_value(struct setting *pset, int val)
Definition settings.c:3771
static void setting_game_set(struct setting *pset, bool init)
Definition settings.c:4436
static void setting_game_free(struct setting *pset)
Definition settings.c:4476
static bool scorefile_validate(const char *value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:860
const char * setting_bitwise_secfile_str(secfile_data_t data, int bit)
Definition settings.c:3875
static void aifill_action(const struct setting *pset)
Definition settings.c:655
static const struct sset_val_name * trait_dist_name(int trait_dist)
Definition settings.c:398
bool setting_is_visible_at_level(const struct setting *pset, enum cmdlevel plevel)
Definition settings.c:3316
static const struct sset_val_name * plrcol_name(int plrcol)
Definition settings.c:410
bool setting_bool_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3477
void send_server_setting(struct conn_list *dest, const struct setting *pset)
Definition settings.c:5014
static const char * huts_help(const struct setting *pset)
Definition settings.c:616
static const struct sset_val_name * persistentready_name(int persistent_ready)
Definition settings.c:337
void send_server_settings(struct conn_list *dest)
Definition settings.c:5133
#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:1367
static const struct sset_val_name * mapsize_name(int mapsize)
Definition settings.c:240
static void plrcol_action(const struct setting *pset)
Definition settings.c:701
void send_server_access_level_settings(struct conn_list *dest, enum cmdlevel old_level, enum cmdlevel new_level)
Definition settings.c:5145
static const struct sset_val_name * diplomacy_name(int diplomacy)
Definition settings.c:438
static const struct sset_val_name * barbarians_name(int barbarians)
Definition settings.c:470
static void setting_game_restore(struct setting *pset)
Definition settings.c:4486
int read_enum_value(const struct setting *pset)
Definition settings.c:3805
static const struct sset_val_name * borders_name(int borders)
Definition settings.c:382
static const struct sset_val_name * autosaves_name(int autosaves_bit)
Definition settings.c:366
bool(* int_validate_func_t)(int value, struct connection *pconn, char *reject_msg, size_t reject_msg_len)
Definition settings.c:69
static bool unitwaittime_callback(int value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1140
static bool topology_callback(unsigned value, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:1243
#define settings_iterate(_level, _pset)
Definition settings.h:177
#define settings_iterate_end
Definition settings.h:183
bool is_safe_filename(const char *name)
Definition shared.c:252
void remove_leading_trailing_spaces(char *s)
Definition shared.c:443
#define ARRAY_SIZE(x)
Definition shared.h:85
#define MIN(x, y)
Definition shared.h:55
#define MAX_LEN_PATH
Definition shared.h:32
m_pre_result
Definition shared.h:207
@ M_PRE_EXACT
Definition shared.h:208
@ M_PRE_ONLY
Definition shared.h:209
@ M_PRE_LAST
Definition shared.h:214
@ M_PRE_LONG
Definition shared.h:212
@ M_PRE_AMBIGUOUS
Definition shared.h:210
@ M_PRE_EMPTY
Definition shared.h:211
@ M_PRE_FAIL
Definition shared.h:213
size_t size
Definition specvec.h:72
const char * aifill(int amount)
Definition srv_main.c:2395
bool game_was_started(void)
Definition srv_main.c:339
enum server_states server_state(void)
Definition srv_main.c:323
void toggle_ai_player_direct(struct connection *caller, struct player *pplayer)
Definition stdinhand.c:704
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:139
int contactturns
Definition game.h:136
enum city_names_mode allowed_city_names
Definition game.h:126
int unitwaittime
Definition game.h:197
bool multiresearch
Definition game.h:162
int incite_gold_capt_chance
Definition game.h:141
int mgr_worldchance
Definition game.h:161
int kick_time
Definition game.h:152
bool chat
Definition game.h:249
enum barbarians_rate barbarianrate
Definition game.h:132
int dispersion
Definition game.h:142
bool threaded_save
Definition game.h:179
int max_size
Definition game.h:248
int save_compress_level
Definition game.h:180
int tcptimeout
Definition game.h:194
struct civ_game::@30::@34 server
char start_units[MAX_LEN_STARTUNIT]
Definition game.h:188
int save_nturns
Definition game.h:182
int mgr_nationchance
Definition game.h:159
bool fixedlength
Definition game.h:145
int techlost_recv
Definition game.h:193
bool mgr_foodneeded
Definition game.h:158
struct civ_game::@30::@34::@35 event_cache
int diplchance
Definition game.h:137
int netwait
Definition game.h:167
int incite_gold_loss_chance
Definition game.h:140
int end_turn
Definition game.h:143
bool settings_gamestart_valid
Definition game.h:240
enum plrcolor_mode plrcolormode
Definition game.h:127
int onsetbarbarian
Definition game.h:170
int spaceship_travel_time
Definition game.h:178
char demography[MAX_LEN_DEMOGRAPHY]
Definition game.h:237
struct conn_list * est_connections
Definition game.h:97
struct packet_game_info info
Definition game.h:89
int mgr_turninterval
Definition game.h:160
char user_message[256]
Definition game.h:262
int min_players
Definition game.h:165
unsigned autosaves
Definition game.h:184
struct timer * save_timer
Definition game.h:216
bool endspaceship
Definition game.h:144
enum scorelog_level scoreloglevel
Definition game.h:221
bool migration
Definition game.h:163
bool ip_hide
Definition game.h:173
int diplbulbcost
Definition game.h:138
struct civ_game::@30::@34::@37 meta_info
bool natural_city_names
Definition game.h:166
int maxconnectionsperhost
Definition game.h:154
struct packet_scenario_info scenario
Definition game.h:87
int pingtimeout
Definition game.h:172
int occupychance
Definition game.h:169
randseed seed_setting
Definition game.h:224
int killunhomed
Definition game.h:153
int nuclear_winter_percent
Definition game.h:230
int conquercost
Definition game.h:135
unsigned revealmap
Definition game.h:176
int pingtime
Definition game.h:171
int techloss_restore
Definition game.h:191
int civilwarsize
Definition game.h:134
bool savepalace
Definition game.h:186
int freecost
Definition game.h:147
char nationset[MAX_LEN_NAME]
Definition game.h:156
int aqueductloss
Definition game.h:128
char save_name[MAX_LEN_NAME]
Definition game.h:219
enum fz_method save_compress_type
Definition game.h:181
enum trait_dist_mode trait_dist
Definition game.h:164
bool foggedborders
Definition game.h:146
bool homecaughtunits
Definition game.h:187
struct packet_timeout_info tinfo
Definition game.h:91
char allow_take[MAX_LEN_ALLOW_TAKE]
Definition game.h:238
bool autoattack
Definition game.h:130
int phase_mode_stored
Definition game.h:215
bool start_city
Definition game.h:189
int max_players
Definition game.h:155
int revolution_length
Definition game.h:177
int turns
Definition game.h:247
char scorefile[MAX_LEN_NAME]
Definition game.h:222
bool auto_ai_toggle
Definition game.h:129
int save_frequency
Definition game.h:183
int mgr_distance
Definition game.h:157
int global_warming_percent
Definition game.h:228
int techlost_donor
Definition game.h:192
int timeoutaddenemymove
Definition game.h:207
bool scorelog
Definition game.h:220
int techpenalty
Definition game.h:195
int razechance
Definition game.h:175
bool turnblock
Definition game.h:196
int animals
Definition map_types.h:93
int xsize
Definition map_types.h:77
bool tinyisles
Definition map_types.h:97
int ysize
Definition map_types.h:77
int riches
Definition map_types.h:90
bool alltemperate
Definition map_types.h:101
enum mapsize_type mapsize
Definition map_types.h:85
enum map_startpos startpos
Definition map_types.h:96
int steepness
Definition map_types.h:104
int wetness
Definition map_types.h:103
int size
Definition map_types.h:86
int tilesperplayer
Definition map_types.h:87
randseed seed_setting
Definition map_types.h:88
int landpercent
Definition map_types.h:94
struct civ_map::@41::@43 server
enum team_placement team_placement
Definition map_types.h:108
int topology_id
Definition map_types.h:72
int flatpoles
Definition map_types.h:99
int huts
Definition map_types.h:91
bool single_pole
Definition map_types.h:100
enum map_generator generator
Definition map_types.h:95
bool separatepoles
Definition map_types.h:98
int temperature
Definition map_types.h:102
int huts_absolute
Definition map_types.h:92
enum cmdlevel access_level
Definition connection.h:182
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 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:93
char * game_value
Definition settings.c:147
enum setting_default_level setdef
Definition settings.c:177
const char *const default_value
Definition settings.c:144
bool game_value
Definition settings.c:130
const int_validate_func_t validate
Definition settings.c:138
enum sset_class sclass
Definition settings.c:90
const int default_value
Definition settings.c:135
enum cmdlevel access_level_write
Definition settings.c:94
int *const pvalue
Definition settings.c:134
const val_name_func_t name
Definition settings.c:129
const int max_value
Definition settings.c:137
int game_value
Definition settings.c:139
unsigned game_value
Definition settings.c:164
char *const value
Definition settings.c:143
const help_callback_func_t help_func
Definition settings.c:111
const char * name
Definition settings.c:89
struct setting::@115::@118 integer
enum setting_default_level game_setdef
Definition settings.c:178
bool *const pvalue
Definition settings.c:126
const enum_validate_func_t validate
Definition settings.c:154
struct setting::@115::@119 string
const char * extra_help
Definition settings.c:108
const char * short_help
Definition settings.c:100
const int store_size
Definition settings.c:152
bool locked
Definition settings.c:172
struct setting::@115::@117 boolean
struct setting::@115::@121 bitwise
const action_callback_func_t action
Definition settings.c:169
bool ruleset_settable
Definition settings.c:174
void *const pvalue
Definition settings.c:151
const int min_value
Definition settings.c:136
enum sset_type stype
Definition settings.c:113
struct setting::@115::@120 enumerator
const bool_validate_func_t validate
Definition settings.c:128
const string_validate_func_t validate
Definition settings.c:146
const size_t value_size
Definition settings.c:145
const bitwise_validate_func_t validate
Definition settings.c:162
const unsigned default_value
Definition settings.c:161
const bool default_value
Definition settings.c:127
unsigned *const pvalue
Definition settings.c:160
enum sset_level slevel
Definition settings.c:115
enum sset_category scategory
Definition settings.c:114
const char * support
Definition settings.h:29
const char * pretty
Definition settings.h:31
Definition map.c:41
char ** vec
struct civ_map map
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:969
size_t fc_strlcpy(char *dest, const char *src, size_t n)
Definition support.c:787
int fc_strcasecmp(const char *str0, const char *str1)
Definition support.c:189
size_t fc_strlcat(char *dest, const char *src, size_t n)
Definition support.c:832
int fc_strncasecmp(const char *str0, const char *str1, size_t n)
Definition support.c:238
#define sz_strlcpy(dest, src)
Definition support.h:167
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
#define bool
Definition support.h:61
#define fc__fallthrough
Definition support.h:109
#define terrain_type_iterate(_p)
Definition terrain.h:358
#define terrain_type_iterate_end
Definition terrain.h:364
#define terrain_has_flag(terr, flag)
Definition terrain.h:269
void timer_destroy(struct timer *t)
Definition timing.c:191
void timer_start(struct timer *t)
Definition timing.c:224
void timer_stop(struct timer *t)
Definition timing.c:268
struct timer * timer_renew(struct timer *t, enum timer_timetype type, enum timer_use use)
Definition timing.c:176
@ TIMER_ACTIVE
Definition timing.h:45
@ TIMER_USER
Definition timing.h:41
struct unit_type * get_role_unit(int role, int role_index)
Definition unittype.c:2301
#define utype_class(_t_)
Definition unittype.h:736
#define uclass_index(_c_)
Definition unittype.h:729
#define enable(id)
Definition widget.h:223