2011-03-03 21:06:24 +00:00
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file table/settings.h Settings to save in the savegame and config file. */
2011-03-06 10:35:40 +00:00
/* Callback function used in _settings[] as well as _company_settings[] */
2011-05-29 18:35:31 +00:00
static size_t ConvertLandscape(const char *value);
2011-03-03 21:06:24 +00:00
/****************************
* OTTD specific INI stuff
2020-06-05 02:32:26 +00:00
****************************
* DO NOT edit this file. This file is automatically generated from the contents of /src/table/
*/
2011-03-03 21:06:24 +00:00
/**
* Settings-macro usage:
* The list might look daunting at first, but is in general easy to understand.
2013-02-14 11:06:01 +00:00
* The macros can be grouped depending on where the config variable is
* stored:
2011-03-03 21:06:24 +00:00
* 1. SDTG_something
2013-02-14 11:06:01 +00:00
* These are for global variables, so this is the one you will use
* for a #SettingDescGlobVarList section. Here 'var' refers to a
* global variable.
* 2. SDTC_something
* These are for client-only variables. Here the 'var' refers to an
* entry inside _settings_client.
* 3. SDT_something
2020-06-05 02:31:28 +00:00
* These are for members in the struct described by the current
2013-02-14 11:06:01 +00:00
* #SettingDesc list / .ini file. Here, 'base' specifies type of the
* struct while 'var' points out the member of the struct (the actual
2019-09-29 20:27:32 +00:00
* struct to store it in is implicitly defined by the #SettingDesc
2013-02-14 11:06:01 +00:00
* list / .ini file preamble the entry is in).
*
* The something part defines the type of variable to store. There are a
* lot of types. Easy ones are:
2011-03-03 21:06:24 +00:00
* - VAR: any number type, 'type' field specifies what number. eg int8 or uint32
* - BOOL: a boolean number type
* - STR: a string or character. 'type' field specifies what string. Normal, string, or quoted
* A bit more difficult to use are MMANY (meaning ManyOfMany) and OMANY (OneOfMany)
* These are actually normal numbers, only bitmasked. In MMANY several bits can
* be set, in the other only one.
* If nothing fits you, you can use the GENERAL macros, but it exposes the
* internal structure somewhat so it needs a little looking. There are _NULL()
* macros as well, these fill up space so you can add more settings there (in
* place) and you DON'T have to increase the savegame version.
*
* While reading values from openttd.cfg, some values may not be converted
* properly, for any kind of reasons. In order to allow a process of self-cleaning
* mechanism, a callback procedure is made available. You will have to supply the function, which
* will work on a string, one function per setting. And of course, enable the callback param
* on the appropriate macro.
*/
2021-02-15 23:09:52 +00:00
#define NSD_GENERAL(name, def, cmd, guiflags, min, max, interval, many, str, strhelp, strval, proc, load, cat, startup)\
{name, (const void*)(size_t)(def), cmd, guiflags, min, max, interval, many, str, strhelp, strval, proc, load, cat, startup}
2011-03-03 21:06:24 +00:00
/* Macros for various objects to go in the configuration file.
* This section is for global variables */
2021-02-15 23:09:52 +00:00
#define SDTG_GENERAL(name, sdt_cmd, sle_cmd, type, flags, guiflags, var, length, def, min, max, interval, full, str, strhelp, strval, proc, from, to, cat, extra, startup)\
{NSD_GENERAL(name, def, sdt_cmd, guiflags, min, max, interval, full, str, strhelp, strval, proc, nullptr, cat, startup), SLEG_GENERAL(sle_cmd, var, type | flags, length, from, to, extra)}
2011-03-03 21:06:24 +00:00
2021-02-15 23:09:52 +00:00
#define SDTG_VAR(name, type, flags, guiflags, var, def, min, max, interval, str, strhelp, strval, proc, from, to, cat, extra, startup)\
SDTG_GENERAL(name, SDT_NUMX, SL_VAR, type, flags, guiflags, var, 0, def, min, max, interval, nullptr, str, strhelp, strval, proc, from, to, cat, extra, startup)
2011-03-03 21:06:24 +00:00
2021-02-15 23:09:52 +00:00
#define SDTG_BOOL(name, flags, guiflags, var, def, str, strhelp, strval, proc, from, to, cat, extra, startup)\
SDTG_GENERAL(name, SDT_BOOLX, SL_VAR, SLE_BOOL, flags, guiflags, var, 0, def, 0, 1, 0, nullptr, str, strhelp, strval, proc, from, to, cat, extra, startup)
2011-03-03 21:06:24 +00:00
2021-02-15 23:09:52 +00:00
#define SDTG_LIST(name, type, length, flags, guiflags, var, def, str, strhelp, strval, proc, from, to, cat, extra, startup)\
SDTG_GENERAL(name, SDT_INTLIST, SL_ARR, type, flags, guiflags, var, length, def, 0, 0, 0, nullptr, str, strhelp, strval, proc, from, to, cat, extra, startup)
2011-03-03 21:06:24 +00:00
2021-02-15 23:09:52 +00:00
#define SDTG_SSTR(name, type, flags, guiflags, var, def, str, strhelp, strval, proc, from, to, cat, extra, startup)\
SDTG_GENERAL(name, SDT_STDSTRING, SL_STDSTR, type, flags, guiflags, var, sizeof(var), def, 0, 0, 0, nullptr, str, strhelp, strval, proc, from, to, cat, extra, startup)
2020-05-17 21:32:06 +00:00
2021-02-15 23:09:52 +00:00
#define SDTG_OMANY(name, type, flags, guiflags, var, def, max, full, str, strhelp, strval, proc, from, to, cat, extra, startup)\
SDTG_GENERAL(name, SDT_ONEOFMANY, SL_VAR, type, flags, guiflags, var, 0, def, 0, max, 0, full, str, strhelp, strval, proc, from, to, cat, extra, startup)
2011-03-03 21:06:24 +00:00
2021-02-15 23:09:52 +00:00
#define SDTG_MMANY(name, type, flags, guiflags, var, def, full, str, strhelp, strval, proc, from, to, cat, extra, startup)\
SDTG_GENERAL(name, SDT_MANYOFMANY, SL_VAR, type, flags, guiflags, var, 0, def, 0, 0, 0, full, str, strhelp, strval, proc, from, to, cat, extra, startup)
2011-03-03 21:06:24 +00:00
2011-03-05 10:47:49 +00:00
#define SDTG_NULL(length, from, to)\
2021-02-15 23:09:52 +00:00
{{"", nullptr, SDT_NUMX, SGF_NONE, 0, 0, 0, nullptr, STR_NULL, STR_NULL, STR_NULL, nullptr, nullptr, SC_NONE, false}, SLEG_NULL(length, from, to)}
2011-03-03 21:06:24 +00:00
2021-02-15 23:09:52 +00:00
#define SDTG_END() {{nullptr, nullptr, SDT_NUMX, SGF_NONE, 0, 0, 0, nullptr, STR_NULL, STR_NULL, STR_NULL, nullptr, nullptr, SC_NONE, false}, SLEG_END()}
2011-03-03 21:06:24 +00:00
/* Macros for various objects to go in the configuration file.
* This section is for structures where their various members are saved */
2021-02-15 23:09:52 +00:00
#define SDT_GENERAL(name, sdt_cmd, sle_cmd, type, flags, guiflags, base, var, length, def, min, max, interval, full, str, strhelp, strval, proc, load, from, to, cat, extra, startup)\
{NSD_GENERAL(name, def, sdt_cmd, guiflags, min, max, interval, full, str, strhelp, strval, proc, load, cat, startup), SLE_GENERAL(sle_cmd, base, var, type | flags, length, from, to, extra)}
2011-03-03 21:06:24 +00:00
2021-02-15 23:09:52 +00:00
#define SDT_VAR(base, var, type, flags, guiflags, def, min, max, interval, str, strhelp, strval, proc, from, to, cat, extra, startup)\
SDT_GENERAL(#var, SDT_NUMX, SL_VAR, type, flags, guiflags, base, var, 1, def, min, max, interval, nullptr, str, strhelp, strval, proc, nullptr, from, to, cat, extra, startup)
2011-03-03 21:06:24 +00:00
2021-02-15 23:09:52 +00:00
#define SDT_BOOL(base, var, flags, guiflags, def, str, strhelp, strval, proc, from, to, cat, extra, startup)\
SDT_GENERAL(#var, SDT_BOOLX, SL_VAR, SLE_BOOL, flags, guiflags, base, var, 1, def, 0, 1, 0, nullptr, str, strhelp, strval, proc, nullptr, from, to, cat, extra, startup)
2011-03-03 21:06:24 +00:00
2021-02-15 23:09:52 +00:00
#define SDT_LIST(base, var, type, flags, guiflags, def, str, strhelp, strval, proc, from, to, cat, extra, startup)\
SDT_GENERAL(#var, SDT_INTLIST, SL_ARR, type, flags, guiflags, base, var, lengthof(((base*)8)->var), def, 0, 0, 0, nullptr, str, strhelp, strval, proc, nullptr, from, to, cat, extra, startup)
2011-03-03 21:06:24 +00:00
2021-04-28 14:30:49 +00:00
#define SDT_SSTR(base, var, type, flags, guiflags, def, str, strhelp, strval, proc, from, to, cat, extra, startup)\
SDT_GENERAL(#var, SDT_STDSTRING, SL_STDSTR, type, flags, guiflags, base, var, sizeof(((base*)8)->var), def, 0, 0, 0, nullptr, str, strhelp, strval, proc, nullptr, from, to, cat, extra, startup)
2021-02-15 23:09:52 +00:00
#define SDT_OMANY(base, var, type, flags, guiflags, def, max, full, str, strhelp, strval, proc, from, to, load, cat, extra, startup)\
SDT_GENERAL(#var, SDT_ONEOFMANY, SL_VAR, type, flags, guiflags, base, var, 1, def, 0, max, 0, full, str, strhelp, strval, proc, load, from, to, cat, extra, startup)
2011-03-03 21:06:24 +00:00
2021-02-15 23:09:52 +00:00
#define SDT_MMANY(base, var, type, flags, guiflags, def, full, str, proc, strhelp, strval, from, to, cat, extra, startup)\
SDT_GENERAL(#var, SDT_MANYOFMANY, SL_VAR, type, flags, guiflags, base, var, 1, def, 0, 0, 0, full, str, strhelp, strval, proc, nullptr, from, to, cat, extra, startup)
2011-03-03 21:06:24 +00:00
2011-03-05 10:47:49 +00:00
#define SDT_NULL(length, from, to)\
2021-02-15 23:09:52 +00:00
{{"", nullptr, SDT_NUMX, SGF_NONE, 0, 0, 0, nullptr, STR_NULL, STR_NULL, STR_NULL, nullptr, nullptr, SC_NONE, false}, SLE_CONDNULL(length, from, to)}
2011-03-03 21:06:24 +00:00
2021-02-15 23:09:52 +00:00
#define SDTC_VAR(var, type, flags, guiflags, def, min, max, interval, str, strhelp, strval, proc, from, to, cat, extra, startup)\
SDTG_GENERAL(#var, SDT_NUMX, SL_VAR, type, flags, guiflags, _settings_client.var, 1, def, min, max, interval, nullptr, str, strhelp, strval, proc, from, to, cat, extra, startup)
2011-03-03 21:06:24 +00:00
2021-02-15 23:09:52 +00:00
#define SDTC_BOOL(var, flags, guiflags, def, str, strhelp, strval, proc, from, to, cat, extra, startup)\
SDTG_GENERAL(#var, SDT_BOOLX, SL_VAR, SLE_BOOL, flags, guiflags, _settings_client.var, 1, def, 0, 1, 0, nullptr, str, strhelp, strval, proc, from, to, cat, extra, startup)
2011-03-03 21:06:24 +00:00
2021-02-15 23:09:52 +00:00
#define SDTC_LIST(var, type, flags, guiflags, def, str, strhelp, strval, proc, from, to, cat, extra, startup)\
SDTG_GENERAL(#var, SDT_INTLIST, SL_ARR, type, flags, guiflags, _settings_client.var, lengthof(_settings_client.var), def, 0, 0, 0, nullptr, str, strhelp, strval, proc, from, to, cat, extra, startup)
2011-03-03 21:06:24 +00:00
2021-04-27 18:26:56 +00:00
#define SDTC_SSTR(var, type, flags, guiflags, def, max_length, str, strhelp, strval, proc, from, to, cat, extra, startup)\
SDTG_GENERAL(#var, SDT_STDSTRING, SL_STDSTR, type, flags, guiflags, _settings_client.var, sizeof(_settings_client.var), def, 0, max_length, 0, nullptr, str, strhelp, strval, proc, from, to, cat, extra, startup)
2021-02-15 23:09:52 +00:00
#define SDTC_OMANY(var, type, flags, guiflags, def, max, full, str, strhelp, strval, proc, from, to, cat, extra, startup)\
SDTG_GENERAL(#var, SDT_ONEOFMANY, SL_VAR, type, flags, guiflags, _settings_client.var, 1, def, 0, max, 0, full, str, strhelp, strval, proc, from, to, cat, extra, startup)
2011-03-03 21:06:24 +00:00
2021-02-15 23:09:52 +00:00
#define SDT_END() {{nullptr, nullptr, SDT_NUMX, SGF_NONE, 0, 0, 0, nullptr, STR_NULL, STR_NULL, STR_NULL, nullptr, nullptr, SC_NONE, false}, SLE_END()}
2011-03-03 21:06:24 +00:00