mirror of https://github.com/OpenTTD/OpenTTD
Codechange: rename SettingGuiFlag to SettingFlag (#9332)
It is a lovely organicly grown enum, where it started off with GUI-only flags, and after that a few flags got added that can be considered GUI-only (the GUI disables/enables based on them), to only have flags added that has nothing to do with the GUI. So be less confusing, and rename them to what they do. Additionally, I took this opportunity to rename 0ISDISABLED to reflect what it really does.pull/9336/head
parent
28e90769f7
commit
feb2ddbefa
|
@ -386,9 +386,9 @@ void IntSettingDesc::MakeValueValidAndWrite(const void *object, int32 val) const
|
||||||
* Make the value valid given the limitations of this setting.
|
* Make the value valid given the limitations of this setting.
|
||||||
*
|
*
|
||||||
* In the case of int settings this is ensuring the value is between the minimum and
|
* In the case of int settings this is ensuring the value is between the minimum and
|
||||||
* maximum value, with a special case for 0 if SGF_0ISDISABLED is set.
|
* maximum value, with a special case for 0 if SF_GUI_0_IS_SPECIAL is set.
|
||||||
* This is generally done by clamping the value so it is within the allowed value range.
|
* This is generally done by clamping the value so it is within the allowed value range.
|
||||||
* However, for SGF_MULTISTRING the default is used when the value is not valid.
|
* However, for SF_GUI_DROPDOWN the default is used when the value is not valid.
|
||||||
* @param val The value to make valid.
|
* @param val The value to make valid.
|
||||||
*/
|
*/
|
||||||
void IntSettingDesc::MakeValueValid(int32 &val) const
|
void IntSettingDesc::MakeValueValid(int32 &val) const
|
||||||
|
@ -407,8 +407,8 @@ void IntSettingDesc::MakeValueValid(int32 &val) const
|
||||||
case SLE_VAR_U16:
|
case SLE_VAR_U16:
|
||||||
case SLE_VAR_I32: {
|
case SLE_VAR_I32: {
|
||||||
/* Override the minimum value. No value below this->min, except special value 0 */
|
/* Override the minimum value. No value below this->min, except special value 0 */
|
||||||
if (!(this->flags & SGF_0ISDISABLED) || val != 0) {
|
if (!(this->flags & SF_GUI_0_IS_SPECIAL) || val != 0) {
|
||||||
if (!(this->flags & SGF_MULTISTRING)) {
|
if (!(this->flags & SF_GUI_DROPDOWN)) {
|
||||||
/* Clamp value-type setting to its valid range */
|
/* Clamp value-type setting to its valid range */
|
||||||
val = Clamp(val, this->min, this->max);
|
val = Clamp(val, this->min, this->max);
|
||||||
} else if (val < this->min || val > (int32)this->max) {
|
} else if (val < this->min || val > (int32)this->max) {
|
||||||
|
@ -421,8 +421,8 @@ void IntSettingDesc::MakeValueValid(int32 &val) const
|
||||||
case SLE_VAR_U32: {
|
case SLE_VAR_U32: {
|
||||||
/* Override the minimum value. No value below this->min, except special value 0 */
|
/* Override the minimum value. No value below this->min, except special value 0 */
|
||||||
uint32 uval = (uint32)val;
|
uint32 uval = (uint32)val;
|
||||||
if (!(this->flags & SGF_0ISDISABLED) || uval != 0) {
|
if (!(this->flags & SF_GUI_0_IS_SPECIAL) || uval != 0) {
|
||||||
if (!(this->flags & SGF_MULTISTRING)) {
|
if (!(this->flags & SF_GUI_DROPDOWN)) {
|
||||||
/* Clamp value-type setting to its valid range */
|
/* Clamp value-type setting to its valid range */
|
||||||
uval = ClampU(uval, this->min, this->max);
|
uval = ClampU(uval, this->min, this->max);
|
||||||
} else if (uval < (uint)this->min || uval > this->max) {
|
} else if (uval < (uint)this->min || uval > this->max) {
|
||||||
|
@ -743,13 +743,13 @@ void IniSaveWindowSettings(IniFile *ini, const char *grpname, void *desc)
|
||||||
*/
|
*/
|
||||||
bool SettingDesc::IsEditable(bool do_command) const
|
bool SettingDesc::IsEditable(bool do_command) const
|
||||||
{
|
{
|
||||||
if (!do_command && !(this->save.conv & SLF_NO_NETWORK_SYNC) && _networking && !_network_server && !(this->flags & SGF_PER_COMPANY)) return false;
|
if (!do_command && !(this->save.conv & SLF_NO_NETWORK_SYNC) && _networking && !_network_server && !(this->flags & SF_PER_COMPANY)) return false;
|
||||||
if ((this->flags & SGF_NETWORK_ONLY) && !_networking && _game_mode != GM_MENU) return false;
|
if ((this->flags & SF_NETWORK_ONLY) && !_networking && _game_mode != GM_MENU) return false;
|
||||||
if ((this->flags & SGF_NO_NETWORK) && _networking) return false;
|
if ((this->flags & SF_NO_NETWORK) && _networking) return false;
|
||||||
if ((this->flags & SGF_NEWGAME_ONLY) &&
|
if ((this->flags & SF_NEWGAME_ONLY) &&
|
||||||
(_game_mode == GM_NORMAL ||
|
(_game_mode == GM_NORMAL ||
|
||||||
(_game_mode == GM_EDITOR && !(this->flags & SGF_SCENEDIT_TOO)))) return false;
|
(_game_mode == GM_EDITOR && !(this->flags & SF_SCENEDIT_TOO)))) return false;
|
||||||
if ((this->flags & SGF_SCENEDIT_ONLY) && _game_mode != GM_EDITOR) return false;
|
if ((this->flags & SF_SCENEDIT_ONLY) && _game_mode != GM_EDITOR) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -759,7 +759,7 @@ bool SettingDesc::IsEditable(bool do_command) const
|
||||||
*/
|
*/
|
||||||
SettingType SettingDesc::GetType() const
|
SettingType SettingDesc::GetType() const
|
||||||
{
|
{
|
||||||
if (this->flags & SGF_PER_COMPANY) return ST_COMPANY;
|
if (this->flags & SF_PER_COMPANY) return ST_COMPANY;
|
||||||
return (this->save.conv & SLF_NOT_IN_SAVE) ? ST_CLIENT : ST_GAME;
|
return (this->save.conv & SLF_NOT_IN_SAVE) ? ST_CLIENT : ST_GAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1689,7 +1689,7 @@ void IntSettingDesc::ChangeValue(const void *object, int32 newval) const
|
||||||
this->Write(object, newval);
|
this->Write(object, newval);
|
||||||
if (this->post_callback != nullptr) this->post_callback(newval);
|
if (this->post_callback != nullptr) this->post_callback(newval);
|
||||||
|
|
||||||
if (this->flags & SGF_NO_NETWORK) {
|
if (this->flags & SF_NO_NETWORK) {
|
||||||
GamelogStartAction(GLAT_SETTING);
|
GamelogStartAction(GLAT_SETTING);
|
||||||
GamelogSetting(this->name, oldval, newval);
|
GamelogSetting(this->name, oldval, newval);
|
||||||
GamelogStopAction();
|
GamelogStopAction();
|
||||||
|
@ -1833,7 +1833,7 @@ CommandCost CmdChangeCompanySetting(TileIndex tile, DoCommandFlag flags, uint32
|
||||||
bool SetSettingValue(const IntSettingDesc *sd, int32 value, bool force_newgame)
|
bool SetSettingValue(const IntSettingDesc *sd, int32 value, bool force_newgame)
|
||||||
{
|
{
|
||||||
const IntSettingDesc *setting = sd->AsIntSetting();
|
const IntSettingDesc *setting = sd->AsIntSetting();
|
||||||
if ((setting->flags & SGF_PER_COMPANY) != 0) {
|
if ((setting->flags & SF_PER_COMPANY) != 0) {
|
||||||
if (Company::IsValidID(_local_company) && _game_mode != GM_MENU) {
|
if (Company::IsValidID(_local_company) && _game_mode != GM_MENU) {
|
||||||
return DoCommandP(0, 0, value, CMD_CHANGE_COMPANY_SETTING, nullptr, setting->name);
|
return DoCommandP(0, 0, value, CMD_CHANGE_COMPANY_SETTING, nullptr, setting->name);
|
||||||
}
|
}
|
||||||
|
@ -1992,7 +1992,7 @@ void IConsoleGetSetting(const char *name, bool force_newgame)
|
||||||
sd->FormatValue(value, lastof(value), object);
|
sd->FormatValue(value, lastof(value), object);
|
||||||
const IntSettingDesc *int_setting = sd->AsIntSetting();
|
const IntSettingDesc *int_setting = sd->AsIntSetting();
|
||||||
IConsolePrintF(CC_WARNING, "Current value for '%s' is: '%s' (min: %s%d, max: %u)",
|
IConsolePrintF(CC_WARNING, "Current value for '%s' is: '%s' (min: %s%d, max: %u)",
|
||||||
name, value, (sd->flags & SGF_0ISDISABLED) ? "(0) " : "", int_setting->min, int_setting->max);
|
name, value, (sd->flags & SF_GUI_0_IS_SPECIAL) ? "(0) " : "", int_setting->min, int_setting->max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1147,7 +1147,7 @@ bool SettingEntry::UpdateFilterState(SettingFilter &filter, bool force_visible)
|
||||||
|
|
||||||
static const void *ResolveObject(const GameSettings *settings_ptr, const IntSettingDesc *sd)
|
static const void *ResolveObject(const GameSettings *settings_ptr, const IntSettingDesc *sd)
|
||||||
{
|
{
|
||||||
if ((sd->flags & SGF_PER_COMPANY) != 0) {
|
if ((sd->flags & SF_PER_COMPANY) != 0) {
|
||||||
if (Company::IsValidID(_local_company) && _game_mode != GM_MENU) {
|
if (Company::IsValidID(_local_company) && _game_mode != GM_MENU) {
|
||||||
return &Company::Get(_local_company)->settings;
|
return &Company::Get(_local_company)->settings;
|
||||||
}
|
}
|
||||||
|
@ -1166,13 +1166,13 @@ void SettingEntry::SetValueDParams(uint first_param, int32 value) const
|
||||||
if (this->setting->IsBoolSetting()) {
|
if (this->setting->IsBoolSetting()) {
|
||||||
SetDParam(first_param++, value != 0 ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
|
SetDParam(first_param++, value != 0 ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
|
||||||
} else {
|
} else {
|
||||||
if ((this->setting->flags & SGF_MULTISTRING) != 0) {
|
if ((this->setting->flags & SF_GUI_DROPDOWN) != 0) {
|
||||||
SetDParam(first_param++, this->setting->str_val - this->setting->min + value);
|
SetDParam(first_param++, this->setting->str_val - this->setting->min + value);
|
||||||
} else if ((this->setting->flags & SGF_DISPLAY_ABS) != 0) {
|
} else if ((this->setting->flags & SF_GUI_NEGATIVE_IS_SPECIAL) != 0) {
|
||||||
SetDParam(first_param++, this->setting->str_val + ((value >= 0) ? 1 : 0));
|
SetDParam(first_param++, this->setting->str_val + ((value >= 0) ? 1 : 0));
|
||||||
value = abs(value);
|
value = abs(value);
|
||||||
} else {
|
} else {
|
||||||
SetDParam(first_param++, this->setting->str_val + ((value == 0 && (this->setting->flags & SGF_0ISDISABLED) != 0) ? 1 : 0));
|
SetDParam(first_param++, this->setting->str_val + ((value == 0 && (this->setting->flags & SF_GUI_0_IS_SPECIAL) != 0) ? 1 : 0));
|
||||||
}
|
}
|
||||||
SetDParam(first_param++, value);
|
SetDParam(first_param++, value);
|
||||||
}
|
}
|
||||||
|
@ -1205,13 +1205,13 @@ void SettingEntry::DrawSetting(GameSettings *settings_ptr, int left, int right,
|
||||||
if (sd->IsBoolSetting()) {
|
if (sd->IsBoolSetting()) {
|
||||||
/* Draw checkbox for boolean-value either on/off */
|
/* Draw checkbox for boolean-value either on/off */
|
||||||
DrawBoolButton(buttons_left, button_y, value != 0, editable);
|
DrawBoolButton(buttons_left, button_y, value != 0, editable);
|
||||||
} else if ((sd->flags & SGF_MULTISTRING) != 0) {
|
} else if ((sd->flags & SF_GUI_DROPDOWN) != 0) {
|
||||||
/* Draw [v] button for settings of an enum-type */
|
/* Draw [v] button for settings of an enum-type */
|
||||||
DrawDropDownButton(buttons_left, button_y, COLOUR_YELLOW, state != 0, editable);
|
DrawDropDownButton(buttons_left, button_y, COLOUR_YELLOW, state != 0, editable);
|
||||||
} else {
|
} else {
|
||||||
/* Draw [<][>] boxes for settings of an integer-type */
|
/* Draw [<][>] boxes for settings of an integer-type */
|
||||||
DrawArrowButtons(buttons_left, button_y, COLOUR_YELLOW, state,
|
DrawArrowButtons(buttons_left, button_y, COLOUR_YELLOW, state,
|
||||||
editable && value != (sd->flags & SGF_0ISDISABLED ? 0 : sd->min), editable && (uint32)value != sd->max);
|
editable && value != (sd->flags & SF_GUI_0_IS_SPECIAL ? 0 : sd->min), editable && (uint32)value != sd->max);
|
||||||
}
|
}
|
||||||
this->SetValueDParams(1, value);
|
this->SetValueDParams(1, value);
|
||||||
DrawString(text_left, text_right, y + (SETTING_HEIGHT - FONT_HEIGHT_NORMAL) / 2, sd->str, highlight ? TC_WHITE : TC_LIGHT_BLUE);
|
DrawString(text_left, text_right, y + (SETTING_HEIGHT - FONT_HEIGHT_NORMAL) / 2, sd->str, highlight ? TC_WHITE : TC_LIGHT_BLUE);
|
||||||
|
@ -2182,7 +2182,7 @@ struct GameSettingsWindow : Window {
|
||||||
int32 value = sd->Read(ResolveObject(settings_ptr, sd));
|
int32 value = sd->Read(ResolveObject(settings_ptr, sd));
|
||||||
|
|
||||||
/* clicked on the icon on the left side. Either scroller, bool on/off or dropdown */
|
/* clicked on the icon on the left side. Either scroller, bool on/off or dropdown */
|
||||||
if (x < SETTING_BUTTON_WIDTH && (sd->flags & SGF_MULTISTRING)) {
|
if (x < SETTING_BUTTON_WIDTH && (sd->flags & SF_GUI_DROPDOWN)) {
|
||||||
this->SetDisplayedHelpText(pe);
|
this->SetDisplayedHelpText(pe);
|
||||||
|
|
||||||
if (this->valuedropdown_entry == pe) {
|
if (this->valuedropdown_entry == pe) {
|
||||||
|
@ -2250,7 +2250,7 @@ struct GameSettingsWindow : Window {
|
||||||
if (value < sd->min) value = sd->min; // skip between "disabled" and minimum
|
if (value < sd->min) value = sd->min; // skip between "disabled" and minimum
|
||||||
} else {
|
} else {
|
||||||
value -= step;
|
value -= step;
|
||||||
if (value < sd->min) value = (sd->flags & SGF_0ISDISABLED) ? 0 : sd->min;
|
if (value < sd->min) value = (sd->flags & SF_GUI_0_IS_SPECIAL) ? 0 : sd->min;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up scroller timeout for numeric values */
|
/* Set up scroller timeout for numeric values */
|
||||||
|
@ -2271,10 +2271,10 @@ struct GameSettingsWindow : Window {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Only open editbox if clicked for the second time, and only for types where it is sensible for. */
|
/* Only open editbox if clicked for the second time, and only for types where it is sensible for. */
|
||||||
if (this->last_clicked == pe && !sd->IsBoolSetting() && !(sd->flags & SGF_MULTISTRING)) {
|
if (this->last_clicked == pe && !sd->IsBoolSetting() && !(sd->flags & SF_GUI_DROPDOWN)) {
|
||||||
int64 value64 = value;
|
int64 value64 = value;
|
||||||
/* Show the correct currency-translated value */
|
/* Show the correct currency-translated value */
|
||||||
if (sd->flags & SGF_CURRENCY) value64 *= _currency->rate;
|
if (sd->flags & SF_GUI_CURRENCY) value64 *= _currency->rate;
|
||||||
|
|
||||||
this->valuewindow_entry = pe;
|
this->valuewindow_entry = pe;
|
||||||
SetDParam(0, value64);
|
SetDParam(0, value64);
|
||||||
|
@ -2307,7 +2307,7 @@ struct GameSettingsWindow : Window {
|
||||||
long long llvalue = atoll(str);
|
long long llvalue = atoll(str);
|
||||||
|
|
||||||
/* Save the correct currency-translated value */
|
/* Save the correct currency-translated value */
|
||||||
if (sd->flags & SGF_CURRENCY) llvalue /= _currency->rate;
|
if (sd->flags & SF_GUI_CURRENCY) llvalue /= _currency->rate;
|
||||||
|
|
||||||
value = (int32)ClampToI32(llvalue);
|
value = (int32)ClampToI32(llvalue);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2348,7 +2348,7 @@ struct GameSettingsWindow : Window {
|
||||||
/* Deal with drop down boxes on the panel. */
|
/* Deal with drop down boxes on the panel. */
|
||||||
assert(this->valuedropdown_entry != nullptr);
|
assert(this->valuedropdown_entry != nullptr);
|
||||||
const IntSettingDesc *sd = this->valuedropdown_entry->setting;
|
const IntSettingDesc *sd = this->valuedropdown_entry->setting;
|
||||||
assert(sd->flags & SGF_MULTISTRING);
|
assert(sd->flags & SF_GUI_DROPDOWN);
|
||||||
|
|
||||||
SetSettingValue(sd, index);
|
SetSettingValue(sd, index);
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
|
|
|
@ -12,21 +12,20 @@
|
||||||
|
|
||||||
#include "saveload/saveload.h"
|
#include "saveload/saveload.h"
|
||||||
|
|
||||||
enum SettingGuiFlag : uint16 {
|
enum SettingFlag : uint16 {
|
||||||
/* 2 bytes allocated for a maximum of 16 flags. */
|
SF_NONE = 0,
|
||||||
SGF_NONE = 0,
|
SF_GUI_0_IS_SPECIAL = 1 << 0, ///< A value of zero is possible and has a custom string (the one after "strval").
|
||||||
SGF_0ISDISABLED = 1 << 0, ///< a value of zero means the feature is disabled
|
SF_GUI_NEGATIVE_IS_SPECIAL = 1 << 1, ///< A negative value has another string (the one after "strval").
|
||||||
SGF_DISPLAY_ABS = 1 << 1, ///< display absolute value of the setting
|
SF_GUI_DROPDOWN = 1 << 2, ///< The value represents a limited number of string-options (internally integer) presented as dropdown.
|
||||||
SGF_MULTISTRING = 1 << 2, ///< the value represents a limited number of string-options (internally integer)
|
SF_GUI_CURRENCY = 1 << 3, ///< The number represents money, so when reading value multiply by exchange rate.
|
||||||
SGF_NETWORK_ONLY = 1 << 3, ///< this setting only applies to network games
|
SF_NETWORK_ONLY = 1 << 4, ///< This setting only applies to network games.
|
||||||
SGF_CURRENCY = 1 << 4, ///< the number represents money, so when reading value multiply by exchange rate
|
SF_NO_NETWORK = 1 << 5, ///< This setting does not apply to network games; it may not be changed during the game.
|
||||||
SGF_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.
|
||||||
SGF_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).
|
||||||
SGF_SCENEDIT_TOO = 1 << 7, ///< this setting can be changed in the scenario editor (only makes sense when SGF_NEWGAME_ONLY is set)
|
SF_SCENEDIT_ONLY = 1 << 8, ///< This setting can only be changed in the scenario editor.
|
||||||
SGF_PER_COMPANY = 1 << 8, ///< this setting can be different for each company (saved in company struct)
|
SF_PER_COMPANY = 1 << 9, ///< This setting can be different for each company (saved in company struct).
|
||||||
SGF_SCENEDIT_ONLY = 1 << 9, ///< this setting can only be changed in the scenario editor
|
|
||||||
};
|
};
|
||||||
DECLARE_ENUM_AS_BIT_SET(SettingGuiFlag)
|
DECLARE_ENUM_AS_BIT_SET(SettingFlag)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A SettingCategory defines a grouping of the settings.
|
* A SettingCategory defines a grouping of the settings.
|
||||||
|
@ -67,14 +66,14 @@ struct IniItem;
|
||||||
|
|
||||||
/** Properties of config file settings. */
|
/** Properties of config file settings. */
|
||||||
struct SettingDesc {
|
struct SettingDesc {
|
||||||
SettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, bool startup) :
|
SettingDesc(SaveLoad save, const char *name, SettingFlag flags, bool startup) :
|
||||||
name(name), flags(flags), startup(startup), save(save) {}
|
name(name), flags(flags), startup(startup), save(save) {}
|
||||||
virtual ~SettingDesc() {}
|
virtual ~SettingDesc() {}
|
||||||
|
|
||||||
const char *name; ///< name of the setting. Used in configuration file and for console
|
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.)
|
SettingFlag flags; ///< Handles how a setting would show up in the GUI (text/currency, etc.).
|
||||||
bool startup; ///< setting has to be loaded directly at startup?
|
bool startup; ///< Setting has to be loaded directly at startup?.
|
||||||
SaveLoad save; ///< Internal structure (going to savegame, parts to config)
|
SaveLoad save; ///< Internal structure (going to savegame, parts to config).
|
||||||
|
|
||||||
bool IsEditable(bool do_command = false) const;
|
bool IsEditable(bool do_command = false) const;
|
||||||
SettingType GetType() const;
|
SettingType GetType() const;
|
||||||
|
@ -138,7 +137,7 @@ struct IntSettingDesc : SettingDesc {
|
||||||
*/
|
*/
|
||||||
typedef void PostChangeCallback(int32 value);
|
typedef void PostChangeCallback(int32 value);
|
||||||
|
|
||||||
IntSettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, bool startup, int32 def,
|
IntSettingDesc(SaveLoad save, const char *name, SettingFlag flags, bool startup, int32 def,
|
||||||
int32 min, uint32 max, int32 interval, StringID str, StringID str_help, StringID str_val,
|
int32 min, uint32 max, int32 interval, StringID str, StringID str_help, StringID str_val,
|
||||||
SettingCategory cat, PreChangeCheck pre_check, PostChangeCallback post_callback) :
|
SettingCategory cat, PreChangeCheck pre_check, PostChangeCallback post_callback) :
|
||||||
SettingDesc(save, name, flags, startup), def(def), min(min), max(max), interval(interval),
|
SettingDesc(save, name, flags, startup), def(def), min(min), max(max), interval(interval),
|
||||||
|
@ -180,7 +179,7 @@ private:
|
||||||
|
|
||||||
/** Boolean setting. */
|
/** Boolean setting. */
|
||||||
struct BoolSettingDesc : IntSettingDesc {
|
struct BoolSettingDesc : IntSettingDesc {
|
||||||
BoolSettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, bool startup, bool def,
|
BoolSettingDesc(SaveLoad save, const char *name, SettingFlag flags, bool startup, bool def,
|
||||||
StringID str, StringID str_help, StringID str_val, SettingCategory cat,
|
StringID str, StringID str_help, StringID str_val, SettingCategory cat,
|
||||||
PreChangeCheck pre_check, PostChangeCallback post_callback) :
|
PreChangeCheck pre_check, PostChangeCallback post_callback) :
|
||||||
IntSettingDesc(save, name, flags, startup, def, 0, 1, 0, str, str_help, str_val, cat,
|
IntSettingDesc(save, name, flags, startup, def, 0, 1, 0, str, str_help, str_val, cat,
|
||||||
|
@ -196,7 +195,7 @@ struct BoolSettingDesc : IntSettingDesc {
|
||||||
struct OneOfManySettingDesc : IntSettingDesc {
|
struct OneOfManySettingDesc : IntSettingDesc {
|
||||||
typedef size_t OnConvert(const char *value); ///< callback prototype for conversion error
|
typedef size_t OnConvert(const char *value); ///< callback prototype for conversion error
|
||||||
|
|
||||||
OneOfManySettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, bool startup, int32 def,
|
OneOfManySettingDesc(SaveLoad save, const char *name, SettingFlag flags, bool startup, int32 def,
|
||||||
int32 max, StringID str, StringID str_help, StringID str_val, SettingCategory cat,
|
int32 max, StringID str, StringID str_help, StringID str_val, SettingCategory cat,
|
||||||
PreChangeCheck pre_check, PostChangeCallback post_callback,
|
PreChangeCheck pre_check, PostChangeCallback post_callback,
|
||||||
std::initializer_list<const char *> many, OnConvert *many_cnvt) :
|
std::initializer_list<const char *> many, OnConvert *many_cnvt) :
|
||||||
|
@ -220,7 +219,7 @@ struct OneOfManySettingDesc : IntSettingDesc {
|
||||||
|
|
||||||
/** Many of many setting. */
|
/** Many of many setting. */
|
||||||
struct ManyOfManySettingDesc : OneOfManySettingDesc {
|
struct ManyOfManySettingDesc : OneOfManySettingDesc {
|
||||||
ManyOfManySettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, bool startup,
|
ManyOfManySettingDesc(SaveLoad save, const char *name, SettingFlag flags, bool startup,
|
||||||
int32 def, StringID str, StringID str_help, StringID str_val, SettingCategory cat,
|
int32 def, StringID str, StringID str_help, StringID str_val, SettingCategory cat,
|
||||||
PreChangeCheck pre_check, PostChangeCallback post_callback,
|
PreChangeCheck pre_check, PostChangeCallback post_callback,
|
||||||
std::initializer_list<const char *> many, OnConvert *many_cnvt) :
|
std::initializer_list<const char *> many, OnConvert *many_cnvt) :
|
||||||
|
@ -249,7 +248,7 @@ struct StringSettingDesc : SettingDesc {
|
||||||
*/
|
*/
|
||||||
typedef void PostChangeCallback(const std::string &value);
|
typedef void PostChangeCallback(const std::string &value);
|
||||||
|
|
||||||
StringSettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, bool startup, const char *def,
|
StringSettingDesc(SaveLoad save, const char *name, SettingFlag flags, bool startup, const char *def,
|
||||||
uint32 max_length, PreChangeCheck pre_check, PostChangeCallback post_callback) :
|
uint32 max_length, PreChangeCheck pre_check, PostChangeCallback post_callback) :
|
||||||
SettingDesc(save, name, flags, startup), def(def == nullptr ? "" : def), max_length(max_length),
|
SettingDesc(save, name, flags, startup), def(def == nullptr ? "" : def), max_length(max_length),
|
||||||
pre_check(pre_check), post_callback(post_callback) {}
|
pre_check(pre_check), post_callback(post_callback) {}
|
||||||
|
@ -275,7 +274,7 @@ private:
|
||||||
|
|
||||||
/** List/array settings. */
|
/** List/array settings. */
|
||||||
struct ListSettingDesc : SettingDesc {
|
struct ListSettingDesc : SettingDesc {
|
||||||
ListSettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, bool startup, const char *def) :
|
ListSettingDesc(SaveLoad save, const char *name, SettingFlag flags, bool startup, const char *def) :
|
||||||
SettingDesc(save, name, flags, startup), def(def) {}
|
SettingDesc(save, name, flags, startup), def(def) {}
|
||||||
virtual ~ListSettingDesc() {}
|
virtual ~ListSettingDesc() {}
|
||||||
|
|
||||||
|
@ -289,7 +288,7 @@ struct ListSettingDesc : SettingDesc {
|
||||||
/** Placeholder for settings that have been removed, but might still linger in the savegame. */
|
/** Placeholder for settings that have been removed, but might still linger in the savegame. */
|
||||||
struct NullSettingDesc : SettingDesc {
|
struct NullSettingDesc : SettingDesc {
|
||||||
NullSettingDesc(SaveLoad save) :
|
NullSettingDesc(SaveLoad save) :
|
||||||
SettingDesc(save, "", SGF_NONE, false) {}
|
SettingDesc(save, "", SF_NONE, false) {}
|
||||||
virtual ~NullSettingDesc() {}
|
virtual ~NullSettingDesc() {}
|
||||||
|
|
||||||
void FormatValue(char *buf, const char *last, const void *object) const override { NOT_REACHED(); }
|
void FormatValue(char *buf, const char *last, const void *object) const override { NOT_REACHED(); }
|
||||||
|
|
|
@ -24,7 +24,7 @@ SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for CompanySettings.$v
|
||||||
|
|
||||||
[defaults]
|
[defaults]
|
||||||
flags = 0
|
flags = 0
|
||||||
guiflags = SGF_PER_COMPANY
|
guiflags = SF_PER_COMPANY
|
||||||
interval = 0
|
interval = 0
|
||||||
str = STR_NULL
|
str = STR_NULL
|
||||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||||
|
@ -50,7 +50,7 @@ cat = SC_BASIC
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
var = engine_renew_months
|
var = engine_renew_months
|
||||||
type = SLE_INT16
|
type = SLE_INT16
|
||||||
guiflags = SGF_PER_COMPANY | SGF_DISPLAY_ABS
|
guiflags = SF_PER_COMPANY | SF_GUI_NEGATIVE_IS_SPECIAL
|
||||||
def = 6
|
def = 6
|
||||||
min = -12
|
min = -12
|
||||||
max = 12
|
max = 12
|
||||||
|
@ -61,7 +61,7 @@ strval = STR_CONFIG_SETTING_AUTORENEW_MONTHS_VALUE_BEFORE
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
var = engine_renew_money
|
var = engine_renew_money
|
||||||
type = SLE_UINT
|
type = SLE_UINT
|
||||||
guiflags = SGF_PER_COMPANY | SGF_CURRENCY
|
guiflags = SF_PER_COMPANY | SF_GUI_CURRENCY
|
||||||
def = 100000
|
def = 100000
|
||||||
min = 0
|
min = 0
|
||||||
max = 2000000
|
max = 2000000
|
||||||
|
@ -83,7 +83,7 @@ post_cb = UpdateServiceInterval
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
var = vehicle.servint_trains
|
var = vehicle.servint_trains
|
||||||
type = SLE_UINT16
|
type = SLE_UINT16
|
||||||
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
|
guiflags = SF_PER_COMPANY | SF_GUI_0_IS_SPECIAL
|
||||||
def = 150
|
def = 150
|
||||||
min = 5
|
min = 5
|
||||||
max = 800
|
max = 800
|
||||||
|
@ -96,7 +96,7 @@ post_cb = [](auto new_value) { UpdateServiceInterval(VEH_TRAIN, new_value); }
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
var = vehicle.servint_roadveh
|
var = vehicle.servint_roadveh
|
||||||
type = SLE_UINT16
|
type = SLE_UINT16
|
||||||
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
|
guiflags = SF_PER_COMPANY | SF_GUI_0_IS_SPECIAL
|
||||||
def = 150
|
def = 150
|
||||||
min = 5
|
min = 5
|
||||||
max = 800
|
max = 800
|
||||||
|
@ -109,7 +109,7 @@ post_cb = [](auto new_value) { UpdateServiceInterval(VEH_ROAD, new_value); }
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
var = vehicle.servint_ships
|
var = vehicle.servint_ships
|
||||||
type = SLE_UINT16
|
type = SLE_UINT16
|
||||||
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
|
guiflags = SF_PER_COMPANY | SF_GUI_0_IS_SPECIAL
|
||||||
def = 360
|
def = 360
|
||||||
min = 5
|
min = 5
|
||||||
max = 800
|
max = 800
|
||||||
|
@ -122,7 +122,7 @@ post_cb = [](auto new_value) { UpdateServiceInterval(VEH_SHIP, new_value); }
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
var = vehicle.servint_aircraft
|
var = vehicle.servint_aircraft
|
||||||
type = SLE_UINT16
|
type = SLE_UINT16
|
||||||
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
|
guiflags = SF_PER_COMPANY | SF_GUI_0_IS_SPECIAL
|
||||||
def = 100
|
def = 100
|
||||||
min = 5
|
min = 5
|
||||||
max = 800
|
max = 800
|
||||||
|
|
|
@ -19,7 +19,7 @@ SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for CurrencySpec.$var
|
||||||
|
|
||||||
[defaults]
|
[defaults]
|
||||||
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
||||||
guiflags = SGF_NONE
|
guiflags = SF_NONE
|
||||||
interval = 0
|
interval = 0
|
||||||
str = STR_NULL
|
str = STR_NULL
|
||||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||||
|
|
|
@ -63,7 +63,7 @@ SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for GameSettings.$var
|
||||||
|
|
||||||
[defaults]
|
[defaults]
|
||||||
flags = 0
|
flags = 0
|
||||||
guiflags = SGF_NONE
|
guiflags = SF_NONE
|
||||||
interval = 0
|
interval = 0
|
||||||
str = STR_NULL
|
str = STR_NULL
|
||||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||||
|
|
|
@ -37,7 +37,7 @@ SDTG_OMANY = static_assert($max <= MAX_$type, "Maximum value for $var exceeds st
|
||||||
|
|
||||||
[defaults]
|
[defaults]
|
||||||
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
||||||
guiflags = SGF_NONE
|
guiflags = SF_NONE
|
||||||
interval = 0
|
interval = 0
|
||||||
str = STR_NULL
|
str = STR_NULL
|
||||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,7 +25,7 @@ SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds stor
|
||||||
|
|
||||||
[defaults]
|
[defaults]
|
||||||
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
||||||
guiflags = SGF_NONE
|
guiflags = SF_NONE
|
||||||
interval = 0
|
interval = 0
|
||||||
str = STR_NULL
|
str = STR_NULL
|
||||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||||
|
|
|
@ -21,7 +21,7 @@ SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for WindowDesc.$var ex
|
||||||
|
|
||||||
[defaults]
|
[defaults]
|
||||||
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
||||||
guiflags = SGF_NONE
|
guiflags = SF_NONE
|
||||||
interval = 0
|
interval = 0
|
||||||
str = STR_NULL
|
str = STR_NULL
|
||||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||||
|
|
Loading…
Reference in New Issue