Codechange: remove SettingDescType in lieu of the actual classes

This commit is contained in:
rubidium42 2021-05-23 19:27:46 +02:00 committed by rubidium42
parent e666a962b1
commit 86c9ef8134
5 changed files with 136 additions and 161 deletions

View File

@ -18,7 +18,7 @@
/* static */ bool ScriptGameSettings::IsValid(const char *setting)
{
const SettingDesc *sd = GetSettingFromName(setting);
return sd != nullptr && sd->cmd != SDT_STDSTRING;
return sd != nullptr && sd->IsIntSetting();
}
/* static */ int32 ScriptGameSettings::GetValue(const char *setting)
@ -28,8 +28,6 @@
const SettingDesc *sd = GetSettingFromName(setting);
void *ptr = GetVariableAddress(&_settings_game, &sd->save);
if (sd->cmd == SDT_BOOLX) return *(bool*)ptr;
return (int32)ReadValue(ptr, sd->save.conv);
}
@ -40,7 +38,6 @@
const SettingDesc *sd = GetSettingFromName(setting);
if ((sd->save.conv & SLF_NO_NETWORK_SYNC) != 0) return false;
if (sd->cmd != SDT_BOOLX && sd->cmd != SDT_NUMX) return false;
return ScriptObject::DoCommand(0, GetSettingIndex(sd), value, CMD_CHANGE_SETTING);
}

View File

@ -400,52 +400,49 @@ void IntSettingDesc::Write_ValidateSetting(const void *object, int32 val) const
{
void *ptr = GetVariableAddress(object, &this->save);
/* We cannot know the maximum value of a bitset variable, so just have faith */
if (this->cmd != SDT_MANYOFMANY) {
/* We need to take special care of the uint32 type as we receive from the function
* a signed integer. While here also bail out on 64-bit settings as those are not
* supported. Unsigned 8 and 16-bit variables are safe since they fit into a signed
* 32-bit variable
* TODO: Support 64-bit settings/variables */
switch (GetVarMemType(this->save.conv)) {
case SLE_VAR_NULL: return;
case SLE_VAR_BL:
case SLE_VAR_I8:
case SLE_VAR_U8:
case SLE_VAR_I16:
case SLE_VAR_U16:
case SLE_VAR_I32: {
/* Override the minimum value. No value below sdb->min, except special value 0 */
if (!(this->flags & SGF_0ISDISABLED) || val != 0) {
if (!(this->flags & SGF_MULTISTRING)) {
/* Clamp value-type setting to its valid range */
val = Clamp(val, this->min, this->max);
} else if (val < this->min || val > (int32)this->max) {
/* Reset invalid discrete setting (where different values change gameplay) to its default value */
val = this->def;
}
/* We need to take special care of the uint32 type as we receive from the function
* a signed integer. While here also bail out on 64-bit settings as those are not
* supported. Unsigned 8 and 16-bit variables are safe since they fit into a signed
* 32-bit variable
* TODO: Support 64-bit settings/variables; requires 64 bit over command protocol! */
switch (GetVarMemType(this->save.conv)) {
case SLE_VAR_NULL: return;
case SLE_VAR_BL:
case SLE_VAR_I8:
case SLE_VAR_U8:
case SLE_VAR_I16:
case SLE_VAR_U16:
case SLE_VAR_I32: {
/* Override the minimum value. No value below this->min, except special value 0 */
if (!(this->flags & SGF_0ISDISABLED) || val != 0) {
if (!(this->flags & SGF_MULTISTRING)) {
/* Clamp value-type setting to its valid range */
val = Clamp(val, this->min, this->max);
} else if (val < this->min || val > (int32)this->max) {
/* Reset invalid discrete setting (where different values change gameplay) to its default value */
val = this->def;
}
break;
}
case SLE_VAR_U32: {
/* Override the minimum value. No value below sdb->min, except special value 0 */
uint32 uval = (uint32)val;
if (!(this->flags & SGF_0ISDISABLED) || uval != 0) {
if (!(this->flags & SGF_MULTISTRING)) {
/* Clamp value-type setting to its valid range */
uval = ClampU(uval, this->min, this->max);
} else if (uval < (uint)this->min || uval > this->max) {
/* Reset invalid discrete setting to its default value */
uval = (uint32)this->def;
}
}
WriteValue(ptr, SLE_VAR_U32, (int64)uval);
return;
}
case SLE_VAR_I64:
case SLE_VAR_U64:
default: NOT_REACHED();
break;
}
case SLE_VAR_U32: {
/* Override the minimum value. No value below this->min, except special value 0 */
uint32 uval = (uint32)val;
if (!(this->flags & SGF_0ISDISABLED) || uval != 0) {
if (!(this->flags & SGF_MULTISTRING)) {
/* Clamp value-type setting to its valid range */
uval = ClampU(uval, this->min, this->max);
} else if (uval < (uint)this->min || uval > this->max) {
/* Reset invalid discrete setting to its default value */
uval = (uint32)this->def;
}
}
WriteValue(ptr, SLE_VAR_U32, (int64)uval);
return;
}
case SLE_VAR_I64:
case SLE_VAR_U64:
default: NOT_REACHED();
}
WriteValue(ptr, this->save.conv, (int64)val);
@ -755,22 +752,6 @@ SettingType SettingDesc::GetType() const
return (this->save.conv & SLF_NOT_IN_SAVE) ? ST_CLIENT : ST_GAME;
}
/**
* Check whether this setting is an integer type setting.
* @return True when the underlying type is an integer.
*/
bool SettingDesc::IsIntSetting() const {
return this->cmd == SDT_BOOLX || this->cmd == SDT_NUMX || this->cmd == SDT_ONEOFMANY || this->cmd == SDT_MANYOFMANY;
}
/**
* Check whether this setting is an string type setting.
* @return True when the underlying type is a string.
*/
bool SettingDesc::IsStringSetting() const {
return this->cmd == SDT_STDSTRING;
}
/**
* Get the setting description of this setting as an integer setting.
* @return The integer setting description.
@ -2109,10 +2090,10 @@ void IConsoleSetSetting(const char *name, const char *value, bool force_newgame)
return;
}
bool success;
if (sd->cmd == SDT_STDSTRING) {
bool success = true;
if (sd->IsStringSetting()) {
success = SetSettingValue(sd->AsStringSetting(), value, force_newgame);
} else {
} else if (sd->IsIntSetting()) {
uint32 val;
extern bool GetArgumentInteger(uint32 *value, const char *arg);
success = GetArgumentInteger(&val, value);
@ -2155,9 +2136,8 @@ void IConsoleGetSetting(const char *name, bool force_newgame)
const void *object = (_game_mode == GM_MENU || force_newgame) ? &_settings_newgame : &_settings_game;
if (sd->cmd == SDT_STDSTRING) {
const void *ptr = GetVariableAddress(object, &sd->save);
IConsolePrintF(CC_WARNING, "Current value for '%s' is: '%s'", name, reinterpret_cast<const std::string *>(ptr)->c_str());
if (sd->IsStringSetting()) {
IConsolePrintF(CC_WARNING, "Current value for '%s' is: '%s'", name, sd->AsStringSetting()->Read(object).c_str());
} else if (sd->IsIntSetting()) {
char value[20];
sd->FormatValue(value, lastof(value), object);

View File

@ -1167,7 +1167,7 @@ static const void *ResolveVariableAddress(const GameSettings *settings_ptr, cons
*/
void SettingEntry::SetValueDParams(uint first_param, int32 value) const
{
if (this->setting->cmd == SDT_BOOLX) {
if (this->setting->IsBoolSetting()) {
SetDParam(first_param++, value != 0 ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
} else {
if ((this->setting->flags & SGF_MULTISTRING) != 0) {
@ -1207,7 +1207,7 @@ void SettingEntry::DrawSetting(GameSettings *settings_ptr, int left, int right,
SetDParam(0, highlight ? STR_ORANGE_STRING1_WHITE : STR_ORANGE_STRING1_LTBLUE);
int32 value = (int32)ReadValue(var, sd->save.conv);
if (sd->cmd == SDT_BOOLX) {
if (sd->IsBoolSetting()) {
/* Draw checkbox for boolean-value either on/off */
DrawBoolButton(buttons_left, button_y, value != 0, editable);
} else if ((sd->flags & SGF_MULTISTRING) != 0) {
@ -2228,52 +2228,47 @@ struct GameSettingsWindow : Window {
this->SetDisplayedHelpText(pe);
int32 oldvalue = value;
switch (sd->cmd) {
case SDT_BOOLX: value ^= 1; break;
case SDT_ONEOFMANY:
case SDT_NUMX: {
/* Add a dynamic step-size to the scroller. In a maximum of
* 50-steps you should be able to get from min to max,
* unless specified otherwise in the 'interval' variable
* of the current setting. */
uint32 step = (sd->interval == 0) ? ((sd->max - sd->min) / 50) : sd->interval;
if (step == 0) step = 1;
if (sd->IsBoolSetting()) {
value ^= 1;
} else {
/* Add a dynamic step-size to the scroller. In a maximum of
* 50-steps you should be able to get from min to max,
* unless specified otherwise in the 'interval' variable
* of the current setting. */
uint32 step = (sd->interval == 0) ? ((sd->max - sd->min) / 50) : sd->interval;
if (step == 0) step = 1;
/* don't allow too fast scrolling */
if ((this->flags & WF_TIMEOUT) && this->timeout_timer > 1) {
_left_button_clicked = false;
return;
}
/* Increase or decrease the value and clamp it to extremes */
if (x >= SETTING_BUTTON_WIDTH / 2) {
value += step;
if (sd->min < 0) {
assert((int32)sd->max >= 0);
if (value > (int32)sd->max) value = (int32)sd->max;
} else {
if ((uint32)value > sd->max) value = (int32)sd->max;
}
if (value < sd->min) value = sd->min; // skip between "disabled" and minimum
} else {
value -= step;
if (value < sd->min) value = (sd->flags & SGF_0ISDISABLED) ? 0 : sd->min;
}
/* Set up scroller timeout for numeric values */
if (value != oldvalue) {
if (this->clicked_entry != nullptr) { // Release previous buttons if any
this->clicked_entry->SetButtons(0);
}
this->clicked_entry = pe;
this->clicked_entry->SetButtons((x >= SETTING_BUTTON_WIDTH / 2) != (_current_text_dir == TD_RTL) ? SEF_RIGHT_DEPRESSED : SEF_LEFT_DEPRESSED);
this->SetTimeout();
_left_button_clicked = false;
}
break;
/* don't allow too fast scrolling */
if ((this->flags & WF_TIMEOUT) && this->timeout_timer > 1) {
_left_button_clicked = false;
return;
}
default: NOT_REACHED();
/* Increase or decrease the value and clamp it to extremes */
if (x >= SETTING_BUTTON_WIDTH / 2) {
value += step;
if (sd->min < 0) {
assert((int32)sd->max >= 0);
if (value > (int32)sd->max) value = (int32)sd->max;
} else {
if ((uint32)value > sd->max) value = (int32)sd->max;
}
if (value < sd->min) value = sd->min; // skip between "disabled" and minimum
} else {
value -= step;
if (value < sd->min) value = (sd->flags & SGF_0ISDISABLED) ? 0 : sd->min;
}
/* Set up scroller timeout for numeric values */
if (value != oldvalue) {
if (this->clicked_entry != nullptr) { // Release previous buttons if any
this->clicked_entry->SetButtons(0);
}
this->clicked_entry = pe;
this->clicked_entry->SetButtons((x >= SETTING_BUTTON_WIDTH / 2) != (_current_text_dir == TD_RTL) ? SEF_RIGHT_DEPRESSED : SEF_LEFT_DEPRESSED);
this->SetTimeout();
_left_button_clicked = false;
}
}
if (value != oldvalue) {
@ -2282,7 +2277,7 @@ struct GameSettingsWindow : Window {
}
} else {
/* Only open editbox if clicked for the second time, and only for types where it is sensible for. */
if (this->last_clicked == pe && sd->cmd != SDT_BOOLX && !(sd->flags & SGF_MULTISTRING)) {
if (this->last_clicked == pe && !sd->IsBoolSetting() && !(sd->flags & SGF_MULTISTRING)) {
int64 value64 = value;
/* Show the correct currency-translated value */
if (sd->flags & SGF_CURRENCY) value64 *= _currency->rate;

View File

@ -12,22 +12,6 @@
#include "saveload/saveload.h"
/**
* Convention/Type of settings. This is then further specified if necessary
* with the SLE_ (SLE_VAR/SLE_FILE) enums in saveload.h
* @see VarTypes
* @see SettingDesc
*/
enum SettingDescType : byte {
SDT_NUMX = 0, ///< any number-type
SDT_BOOLX = 1, ///< a boolean number
SDT_ONEOFMANY = 2, ///< bitmasked number where only ONE bit may be set
SDT_MANYOFMANY = 3, ///< bitmasked number where MULTIPLE bits may be set
SDT_INTLIST = 4, ///< list of integers separated by a comma ','
SDT_STDSTRING = 6, ///< \c std::string
SDT_NULL = 7, ///< an old setting that has been removed but could still be in savegames
};
enum SettingGuiFlag : uint16 {
/* 2 bytes allocated for a maximum of 16 flags. */
SGF_NONE = 0,
@ -85,20 +69,30 @@ typedef size_t OnConvert(const char *value); ///< callback prototype for convers
/** Properties of config file settings. */
struct SettingDesc {
SettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, SettingDescType cmd, bool startup) :
name(name), flags(flags), cmd(cmd), startup(startup), save(save) {}
SettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, bool startup) :
name(name), flags(flags), startup(startup), save(save) {}
virtual ~SettingDesc() {}
const char *name; ///< name of the setting. Used in configuration file and for console
SettingGuiFlag flags; ///< handles how a setting would show up in the GUI (text/currency, etc.)
SettingDescType cmd; ///< various flags for the variable
bool startup; ///< setting has to be loaded directly at startup?
SaveLoad save; ///< Internal structure (going to savegame, parts to config)
bool IsEditable(bool do_command = false) const;
SettingType GetType() const;
bool IsIntSetting() const;
bool IsStringSetting() const;
/**
* Check whether this setting is an integer type setting.
* @return True when the underlying type is an integer.
*/
virtual bool IsIntSetting() const { return false; }
/**
* Check whether this setting is an string type setting.
* @return True when the underlying type is a string.
*/
virtual bool IsStringSetting() const { return false; }
const struct IntSettingDesc *AsIntSetting() const;
const struct StringSettingDesc *AsStringSetting() const;
@ -131,10 +125,10 @@ struct SettingDesc {
/** Base integer type, including boolean, settings. Only these are shown in the settings UI. */
struct IntSettingDesc : SettingDesc {
IntSettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, SettingDescType cmd, bool startup, int32 def,
IntSettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, bool startup, int32 def,
int32 min, uint32 max, int32 interval, StringID str, StringID str_help, StringID str_val,
SettingCategory cat, OnChange *proc) :
SettingDesc(save, name, flags, cmd, startup), def(def), min(min), max(max), interval(interval),
SettingDesc(save, name, flags, startup), def(def), min(min), max(max), interval(interval),
str(str), str_help(str_help), str_val(str_val), cat(cat), proc(proc) {}
virtual ~IntSettingDesc() {}
@ -148,6 +142,13 @@ struct IntSettingDesc : SettingDesc {
SettingCategory cat; ///< assigned categories of the setting
OnChange *proc; ///< callback procedure for when the value is changed
/**
* Check whether this setting is a boolean type setting.
* @return True when the underlying type is an integer.
*/
virtual bool IsBoolSetting() const { return false; }
bool IsIntSetting() const override { return true; }
void ChangeValue(const void *object, int32 newvalue) const;
void Write_ValidateSetting(const void *object, int32 value) const;
@ -159,21 +160,22 @@ struct IntSettingDesc : SettingDesc {
/** Boolean setting. */
struct BoolSettingDesc : IntSettingDesc {
BoolSettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, SettingDescType cmd, bool startup, bool def,
BoolSettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, bool startup, bool def,
StringID str, StringID str_help, StringID str_val, SettingCategory cat, OnChange *proc) :
IntSettingDesc(save, name, flags, cmd, startup, def, 0, 1, 0, str, str_help, str_val, cat, proc) {}
IntSettingDesc(save, name, flags, startup, def, 0, 1, 0, str, str_help, str_val, cat, proc) {}
virtual ~BoolSettingDesc() {}
bool IsBoolSetting() const override { return true; }
size_t ParseValue(const char *str) const override;
void FormatValue(char *buf, const char *last, const void *object) const override;
};
/** One of many setting. */
struct OneOfManySettingDesc : IntSettingDesc {
OneOfManySettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, SettingDescType cmd, bool startup,
OneOfManySettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, bool startup,
int32 def, int32 max, StringID str, StringID str_help, StringID str_val, SettingCategory cat, OnChange *proc,
std::initializer_list<const char *> many, OnConvert *many_cnvt) :
IntSettingDesc(save, name, flags, cmd, startup, def, 0, max, 0, str, str_help, str_val, cat, proc), many_cnvt(many_cnvt)
IntSettingDesc(save, name, flags, startup, def, 0, max, 0, str, str_help, str_val, cat, proc), many_cnvt(many_cnvt)
{
for (auto one : many) this->many.push_back(one);
}
@ -192,10 +194,10 @@ struct OneOfManySettingDesc : IntSettingDesc {
/** Many of many setting. */
struct ManyOfManySettingDesc : OneOfManySettingDesc {
ManyOfManySettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, SettingDescType cmd, bool startup,
ManyOfManySettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, bool startup,
int32 def, StringID str, StringID str_help, StringID str_val, SettingCategory cat, OnChange *proc,
std::initializer_list<const char *> many, OnConvert *many_cnvt) :
OneOfManySettingDesc(save, name, flags, cmd, startup, def, (1 << many.size()) - 1, str, str_help,
OneOfManySettingDesc(save, name, flags, startup, def, (1 << many.size()) - 1, str, str_help,
str_val, cat, proc, many, many_cnvt) {}
virtual ~ManyOfManySettingDesc() {}
@ -205,15 +207,16 @@ struct ManyOfManySettingDesc : OneOfManySettingDesc {
/** String settings. */
struct StringSettingDesc : SettingDesc {
StringSettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, SettingDescType cmd, bool startup, const char *def,
StringSettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, bool startup, const char *def,
uint32 max_length, OnChange proc) :
SettingDesc(save, name, flags, cmd, startup), def(def), max_length(max_length), proc(proc) {}
SettingDesc(save, name, flags, startup), def(def), max_length(max_length), proc(proc) {}
virtual ~StringSettingDesc() {}
const char *def; ///< default value given when none is present
uint32 max_length; ///< maximum length of the string, 0 means no maximum length
OnChange *proc; ///< callback procedure for when the value is changed
bool IsStringSetting() const override { return true; }
void ChangeValue(const void *object, const char *newval) const;
void Write_ValidateSetting(const void *object, const char *str) const;
@ -225,8 +228,8 @@ struct StringSettingDesc : SettingDesc {
/** List/array settings. */
struct ListSettingDesc : SettingDesc {
ListSettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, SettingDescType cmd, bool startup, const char *def) :
SettingDesc(save, name, flags, cmd, startup), def(def) {}
ListSettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, bool startup, const char *def) :
SettingDesc(save, name, flags, startup), def(def) {}
virtual ~ListSettingDesc() {}
const char *def; ///< default value given when none is present
@ -239,7 +242,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, "", SGF_NONE, SDT_NULL, false) {}
SettingDesc(save, "", SGF_NONE, false) {}
virtual ~NullSettingDesc() {}
void FormatValue(char *buf, const char *last, const void *object) const override { NOT_REACHED(); }

View File

@ -59,22 +59,22 @@ 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, proc, from, to, cat, extra, startup)\
NSD(Int, SLEG_GENERAL(SL_VAR, var, type | flags, 1, from, to, extra), name, guiflags, SDT_NUMX, startup, def, min, max, interval, str, strhelp, strval, cat, proc)
NSD(Int, SLEG_GENERAL(SL_VAR, var, type | flags, 1, from, to, extra), name, guiflags, startup, def, min, max, interval, str, strhelp, strval, cat, proc)
#define SDTG_BOOL(name, flags, guiflags, var, def, str, strhelp, strval, proc, from, to, cat, extra, startup)\
NSD(Bool, SLEG_GENERAL(SL_VAR, var, SLE_BOOL | flags, 1, from, to, extra), name, guiflags, SDT_BOOLX, startup, def, str, strhelp, strval, cat, proc)
NSD(Bool, SLEG_GENERAL(SL_VAR, var, SLE_BOOL | flags, 1, from, to, extra), name, guiflags, startup, def, str, strhelp, strval, cat, proc)
#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, SDT_INTLIST, startup, def)
NSD(List, SLEG_GENERAL(SL_ARR, var, type | flags, length, from, to, extra), name, guiflags, startup, def)
#define SDTG_SSTR(name, type, flags, guiflags, var, def, max_length, proc, from, to, cat, extra, startup)\
NSD(String, SLEG_GENERAL(SL_STDSTR, var, type | flags, sizeof(var), from, to, extra), name, guiflags, SDT_STDSTRING, startup, def, max_length, proc)
NSD(String, SLEG_GENERAL(SL_STDSTR, var, type | flags, sizeof(var), from, to, extra), name, guiflags, startup, def, max_length, proc)
#define SDTG_OMANY(name, type, flags, guiflags, var, def, max, full, str, strhelp, strval, proc, from, to, cat, extra, startup)\
NSD(OneOfMany, SLEG_GENERAL(SL_VAR, var, type | flags, 1, from, to, extra), name, guiflags, SDT_ONEOFMANY, startup, def, max, str, strhelp, strval, cat, proc, full, nullptr)
NSD(OneOfMany, SLEG_GENERAL(SL_VAR, var, type | flags, 1, from, to, extra), name, guiflags, startup, def, max, str, strhelp, strval, cat, proc, full, nullptr)
#define SDTG_MMANY(name, type, flags, guiflags, var, def, full, str, strhelp, strval, proc, from, to, cat, extra, startup)\
NSD(ManyOfMany, SLEG_GENERAL(SL_VAR, var, type | flags, 1, from, to, extra), name, guiflags, SDT_MANYOFMANY, startup, def, str, strhelp, strval, cat, proc, full, nullptr)
NSD(ManyOfMany, SLEG_GENERAL(SL_VAR, var, type | flags, 1, from, to, extra), name, guiflags, startup, def, str, strhelp, strval, cat, proc, full, nullptr)
#define SDTG_NULL(length, from, to)\
NSD(Null, SLEG_NULL(length, from, to))
@ -82,22 +82,22 @@ static size_t ConvertLandscape(const char *value);
/* 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, proc, from, to, cat, extra, startup)\
NSD(Int, SLE_GENERAL(SL_VAR, base, var, type | flags, 1, from, to, extra), #var, guiflags, SDT_NUMX, startup, def, min, max, interval, str, strhelp, strval, cat, proc)
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, proc)
#define SDT_BOOL(base, var, flags, guiflags, def, str, strhelp, strval, proc, from, to, cat, extra, startup)\
NSD(Bool, SLE_GENERAL(SL_VAR, base, var, SLE_BOOL | flags, 1, from, to, extra), #var, guiflags, SDT_BOOLX, startup, def, str, strhelp, strval, cat, proc)
NSD(Bool, SLE_GENERAL(SL_VAR, base, var, SLE_BOOL | flags, 1, from, to, extra), #var, guiflags, startup, def, str, strhelp, strval, cat, proc)
#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, SDT_INTLIST, startup, def)
NSD(List, SLE_GENERAL(SL_ARR, base, var, type | flags, lengthof(((base*)8)->var), from, to, extra), #var, guiflags, startup, def)
#define SDT_SSTR(base, var, type, flags, guiflags, def, proc, from, to, cat, extra, startup)\
NSD(String, SLE_GENERAL(SL_STDSTR, base, var, type | flags, sizeof(((base*)8)->var), from, to, extra), #var, guiflags, SDT_STDSTRING, startup, def, 0, proc)
NSD(String, SLE_GENERAL(SL_STDSTR, base, var, type | flags, sizeof(((base*)8)->var), from, to, extra), #var, guiflags, startup, def, 0, proc)
#define SDT_OMANY(base, var, type, flags, guiflags, def, max, full, str, strhelp, strval, proc, from, to, load, cat, extra, startup)\
NSD(OneOfMany, SLE_GENERAL(SL_VAR, base, var, type | flags, 1, from, to, extra), #var, guiflags, SDT_ONEOFMANY, startup, def, max, str, strhelp, strval, cat, proc, full, load)
NSD(OneOfMany, SLE_GENERAL(SL_VAR, base, var, type | flags, 1, from, to, extra), #var, guiflags, startup, def, max, str, strhelp, strval, cat, proc, full, load)
#define SDT_MMANY(base, var, type, flags, guiflags, def, full, str, proc, strhelp, strval, from, to, cat, extra, startup)\
NSD(ManyOfMany, SLE_GENERAL(SL_VAR, base, var, type | flags, 1, from, to, extra), #var, guiflags, SDT_MANYOFMANY, startup, def, str, strhelp, strval, cat, proc, full, nullptr)
NSD(ManyOfMany, SLE_GENERAL(SL_VAR, base, var, type | flags, 1, from, to, extra), #var, guiflags, startup, def, str, strhelp, strval, cat, proc, full, nullptr)
#define SDT_NULL(length, from, to)\
NSD(Null, SLE_CONDNULL(length, from, to))