add changeable server parameters

A list of parameters is read from config/serverparameters.cfg once per
minute and the values written to corresponding server data structures.

If the binary is compiled in debug mode, starting a dedicated server
will write a blank config file with all possible parameters and their
descriptions, sorted and grouped into chapters.

The name of the config file can be set with the commandline parameter -A.

So far, syntax errors are not reported. Instead, it's possible to dump
all current values to a file every time something changes.
This commit is contained in:
ac-stef
2017-06-27 15:15:22 +02:00
parent 3376c5e299
commit 7486317497
6 changed files with 287 additions and 10 deletions
+3 -2
View File
@@ -561,7 +561,7 @@ const char *hiddenpwd(const char *pwd, int showchars)
int getlistindex(const char *key, const char *list[], bool acceptnumeric, int deflt)
{
int max = 0;
while(list[max][0]) if(!strcasecmp(key, list[max])) return max; else max++;
while(list[max] && list[max][0]) if(!strcasecmp(key, list[max])) return max; else max++;
if(acceptnumeric && isdigit(key[0]))
{
int i = (int)strtol(key, NULL, 0);
@@ -569,7 +569,8 @@ int getlistindex(const char *key, const char *list[], bool acceptnumeric, int de
}
#if !defined(STANDALONE) && defined(_DEBUG)
char *opts = conc(list, -1, true);
if(*key) clientlogf("warning: unknown token \"%s\" (not in list [%s])", key, opts);
extern bool isdedicated;
if(!isdedicated && *key) clientlogf("warning: unknown token \"%s\" (not in list [%s])", key, opts);
delstring(opts);
#endif
return deflt;