Freeciv-3.2: /fast/freeciv/nightly/S3_2/server/settings.c Source File

Freeciv-3.2

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