Freeciv-3.3: /fast/freeciv/nightly/main/server/settings.c Source File

Freeciv-3.3

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