Codechange: merge guiflags and flags in settings .ini files

It was rather confusing which one was for what, especially as some
SaveLoad flags were settings-only. Clean up this mess a bit by
having only Setting flags.
This commit is contained in:
Patric Stout 2021-06-03 20:55:03 +02:00 committed by Patric Stout
parent 264991dfa5
commit 648ee88a02
12 changed files with 352 additions and 440 deletions

View File

@ -485,11 +485,8 @@ enum VarTypes {
/* 8 bits allocated for a maximum of 8 flags
* Flags directing saving/loading of a variable */
SLF_NOT_IN_SAVE = 1 << 8, ///< do not save with savegame, basically client-based
SLF_NOT_IN_CONFIG = 1 << 9, ///< do not save to config file
SLF_NO_NETWORK_SYNC = 1 << 10, ///< do not synchronize over network (but it is saved if SLF_NOT_IN_SAVE is not set)
SLF_ALLOW_CONTROL = 1 << 11, ///< allow control codes in the strings
SLF_ALLOW_NEWLINE = 1 << 12, ///< allow new lines in the strings
SLF_ALLOW_CONTROL = 1 << 8, ///< Allow control codes in the strings.
SLF_ALLOW_NEWLINE = 1 << 9, ///< Allow new lines in the strings.
};
typedef uint32 VarType;
@ -673,7 +670,7 @@ using SaveLoadTable = span<const SaveLoad>;
* @param from First savegame version that has the empty space.
* @param to Last savegame version that has the empty space.
*/
#define SLE_CONDNULL(length, from, to) {SL_ARR, SLE_FILE_U8 | SLE_VAR_NULL | SLF_NOT_IN_CONFIG, length, from, to, 0, nullptr, 0}
#define SLE_CONDNULL(length, from, to) {SL_ARR, SLE_FILE_U8 | SLE_VAR_NULL, length, from, to, 0, nullptr, 0}
/** Translate values ingame to different values in the savegame and vv. */
#define SLE_WRITEBYTE(base, variable) SLE_GENERAL(SL_WRITEBYTE, base, variable, 0, 0, SL_MIN_VERSION, SL_MAX_VERSION, 0)
@ -797,7 +794,7 @@ using SaveLoadTable = span<const SaveLoad>;
* @param from First savegame version that has the empty space.
* @param to Last savegame version that has the empty space.
*/
#define SLEG_CONDNULL(length, from, to) {SL_ARR, SLE_FILE_U8 | SLE_VAR_NULL | SLF_NOT_IN_CONFIG, length, from, to, 0, nullptr, 0}
#define SLEG_CONDNULL(length, from, to) {SL_ARR, SLE_FILE_U8 | SLE_VAR_NULL, length, from, to, 0, nullptr, 0}
/**
* Checks whether the savegame is below \a major.\a minor.

View File

@ -35,7 +35,7 @@
const SettingDesc *sd = GetSettingFromName(setting);
if ((sd->save.conv & SLF_NO_NETWORK_SYNC) != 0) return false;
if ((sd->flags & SF_NO_NETWORK_SYNC) != 0) return false;
return ScriptObject::DoCommand(0, 0, value, CMD_CHANGE_SETTING, sd->name);
}

View File

@ -591,7 +591,7 @@ static void IniSaveSettings(IniFile *ini, const SettingTable &settings_table, co
/* If the setting is not saved to the configuration
* file, just continue with the next setting */
if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue;
if (sd->save.conv & SLF_NOT_IN_CONFIG) continue;
if (sd->flags & SF_NOT_IN_CONFIG) continue;
/* XXX - wtf is this?? (group override?) */
std::string s{ sd->name };
@ -741,7 +741,7 @@ void IniSaveWindowSettings(IniFile *ini, const char *grpname, void *desc)
*/
bool SettingDesc::IsEditable(bool do_command) const
{
if (!do_command && !(this->save.conv & SLF_NO_NETWORK_SYNC) && _networking && !_network_server && !(this->flags & SF_PER_COMPANY)) return false;
if (!do_command && !(this->flags & SF_NO_NETWORK_SYNC) && _networking && !_network_server && !(this->flags & SF_PER_COMPANY)) return false;
if ((this->flags & SF_NETWORK_ONLY) && !_networking && _game_mode != GM_MENU) return false;
if ((this->flags & SF_NO_NETWORK) && _networking) return false;
if ((this->flags & SF_NEWGAME_ONLY) &&
@ -758,7 +758,7 @@ bool SettingDesc::IsEditable(bool do_command) const
SettingType SettingDesc::GetType() const
{
if (this->flags & SF_PER_COMPANY) return ST_COMPANY;
return (this->save.conv & SLF_NOT_IN_SAVE) ? ST_CLIENT : ST_GAME;
return (this->flags & SF_NOT_IN_SAVE) ? ST_CLIENT : ST_GAME;
}
/**
@ -1844,7 +1844,7 @@ bool SetSettingValue(const IntSettingDesc *sd, int32 value, bool force_newgame)
* (if any) to change. Also *hack*hack* we update the _newgame version
* of settings because changing a company-based setting in a game also
* changes its defaults. At least that is the convention we have chosen */
if (setting->save.conv & SLF_NO_NETWORK_SYNC) {
if (setting->flags & SF_NO_NETWORK_SYNC) {
if (_game_mode != GM_MENU) {
setting->ChangeValue(&_settings_newgame, value);
}
@ -1899,7 +1899,7 @@ void SyncCompanySettings()
*/
bool SetSettingValue(const StringSettingDesc *sd, std::string value, bool force_newgame)
{
assert(sd->save.conv & SLF_NO_NETWORK_SYNC);
assert(sd->flags & SF_NO_NETWORK_SYNC);
if (GetVarMemType(sd->save.conv) == SLE_VAR_STRQ && value.compare("(null)") == 0) {
value.clear();
@ -2023,10 +2023,10 @@ void IConsoleListSettings(const char *prefilter)
static void LoadSettings(const SettingTable &settings, void *object)
{
for (auto &osd : settings) {
if (osd->save.conv & SLF_NOT_IN_SAVE) continue;
if (osd->flags & SF_NOT_IN_SAVE) continue;
SaveLoad sl = osd->save;
if ((osd->save.conv & SLF_NO_NETWORK_SYNC) && _networking && !_network_server) {
if ((osd->flags & SF_NO_NETWORK_SYNC) && _networking && !_network_server) {
/* We don't want to read this setting, so we do need to skip over it. */
sl = SLE_NULL(static_cast<uint16>(SlCalcConvMemLen(osd->save.conv) * osd->save.length));
}
@ -2053,14 +2053,14 @@ static void SaveSettings(const SettingTable &settings, void *object)
* SlCalcLength() because we have a different format. So do this manually */
size_t length = 0;
for (auto &sd : settings) {
if (sd->save.conv & SLF_NOT_IN_SAVE) continue;
if (sd->flags & SF_NOT_IN_SAVE) continue;
length += SlCalcObjMemberLength(object, sd->save);
}
SlSetLength(length);
for (auto &sd : settings) {
if (sd->save.conv & SLF_NOT_IN_SAVE) continue;
if (sd->flags & SF_NOT_IN_SAVE) continue;
void *ptr = GetVariableAddress(object, sd->save);
SlObjectMember(ptr, sd->save);

View File

@ -14,16 +14,19 @@
enum SettingFlag : uint16 {
SF_NONE = 0,
SF_GUI_0_IS_SPECIAL = 1 << 0, ///< A value of zero is possible and has a custom string (the one after "strval").
SF_GUI_NEGATIVE_IS_SPECIAL = 1 << 1, ///< A negative value has another string (the one after "strval").
SF_GUI_DROPDOWN = 1 << 2, ///< The value represents a limited number of string-options (internally integer) presented as dropdown.
SF_GUI_CURRENCY = 1 << 3, ///< The number represents money, so when reading value multiply by exchange rate.
SF_NETWORK_ONLY = 1 << 4, ///< This setting only applies to network games.
SF_NO_NETWORK = 1 << 5, ///< This setting does not apply to network games; it may not be changed during the game.
SF_NEWGAME_ONLY = 1 << 6, ///< This setting cannot be changed in a game.
SF_SCENEDIT_TOO = 1 << 7, ///< This setting can be changed in the scenario editor (only makes sense when SF_NEWGAME_ONLY is set).
SF_SCENEDIT_ONLY = 1 << 8, ///< This setting can only be changed in the scenario editor.
SF_PER_COMPANY = 1 << 9, ///< This setting can be different for each company (saved in company struct).
SF_GUI_0_IS_SPECIAL = 1 << 0, ///< A value of zero is possible and has a custom string (the one after "strval").
SF_GUI_NEGATIVE_IS_SPECIAL = 1 << 1, ///< A negative value has another string (the one after "strval").
SF_GUI_DROPDOWN = 1 << 2, ///< The value represents a limited number of string-options (internally integer) presented as dropdown.
SF_GUI_CURRENCY = 1 << 3, ///< The number represents money, so when reading value multiply by exchange rate.
SF_NETWORK_ONLY = 1 << 4, ///< This setting only applies to network games.
SF_NO_NETWORK = 1 << 5, ///< This setting does not apply to network games; it may not be changed during the game.
SF_NEWGAME_ONLY = 1 << 6, ///< This setting cannot be changed in a game.
SF_SCENEDIT_TOO = 1 << 7, ///< This setting can be changed in the scenario editor (only makes sense when SF_NEWGAME_ONLY is set).
SF_SCENEDIT_ONLY = 1 << 8, ///< This setting can only be changed in the scenario editor.
SF_PER_COMPANY = 1 << 9, ///< This setting can be different for each company (saved in company struct).
SF_NOT_IN_SAVE = 1 << 10, ///< Do not save with savegame, basically client-based.
SF_NOT_IN_CONFIG = 1 << 11, ///< Do not save to config file.
SF_NO_NETWORK_SYNC = 1 << 12, ///< Do not synchronize over network (but it is saved if SF_NOT_IN_SAVE is not set).
};
DECLARE_ENUM_AS_BIT_SET(SettingFlag)
@ -288,7 +291,7 @@ struct ListSettingDesc : SettingDesc {
/** Placeholder for settings that have been removed, but might still linger in the savegame. */
struct NullSettingDesc : SettingDesc {
NullSettingDesc(SaveLoad save) :
SettingDesc(save, "", SF_NONE, false) {}
SettingDesc(save, "", SF_NOT_IN_CONFIG, false) {}
virtual ~NullSettingDesc() {}
void FormatValue(char *buf, const char *last, const void *object) const override { NOT_REACHED(); }

View File

@ -58,62 +58,62 @@ static size_t ConvertLandscape(const char *value);
/* Macros for various objects to go in the configuration file.
* This section is for global variables */
#define SDTG_VAR(name, type, flags, guiflags, var, def, min, max, interval, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
NSD(Int, SLEG_GENERAL(SL_VAR, var, type | flags, 1, from, to, extra), name, guiflags, startup, def, min, max, interval, str, strhelp, strval, cat, pre_check, post_callback)
#define SDTG_VAR(name, type, flags, var, def, min, max, interval, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
NSD(Int, SLEG_GENERAL(SL_VAR, var, type, 1, from, to, extra), name, flags, startup, def, min, max, interval, str, strhelp, strval, cat, pre_check, post_callback)
#define SDTG_BOOL(name, flags, guiflags, var, def, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
NSD(Bool, SLEG_GENERAL(SL_VAR, var, SLE_BOOL | flags, 1, from, to, extra), name, guiflags, startup, def, str, strhelp, strval, cat, pre_check, post_callback)
#define SDTG_BOOL(name, flags, var, def, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
NSD(Bool, SLEG_GENERAL(SL_VAR, var, SLE_BOOL, 1, from, to, extra), name, flags, startup, def, str, strhelp, strval, cat, pre_check, post_callback)
#define SDTG_LIST(name, type, flags, guiflags, var, def, length, from, to, cat, extra, startup)\
NSD(List, SLEG_GENERAL(SL_ARR, var, type | flags, length, from, to, extra), name, guiflags, startup, def)
#define SDTG_LIST(name, type, flags, var, def, length, from, to, cat, extra, startup)\
NSD(List, SLEG_GENERAL(SL_ARR, var, type, length, from, to, extra), name, flags, startup, def)
#define SDTG_SSTR(name, type, flags, guiflags, var, def, max_length, pre_check, post_callback, from, to, cat, extra, startup)\
NSD(String, SLEG_GENERAL(SL_STDSTR, var, type | flags, sizeof(var), from, to, extra), name, guiflags, startup, def, max_length, pre_check, post_callback)
#define SDTG_SSTR(name, type, flags, var, def, max_length, pre_check, post_callback, from, to, cat, extra, startup)\
NSD(String, SLEG_GENERAL(SL_STDSTR, var, type, sizeof(var), from, to, extra), name, flags, startup, def, max_length, pre_check, post_callback)
#define SDTG_OMANY(name, type, flags, guiflags, var, def, max, full, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
NSD(OneOfMany, SLEG_GENERAL(SL_VAR, var, type | flags, 1, from, to, extra), name, guiflags, startup, def, max, str, strhelp, strval, cat, pre_check, post_callback, full, nullptr)
#define SDTG_OMANY(name, type, flags, var, def, max, full, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
NSD(OneOfMany, SLEG_GENERAL(SL_VAR, var, type, 1, from, to, extra), name, flags, startup, def, max, str, strhelp, strval, cat, pre_check, post_callback, full, nullptr)
#define SDTG_MMANY(name, type, flags, guiflags, var, def, full, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
NSD(ManyOfMany, SLEG_GENERAL(SL_VAR, var, type | flags, 1, from, to, extra), name, guiflags, startup, def, str, strhelp, strval, cat, pre_check, post_callback, full, nullptr)
#define SDTG_MMANY(name, type, flags, var, def, full, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
NSD(ManyOfMany, SLEG_GENERAL(SL_VAR, var, type, 1, from, to, extra), name, flags, startup, def, str, strhelp, strval, cat, pre_check, post_callback, full, nullptr)
#define SDTG_NULL(length, from, to)\
NSD(Null, SLEG_NULL(length, from, to))
/* Macros for various objects to go in the configuration file.
* This section is for structures where their various members are saved */
#define SDT_VAR(base, var, type, flags, guiflags, def, min, max, interval, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
NSD(Int, SLE_GENERAL(SL_VAR, base, var, type | flags, 1, from, to, extra), #var, guiflags, startup, def, min, max, interval, str, strhelp, strval, cat, pre_check, post_callback)
#define SDT_VAR(base, var, type, flags, def, min, max, interval, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
NSD(Int, SLE_GENERAL(SL_VAR, base, var, type, 1, from, to, extra), #var, flags, startup, def, min, max, interval, str, strhelp, strval, cat, pre_check, post_callback)
#define SDT_BOOL(base, var, flags, guiflags, def, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
NSD(Bool, SLE_GENERAL(SL_VAR, base, var, SLE_BOOL | flags, 1, from, to, extra), #var, guiflags, startup, def, str, strhelp, strval, cat, pre_check, post_callback)
#define SDT_BOOL(base, var, flags, def, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
NSD(Bool, SLE_GENERAL(SL_VAR, base, var, SLE_BOOL, 1, from, to, extra), #var, flags, startup, def, str, strhelp, strval, cat, pre_check, post_callback)
#define SDT_LIST(base, var, type, flags, guiflags, def, from, to, cat, extra, startup)\
NSD(List, SLE_GENERAL(SL_ARR, base, var, type | flags, lengthof(((base*)8)->var), from, to, extra), #var, guiflags, startup, def)
#define SDT_LIST(base, var, type, flags, def, from, to, cat, extra, startup)\
NSD(List, SLE_GENERAL(SL_ARR, base, var, type, lengthof(((base*)8)->var), from, to, extra), #var, flags, startup, def)
#define SDT_SSTR(base, var, type, flags, guiflags, def, pre_check, post_callback, from, to, cat, extra, startup)\
NSD(String, SLE_GENERAL(SL_STDSTR, base, var, type | flags, sizeof(((base*)8)->var), from, to, extra), #var, guiflags, startup, def, 0, pre_check, post_callback)
#define SDT_SSTR(base, var, type, flags, def, pre_check, post_callback, from, to, cat, extra, startup)\
NSD(String, SLE_GENERAL(SL_STDSTR, base, var, type, sizeof(((base*)8)->var), from, to, extra), #var, flags, startup, def, 0, pre_check, post_callback)
#define SDT_OMANY(base, var, type, flags, guiflags, def, max, full, str, strhelp, strval, pre_check, post_callback, from, to, load, cat, extra, startup)\
NSD(OneOfMany, SLE_GENERAL(SL_VAR, base, var, type | flags, 1, from, to, extra), #var, guiflags, startup, def, max, str, strhelp, strval, cat, pre_check, post_callback, full, load)
#define SDT_OMANY(base, var, type, flags, def, max, full, str, strhelp, strval, pre_check, post_callback, from, to, load, cat, extra, startup)\
NSD(OneOfMany, SLE_GENERAL(SL_VAR, base, var, type, 1, from, to, extra), #var, flags, startup, def, max, str, strhelp, strval, cat, pre_check, post_callback, full, load)
#define SDT_MMANY(base, var, type, flags, guiflags, def, full, str, pre_check, post_callback, strhelp, strval, from, to, cat, extra, startup)\
NSD(ManyOfMany, SLE_GENERAL(SL_VAR, base, var, type | flags, 1, from, to, extra), #var, guiflags, startup, def, str, strhelp, strval, cat, pre_check, post_callback, full, nullptr)
#define SDT_MMANY(base, var, type, flags, def, full, str, pre_check, post_callback, strhelp, strval, from, to, cat, extra, startup)\
NSD(ManyOfMany, SLE_GENERAL(SL_VAR, base, var, type, 1, from, to, extra), #var, flags, startup, def, str, strhelp, strval, cat, pre_check, post_callback, full, nullptr)
#define SDT_NULL(length, from, to)\
NSD(Null, SLE_CONDNULL(length, from, to))
#define SDTC_VAR(var, type, flags, guiflags, def, min, max, interval, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
SDTG_VAR(#var, type, flags, guiflags, _settings_client.var, def, min, max, interval, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)
#define SDTC_VAR(var, type, flags, def, min, max, interval, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
SDTG_VAR(#var, type, flags, _settings_client.var, def, min, max, interval, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)
#define SDTC_BOOL(var, flags, guiflags, def, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
SDTG_BOOL(#var, flags, guiflags, _settings_client.var, def, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)
#define SDTC_BOOL(var, flags, def, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
SDTG_BOOL(#var, flags, _settings_client.var, def, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)
#define SDTC_LIST(var, type, flags, guiflags, def, from, to, cat, extra, startup)\
SDTG_LIST(#var, type, flags, guiflags, _settings_client.var, def, lengthof(_settings_client.var), from, to, cat, extra, startup)
#define SDTC_LIST(var, type, flags, def, from, to, cat, extra, startup)\
SDTG_LIST(#var, type, flags, _settings_client.var, def, lengthof(_settings_client.var), from, to, cat, extra, startup)
#define SDTC_SSTR(var, type, flags, guiflags, def, max_length, pre_check, post_callback, from, to, cat, extra, startup)\
SDTG_SSTR(#var, type, flags, guiflags, _settings_client.var, def, max_length, pre_check, post_callback, from, to, cat, extra, startup)\
#define SDTC_SSTR(var, type, flags, def, max_length, pre_check, post_callback, from, to, cat, extra, startup)\
SDTG_SSTR(#var, type, flags, _settings_client.var, def, max_length, pre_check, post_callback, from, to, cat, extra, startup)\
#define SDTC_OMANY(var, type, flags, guiflags, def, max, full, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
SDTG_OMANY(#var, type, flags, guiflags, _settings_client.var, def, max, full, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)
#define SDTC_OMANY(var, type, flags, def, max, full, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)\
SDTG_OMANY(#var, type, flags, _settings_client.var, def, max, full, str, strhelp, strval, pre_check, post_callback, from, to, cat, extra, startup)

View File

@ -16,15 +16,14 @@ static const SettingTable _company_settings{
[post-amble]
};
[templates]
SDT_BOOL = SDT_BOOL(CompanySettings, $var, $flags, $guiflags, $def, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDT_VAR = SDT_VAR(CompanySettings, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDT_BOOL = SDT_BOOL(CompanySettings, $var, $flags, $def, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDT_VAR = SDT_VAR(CompanySettings, $var, $type, $flags, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
[validation]
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for CompanySettings.$var exceeds storage size");
[defaults]
flags = 0
guiflags = SF_PER_COMPANY
flags = SF_PER_COMPANY
interval = 0
str = STR_NULL
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
@ -50,7 +49,7 @@ cat = SC_BASIC
[SDT_VAR]
var = engine_renew_months
type = SLE_INT16
guiflags = SF_PER_COMPANY | SF_GUI_NEGATIVE_IS_SPECIAL
flags = SF_PER_COMPANY | SF_GUI_NEGATIVE_IS_SPECIAL
def = 6
min = -12
max = 12
@ -61,7 +60,7 @@ strval = STR_CONFIG_SETTING_AUTORENEW_MONTHS_VALUE_BEFORE
[SDT_VAR]
var = engine_renew_money
type = SLE_UINT
guiflags = SF_PER_COMPANY | SF_GUI_CURRENCY
flags = SF_PER_COMPANY | SF_GUI_CURRENCY
def = 100000
min = 0
max = 2000000
@ -83,7 +82,7 @@ post_cb = UpdateServiceInterval
[SDT_VAR]
var = vehicle.servint_trains
type = SLE_UINT16
guiflags = SF_PER_COMPANY | SF_GUI_0_IS_SPECIAL
flags = SF_PER_COMPANY | SF_GUI_0_IS_SPECIAL
def = 150
min = 5
max = 800
@ -96,7 +95,7 @@ post_cb = [](auto new_value) { UpdateServiceInterval(VEH_TRAIN, new_value); }
[SDT_VAR]
var = vehicle.servint_roadveh
type = SLE_UINT16
guiflags = SF_PER_COMPANY | SF_GUI_0_IS_SPECIAL
flags = SF_PER_COMPANY | SF_GUI_0_IS_SPECIAL
def = 150
min = 5
max = 800
@ -109,7 +108,7 @@ post_cb = [](auto new_value) { UpdateServiceInterval(VEH_ROAD, new_value); }
[SDT_VAR]
var = vehicle.servint_ships
type = SLE_UINT16
guiflags = SF_PER_COMPANY | SF_GUI_0_IS_SPECIAL
flags = SF_PER_COMPANY | SF_GUI_0_IS_SPECIAL
def = 360
min = 5
max = 800
@ -122,7 +121,7 @@ post_cb = [](auto new_value) { UpdateServiceInterval(VEH_SHIP, new_value); }
[SDT_VAR]
var = vehicle.servint_aircraft
type = SLE_UINT16
guiflags = SF_PER_COMPANY | SF_GUI_0_IS_SPECIAL
flags = SF_PER_COMPANY | SF_GUI_0_IS_SPECIAL
def = 100
min = 5
max = 800

View File

@ -11,15 +11,14 @@ static const SettingTable _currency_settings{
[post-amble]
};
[templates]
SDT_VAR = SDT_VAR (CurrencySpec, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDT_SSTR = SDT_SSTR(CurrencySpec, $var, $type, $flags, $guiflags, $def, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDT_VAR = SDT_VAR (CurrencySpec, $var, $type, $flags, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDT_SSTR = SDT_SSTR(CurrencySpec, $var, $type, $flags, $def, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
[validation]
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for CurrencySpec.$var exceeds storage size");
[defaults]
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
guiflags = SF_NONE
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
interval = 0
str = STR_NULL
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT

View File

@ -46,13 +46,13 @@ static const SettingTable _gameopt_settings{
[post-amble]
};
[templates]
SDTG_LIST = SDTG_LIST($name, $type, $flags, $guiflags, $var, $def, $length, $from, $to, $cat, $extra, $startup),
SDTG_VAR = SDTG_VAR($name, $type, $flags, $guiflags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTG_LIST = SDTG_LIST($name, $type, $flags, $var, $def, $length, $from, $to, $cat, $extra, $startup),
SDTG_VAR = SDTG_VAR($name, $type, $flags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDT_NULL = SDT_NULL( $length, $from, $to),
SDTC_OMANY = SDTC_OMANY( $var, $type, $flags, $guiflags, $def, $max, $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTG_OMANY = SDTG_OMANY($name, $type, $flags, $guiflags, $var, $def, $max, $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDT_OMANY = SDT_OMANY(GameSettings, $var, $type, $flags, $guiflags, $def, $max, $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $load, $cat, $extra, $startup),
SDT_VAR = SDT_VAR(GameSettings, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTC_OMANY = SDTC_OMANY( $var, $type, $flags, $def, $max, $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTG_OMANY = SDTG_OMANY($name, $type, $flags, $var, $def, $max, $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDT_OMANY = SDT_OMANY(GameSettings, $var, $type, $flags, $def, $max, $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $load, $cat, $extra, $startup),
SDT_VAR = SDT_VAR(GameSettings, $var, $type, $flags, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
[validation]
SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
@ -62,8 +62,7 @@ SDT_OMANY = static_assert($max <= MAX_$type, "Maximum value for GameSettings.$va
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for GameSettings.$var exceeds storage size");
[defaults]
flags = 0
guiflags = SF_NONE
flags = SF_NONE
interval = 0
str = STR_NULL
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
@ -84,7 +83,7 @@ name = ""diff_custom""
sdt_cmd = SDT_INTLIST
sle_cmd = SL_ARR
type = SLE_FILE_I16 | SLE_VAR_U16
flags = SLF_NOT_IN_CONFIG
flags = SF_NOT_IN_CONFIG
var = _old_diff_custom
length = 17
def = nullptr
@ -95,19 +94,18 @@ name = ""diff_custom""
sdt_cmd = SDT_INTLIST
sle_cmd = SL_ARR
type = SLE_UINT16
flags = SLF_NOT_IN_CONFIG
flags = SF_NOT_IN_CONFIG
var = _old_diff_custom
length = 18
def = nullptr
full = nullptr
from = SLV_4
##
[SDTG_VAR]
name = ""diff_level""
var = _old_diff_level
type = SLE_UINT8
flags = SLF_NOT_IN_CONFIG
flags = SF_NOT_IN_CONFIG
def = SP_CUSTOM
min = SP_EASY
max = SP_CUSTOM
@ -116,7 +114,7 @@ cat = SC_BASIC
[SDT_OMANY]
var = locale.currency
type = SLE_UINT8
flags = SLF_NO_NETWORK_SYNC
flags = SF_NO_NETWORK_SYNC
def = 0
max = CURRENCY_END - 1
full = _locale_currencies
@ -126,7 +124,7 @@ cat = SC_BASIC
name = ""units""
var = _old_units
type = SLE_UINT8
flags = SLF_NOT_IN_CONFIG
flags = SF_NOT_IN_CONFIG
def = 1
max = 2
full = _locale_units
@ -172,8 +170,7 @@ to = SLV_23
[SDTC_OMANY]
var = gui.autosave
type = SLE_UINT8
from = SLV_23
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
def = 1
max = 4
full = _autosave_interval

View File

@ -24,20 +24,19 @@ static const SettingTable _misc_settings{
[post-amble]
};
[templates]
SDTG_LIST = SDTG_LIST($name, $type, $flags, $guiflags, $var, $def, $length, $from, $to, $cat, $extra, $startup),
SDTG_MMANY = SDTG_MMANY($name, $type, $flags, $guiflags, $var, $def, $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTG_OMANY = SDTG_OMANY($name, $type, $flags, $guiflags, $var, $def, $max, $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTG_SSTR = SDTG_SSTR($name, $type, $flags, $guiflags, $var, $def, 0, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTG_BOOL = SDTG_BOOL($name, $flags, $guiflags, $var, $def, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTG_VAR = SDTG_VAR($name, $type, $flags, $guiflags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTG_LIST = SDTG_LIST($name, $type, $flags, $var, $def, $length, $from, $to, $cat, $extra, $startup),
SDTG_MMANY = SDTG_MMANY($name, $type, $flags, $var, $def, $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTG_OMANY = SDTG_OMANY($name, $type, $flags, $var, $def, $max, $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTG_SSTR = SDTG_SSTR($name, $type, $flags, $var, $def, 0, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTG_BOOL = SDTG_BOOL($name, $flags, $var, $def, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTG_VAR = SDTG_VAR($name, $type, $flags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
[validation]
SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
SDTG_OMANY = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
[defaults]
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
guiflags = SF_NONE
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
interval = 0
str = STR_NULL
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT

File diff suppressed because it is too large Load Diff

View File

@ -17,15 +17,14 @@ static const SettingTable _win32_settings{
};
#endif /* _WIN32 */
[templates]
SDTG_BOOL = SDTG_BOOL($name, $flags, $guiflags, $var, $def, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTG_VAR = SDTG_VAR($name, $type, $flags, $guiflags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTG_BOOL = SDTG_BOOL($name, $flags, $var, $def, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTG_VAR = SDTG_VAR($name, $type, $flags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
[validation]
SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
[defaults]
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
guiflags = SF_NONE
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
interval = 0
str = STR_NULL
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT

View File

@ -13,15 +13,14 @@ static const SettingTable _window_settings{
[post-amble]
};
[templates]
SDT_BOOL = SDT_BOOL(WindowDesc, $var, $flags, $guiflags, $def, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDT_VAR = SDT_VAR(WindowDesc, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDT_BOOL = SDT_BOOL(WindowDesc, $var, $flags, $def, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDT_VAR = SDT_VAR(WindowDesc, $var, $type, $flags, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
[validation]
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for WindowDesc.$var exceeds storage size");
[defaults]
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
guiflags = SF_NONE
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
interval = 0
str = STR_NULL
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT