OpenTTD Source: src/settings_internal.h Source File

OpenTTD Source 12.0-beta1

settings_internal.h
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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/>.
6 */
7
10 #ifndef SETTINGS_INTERNAL_H
11 #define SETTINGS_INTERNAL_H
12
13 #include <variant>
14 #include "saveload/saveload.h"
15
16 enum SettingFlag : uint16 {
17 SF_NONE = 0,
18 SF_GUI_0_IS_SPECIAL = 1 << 0,
19 SF_GUI_NEGATIVE_IS_SPECIAL = 1 << 1,
20 SF_GUI_DROPDOWN = 1 << 2,
21 SF_GUI_CURRENCY = 1 << 3,
22 SF_NETWORK_ONLY = 1 << 4,
23 SF_NO_NETWORK = 1 << 5,
24 SF_NEWGAME_ONLY = 1 << 6,
25 SF_SCENEDIT_TOO = 1 << 7,
26 SF_SCENEDIT_ONLY = 1 << 8,
27 SF_PER_COMPANY = 1 << 9,
28 SF_NOT_IN_SAVE = 1 << 10,
29 SF_NOT_IN_CONFIG = 1 << 11,
30 SF_NO_NETWORK_SYNC = 1 << 12,
31 };
32 DECLARE_ENUM_AS_BIT_SET(SettingFlag)
33
34
42 enum SettingCategory {
43 SC_NONE = 0,
44
45 /* Filters for the list */
46 SC_BASIC_LIST = 1 << 0,
47 SC_ADVANCED_LIST = 1 << 1,
48 SC_EXPERT_LIST = 1 << 2,
49
50 /* Setting classification */
51 SC_BASIC = SC_BASIC_LIST | SC_ADVANCED_LIST | SC_EXPERT_LIST,
52 SC_ADVANCED = SC_ADVANCED_LIST | SC_EXPERT_LIST,
53 SC_EXPERT = SC_EXPERT_LIST,
54
55 SC_END,
56 };
57
61 enum SettingType {
62 ST_GAME,
63 ST_COMPANY,
64 ST_CLIENT,
65
66 ST_ALL,
67 };
68
69 struct IniItem;
70
72 struct SettingDesc {
73 SettingDesc(SaveLoad save, SettingFlag flags, bool startup) :
74 flags(flags), startup(startup), save(save) {}
75 virtual ~SettingDesc() {}
76
77 SettingFlag flags;
78 bool startup;
79 SaveLoad save;
80
81 bool IsEditable(bool do_command = false) const;
82 SettingType GetType() const;
83
88 constexpr const std::string &GetName() const
89 {
90 return this->save.name;
91 }
92
97 virtual bool IsIntSetting() const { return false; }
98
103 virtual bool IsStringSetting() const { return false; }
104
105 const struct IntSettingDesc *AsIntSetting() const;
106 const struct StringSettingDesc *AsStringSetting() const;
107
114 virtual void FormatValue(char *buf, const char *last, const void *object) const = 0;
115
121 virtual void ParseValue(const IniItem *item, void *object) const = 0;
122
132 virtual bool IsSameValue(const IniItem *item, void *object) const = 0;
133 };
134
136 struct IntSettingDesc : SettingDesc {
145 typedef bool PreChangeCheck(int32 &value);
150 typedef void PostChangeCallback(int32 value);
151
152 IntSettingDesc(SaveLoad save, SettingFlag flags, bool startup, int32 def,
153 int32 min, uint32 max, int32 interval, StringID str, StringID str_help, StringID str_val,
154 SettingCategory cat, PreChangeCheck pre_check, PostChangeCallback post_callback) :
155 SettingDesc(save, flags, startup), def(def), min(min), max(max), interval(interval),
156 str(str), str_help(str_help), str_val(str_val), cat(cat), pre_check(pre_check),
157 post_callback(post_callback) {}
158 virtual ~IntSettingDesc() {}
159
160 int32 def;
161 int32 min;
162 uint32 max;
163 int32 interval;
164 StringID str;
165 StringID str_help;
166 StringID str_val;
167 SettingCategory cat;
168 PreChangeCheck *pre_check;
169 PostChangeCallback *post_callback;
170
175 virtual bool IsBoolSetting() const { return false; }
176 bool IsIntSetting() const override { return true; }
177
178 void ChangeValue(const void *object, int32 newvalue) const;
179 void MakeValueValidAndWrite(const void *object, int32 value) const;
180
181 virtual size_t ParseValue(const char *str) const;
182 void FormatValue(char *buf, const char *last, const void *object) const override;
183 void ParseValue(const IniItem *item, void *object) const override;
184 bool IsSameValue(const IniItem *item, void *object) const override;
185 int32 Read(const void *object) const;
186
187 private:
188 void MakeValueValid(int32 &value) const;
189 void Write(const void *object, int32 value) const;
190 };
191
193 struct BoolSettingDesc : IntSettingDesc {
194 BoolSettingDesc(SaveLoad save, SettingFlag flags, bool startup, bool def,
195 StringID str, StringID str_help, StringID str_val, SettingCategory cat,
196 PreChangeCheck pre_check, PostChangeCallback post_callback) :
197 IntSettingDesc(save, flags, startup, def, 0, 1, 0, str, str_help, str_val, cat,
198 pre_check, post_callback) {}
199 virtual ~BoolSettingDesc() {}
200
201 bool IsBoolSetting() const override { return true; }
202 size_t ParseValue(const char *str) const override;
203 void FormatValue(char *buf, const char *last, const void *object) const override;
204 };
205
207 struct OneOfManySettingDesc : IntSettingDesc {
208 typedef size_t OnConvert(const char *value);
209
210 OneOfManySettingDesc(SaveLoad save, SettingFlag flags, bool startup, int32 def,
211 int32 max, StringID str, StringID str_help, StringID str_val, SettingCategory cat,
212 PreChangeCheck pre_check, PostChangeCallback post_callback,
213 std::initializer_list<const char *> many, OnConvert *many_cnvt) :
214 IntSettingDesc(save, flags, startup, def, 0, max, 0, str, str_help, str_val, cat,
215 pre_check, post_callback), many_cnvt(many_cnvt)
216 {
217 for (auto one : many) this->many.push_back(one);
218 }
219
220 virtual ~OneOfManySettingDesc() {}
221
222 std::vector<std::string> many;
223 OnConvert *many_cnvt;
224
225 static size_t ParseSingleValue(const char *str, size_t len, const std::vector<std::string> &many);
226 char *FormatSingleValue(char *buf, const char *last, uint id) const;
227
228 size_t ParseValue(const char *str) const override;
229 void FormatValue(char *buf, const char *last, const void *object) const override;
230 };
231
233 struct ManyOfManySettingDesc : OneOfManySettingDesc {
234 ManyOfManySettingDesc(SaveLoad save, SettingFlag flags, bool startup,
235 int32 def, StringID str, StringID str_help, StringID str_val, SettingCategory cat,
236 PreChangeCheck pre_check, PostChangeCallback post_callback,
237 std::initializer_list<const char *> many, OnConvert *many_cnvt) :
238 OneOfManySettingDesc(save, flags, startup, def, (1 << many.size()) - 1, str, str_help,
239 str_val, cat, pre_check, post_callback, many, many_cnvt) {}
240 virtual ~ManyOfManySettingDesc() {}
241
242 size_t ParseValue(const char *str) const override;
243 void FormatValue(char *buf, const char *last, const void *object) const override;
244 };
245
247 struct StringSettingDesc : SettingDesc {
256 typedef bool PreChangeCheck(std::string &value);
261 typedef void PostChangeCallback(const std::string &value);
262
263 StringSettingDesc(SaveLoad save, SettingFlag flags, bool startup, const char *def,
264 uint32 max_length, PreChangeCheck pre_check, PostChangeCallback post_callback) :
265 SettingDesc(save, flags, startup), def(def == nullptr ? "" : def), max_length(max_length),
266 pre_check(pre_check), post_callback(post_callback) {}
267 virtual ~StringSettingDesc() {}
268
269 std::string def;
270 uint32 max_length;
271 PreChangeCheck *pre_check;
272 PostChangeCallback *post_callback;
273
274 bool IsStringSetting() const override { return true; }
275 void ChangeValue(const void *object, std::string &newval) const;
276
277 void FormatValue(char *buf, const char *last, const void *object) const override;
278 void ParseValue(const IniItem *item, void *object) const override;
279 bool IsSameValue(const IniItem *item, void *object) const override;
280 const std::string &Read(const void *object) const;
281
282 private:
283 void MakeValueValid(std::string &str) const;
284 void Write(const void *object, const std::string &str) const;
285 };
286
288 struct ListSettingDesc : SettingDesc {
289 ListSettingDesc(SaveLoad save, SettingFlag flags, bool startup, const char *def) :
290 SettingDesc(save, flags, startup), def(def) {}
291 virtual ~ListSettingDesc() {}
292
293 const char *def;
294
295 void FormatValue(char *buf, const char *last, const void *object) const override;
296 void ParseValue(const IniItem *item, void *object) const override;
297 bool IsSameValue(const IniItem *item, void *object) const override;
298 };
299
301 struct NullSettingDesc : SettingDesc {
302 NullSettingDesc(SaveLoad save) :
303 SettingDesc(save, SF_NOT_IN_CONFIG, false) {}
304 virtual ~NullSettingDesc() {}
305
306 void FormatValue(char *buf, const char *last, const void *object) const override { NOT_REACHED(); }
307 void ParseValue(const IniItem *item, void *object) const override { NOT_REACHED(); }
308 bool IsSameValue(const IniItem *item, void *object) const override { NOT_REACHED(); }
309 };
310
311 typedef std::variant<IntSettingDesc, BoolSettingDesc, OneOfManySettingDesc, ManyOfManySettingDesc, StringSettingDesc, ListSettingDesc, NullSettingDesc> SettingVariant;
312
318 static constexpr const SettingDesc *GetSettingDesc(const SettingVariant &desc)
319 {
320 return std::visit([](auto&& arg) -> const SettingDesc * { return &arg; }, desc);
321 }
322
323 typedef span<const SettingVariant> SettingTable;
324
325 const SettingDesc *GetSettingFromName(const std::string_view name);
326 void GetSaveLoadFromSettingTable(SettingTable settings, std::vector<SaveLoad> &saveloads);
327 bool SetSettingValue(const IntSettingDesc *sd, int32 value, bool force_newgame = false);
328 bool SetSettingValue(const StringSettingDesc *sd, const std::string value, bool force_newgame = false);
329
330 #endif /* SETTINGS_INTERNAL_H */
ManyOfManySettingDesc
Many of many setting.
Definition: settings_internal.h:233
OneOfManySettingDesc::FormatValue
void FormatValue(char *buf, const char *last, const void *object) const override
Format the value of the setting associated with this object.
Definition: settings.cpp:349
OneOfManySettingDesc
One of many setting.
Definition: settings_internal.h:207
StringSettingDesc::FormatValue
void FormatValue(char *buf, const char *last, const void *object) const override
Format the value of the setting associated with this object.
Definition: settings.cpp:697
IntSettingDesc::MakeValueValid
void MakeValueValid(int32 &value) const
Make the value valid given the limitations of this setting.
Definition: settings.cpp:449
SF_PER_COMPANY
@ SF_PER_COMPANY
This setting can be different for each company (saved in company struct).
Definition: settings_internal.h:27
NullSettingDesc::IsSameValue
bool IsSameValue(const IniItem *item, void *object) const override
Check whether the value in the Ini item is the same as is saved in this setting in the object.
Definition: settings_internal.h:308
SF_NOT_IN_SAVE
@ SF_NOT_IN_SAVE
Do not save with savegame, basically client-based.
Definition: settings_internal.h:28
SF_GUI_0_IS_SPECIAL
@ SF_GUI_0_IS_SPECIAL
A value of zero is possible and has a custom string (the one after "strval").
Definition: settings_internal.h:18
StringSettingDesc::MakeValueValid
void MakeValueValid(std::string &str) const
Make the value valid given the limitations of this setting.
Definition: settings.cpp:526
StringSettingDesc::PreChangeCheck
bool PreChangeCheck(std::string &value)
A check to be performed before the setting gets changed.
Definition: settings_internal.h:256
StringSettingDesc::pre_check
PreChangeCheck * pre_check
Callback to check for the validity of the setting.
Definition: settings_internal.h:271
SC_EXPERT_LIST
@ SC_EXPERT_LIST
Settings displayed in the list of expert settings.
Definition: settings_internal.h:48
StringSettingDesc::IsSameValue
bool IsSameValue(const IniItem *item, void *object) const override
Check whether the value in the Ini item is the same as is saved in this setting in the object.
Definition: settings.cpp:715
IntSettingDesc::cat
SettingCategory cat
assigned categories of the setting
Definition: settings_internal.h:167
SF_NOT_IN_CONFIG
@ SF_NOT_IN_CONFIG
Do not save to config file.
Definition: settings_internal.h:29
StringSettingDesc::PostChangeCallback
void PostChangeCallback(const std::string &value)
A callback to denote that a setting has been changed.
Definition: settings_internal.h:261
NullSettingDesc
Placeholder for settings that have been removed, but might still linger in the savegame.
Definition: settings_internal.h:301
IntSettingDesc::min
int32 min
minimum values
Definition: settings_internal.h:161
NullSettingDesc::ParseValue
void ParseValue(const IniItem *item, void *object) const override
Parse/read the value from the Ini item into the setting associated with this object.
Definition: settings_internal.h:307
ManyOfManySettingDesc::FormatValue
void FormatValue(char *buf, const char *last, const void *object) const override
Format the value of the setting associated with this object.
Definition: settings.cpp:355
ST_GAME
@ ST_GAME
Game setting.
Definition: settings_internal.h:62
IntSettingDesc::MakeValueValidAndWrite
void MakeValueValidAndWrite(const void *object, int32 value) const
Make the value valid and then write it to the setting.
Definition: settings.cpp:434
IniItem
A single "line" in an ini file.
Definition: ini_type.h:25
SettingDesc::save
SaveLoad save
Internal structure (going to savegame, parts to config).
Definition: settings_internal.h:79
SettingDesc::GetType
SettingType GetType() const
Return the type of the setting.
Definition: settings.cpp:817
SettingDesc::IsEditable
bool IsEditable(bool do_command=false) const
Check whether the setting is editable in the current gamemode.
Definition: settings.cpp:801
ST_CLIENT
@ ST_CLIENT
Client setting.
Definition: settings_internal.h:64
SettingDesc::FormatValue
virtual void FormatValue(char *buf, const char *last, const void *object) const =0
Format the value of the setting associated with this object.
IntSettingDesc::ChangeValue
void ChangeValue(const void *object, int32 newvalue) const
Handle changing a value.
Definition: settings.cpp:1364
saveload.h
SF_NO_NETWORK_SYNC
@ SF_NO_NETWORK_SYNC
Do not synchronize over network (but it is saved if SF_NOT_IN_SAVE is not set).
Definition: settings_internal.h:30
ST_COMPANY
@ ST_COMPANY
Company setting.
Definition: settings_internal.h:63
GetSaveLoadFromSettingTable
void GetSaveLoadFromSettingTable(SettingTable settings, std::vector< SaveLoad > &saveloads)
Get the SaveLoad for all settings in the settings table.
Definition: settings.cpp:1417
StringSettingDesc::Read
const std::string & Read(const void *object) const
Read the string from the the actual setting.
Definition: settings.cpp:552
StringSettingDesc::post_callback
PostChangeCallback * post_callback
Callback when the setting has been changed.
Definition: settings_internal.h:272
SettingDesc::flags
SettingFlag flags
Handles how a setting would show up in the GUI (text/currency, etc.).
Definition: settings_internal.h:77
SettingDesc::IsSameValue
virtual bool IsSameValue(const IniItem *item, void *object) const =0
Check whether the value in the Ini item is the same as is saved in this setting in the object.
IntSettingDesc::pre_check
PreChangeCheck * pre_check
Callback to check for the validity of the setting.
Definition: settings_internal.h:168
StringSettingDesc::max_length
uint32 max_length
Maximum length of the string, 0 means no maximum length.
Definition: settings_internal.h:270
SettingDesc::AsStringSetting
const struct StringSettingDesc * AsStringSetting() const
Get the setting description of this setting as a string setting.
Definition: settings.cpp:837
ManyOfManySettingDesc::ParseValue
size_t ParseValue(const char *str) const override
Convert a string representation (external) of an integer-like setting to an integer.
Definition: settings.cpp:405
IntSettingDesc::IsIntSetting
bool IsIntSetting() const override
Check whether this setting is an integer type setting.
Definition: settings_internal.h:176
SettingFlag
SettingFlag
Definition: settings_internal.h:16
SettingDesc::ParseValue
virtual void ParseValue(const IniItem *item, void *object) const =0
Parse/read the value from the Ini item into the setting associated with this object.
StringSettingDesc
String settings.
Definition: settings_internal.h:247
ListSettingDesc::ParseValue
void ParseValue(const IniItem *item, void *object) const override
Parse/read the value from the Ini item into the setting associated with this object.
Definition: settings.cpp:616
SettingType
SettingType
Type of settings for filtering.
Definition: settings_internal.h:61
StringSettingDesc::ChangeValue
void ChangeValue(const void *object, std::string &newval) const
Handle changing a string value.
Definition: settings.cpp:1613
StringSettingDesc::IsStringSetting
bool IsStringSetting() const override
Check whether this setting is an string type setting.
Definition: settings_internal.h:274
IntSettingDesc::str_val
StringID str_val
(Translated) first string describing the value.
Definition: settings_internal.h:166
SF_NETWORK_ONLY
@ SF_NETWORK_ONLY
This setting only applies to network games.
Definition: settings_internal.h:22
BoolSettingDesc::IsBoolSetting
bool IsBoolSetting() const override
Check whether this setting is a boolean type setting.
Definition: settings_internal.h:201
span
A trimmed down version of what std::span will be in C++20.
Definition: span_type.hpp:60
SettingDesc::startup
bool startup
Setting has to be loaded directly at startup?.
Definition: settings_internal.h:78
IntSettingDesc
Base integer type, including boolean, settings.
Definition: settings_internal.h:136
SC_ADVANCED
@ SC_ADVANCED
Advanced settings are part of advanced and expert list.
Definition: settings_internal.h:52
SettingDesc::GetName
constexpr const std::string & GetName() const
Get the name of this setting.
Definition: settings_internal.h:88
SF_NEWGAME_ONLY
@ SF_NEWGAME_ONLY
This setting cannot be changed in a game.
Definition: settings_internal.h:24
StringSettingDesc::ParseValue
void ParseValue(const IniItem *item, void *object) const override
Parse/read the value from the Ini item into the setting associated with this object.
Definition: settings.cpp:609
settings
fluid_settings_t * settings
FluidSynth settings handle.
Definition: fluidsynth.cpp:21
OneOfManySettingDesc::many_cnvt
OnConvert * many_cnvt
callback procedure when loading value mechanism fails
Definition: settings_internal.h:223
SF_GUI_NEGATIVE_IS_SPECIAL
@ SF_GUI_NEGATIVE_IS_SPECIAL
A negative value has another string (the one after "strval").
Definition: settings_internal.h:19
ListSettingDesc::FormatValue
void FormatValue(char *buf, const char *last, const void *object) const override
Convert an integer-array (intlist) to a string representation.
Definition: settings.cpp:317
GetSettingDesc
static constexpr const SettingDesc * GetSettingDesc(const SettingVariant &desc)
Helper to convert the type of the iterated settings description to a pointer to it.
Definition: settings_internal.h:318
ListSettingDesc
List/array settings.
Definition: settings_internal.h:288
SetSettingValue
bool SetSettingValue(const IntSettingDesc *sd, int32 value, bool force_newgame=false)
Top function to save the new value of an element of the Settings struct.
Definition: settings.cpp:1524
SF_GUI_CURRENCY
@ SF_GUI_CURRENCY
The number represents money, so when reading value multiply by exchange rate.
Definition: settings_internal.h:21
IntSettingDesc::PreChangeCheck
bool PreChangeCheck(int32 &value)
A check to be performed before the setting gets changed.
Definition: settings_internal.h:145
IntSettingDesc::Write
void Write(const void *object, int32 value) const
Set the value of a setting.
Definition: settings.cpp:502
OneOfManySettingDesc::ParseValue
size_t ParseValue(const char *str) const override
Convert a string representation (external) of an integer-like setting to an integer.
Definition: settings.cpp:390
SettingDesc::IsStringSetting
virtual bool IsStringSetting() const
Check whether this setting is an string type setting.
Definition: settings_internal.h:103
OneOfManySettingDesc::many
std::vector< std::string > many
possible values for this type
Definition: settings_internal.h:222
SC_BASIC
@ SC_BASIC
Basic settings are part of all lists.
Definition: settings_internal.h:51
BoolSettingDesc::ParseValue
size_t ParseValue(const char *str) const override
Convert a string representation (external) of an integer-like setting to an integer.
Definition: settings.cpp:416
StringID
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
IntSettingDesc::str_help
StringID str_help
(Translated) string with help text; gui only.
Definition: settings_internal.h:165
IntSettingDesc::IsSameValue
bool IsSameValue(const IniItem *item, void *object) const override
Check whether the value in the Ini item is the same as is saved in this setting in the object.
Definition: settings.cpp:690
IntSettingDesc::interval
int32 interval
the interval to use between settings in the 'settings' window. If interval is '0' the interval is dyn...
Definition: settings_internal.h:163
SettingDesc
Properties of config file settings.
Definition: settings_internal.h:72
SC_BASIC_LIST
@ SC_BASIC_LIST
Settings displayed in the list of basic settings.
Definition: settings_internal.h:46
GetSettingFromName
const SettingDesc * GetSettingFromName(const std::string_view name)
Given a name of any setting, return any setting description of it.
Definition: settings.cpp:1445
IntSettingDesc::str
StringID str
(translated) string with descriptive text; gui and console
Definition: settings_internal.h:164
NullSettingDesc::FormatValue
void FormatValue(char *buf, const char *last, const void *object) const override
Format the value of the setting associated with this object.
Definition: settings_internal.h:306
ListSettingDesc::def
const char * def
default value given when none is present
Definition: settings_internal.h:293
SF_SCENEDIT_ONLY
@ SF_SCENEDIT_ONLY
This setting can only be changed in the scenario editor.
Definition: settings_internal.h:26
IntSettingDesc::IsBoolSetting
virtual bool IsBoolSetting() const
Check whether this setting is a boolean type setting.
Definition: settings_internal.h:175
SF_GUI_DROPDOWN
@ SF_GUI_DROPDOWN
The value represents a limited number of string-options (internally integer) presented as dropdown.
Definition: settings_internal.h:20
IntSettingDesc::Read
int32 Read(const void *object) const
Read the integer from the the actual setting.
Definition: settings.cpp:513
ListSettingDesc::IsSameValue
bool IsSameValue(const IniItem *item, void *object) const override
Check whether the value in the Ini item is the same as is saved in this setting in the object.
Definition: settings.cpp:725
IntSettingDesc::ParseValue
virtual size_t ParseValue(const char *str) const
Convert a string representation (external) of an integer-like setting to an integer.
Definition: settings.cpp:371
DECLARE_ENUM_AS_BIT_SET
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
Definition: company_manager_face.h:29
BoolSettingDesc
Boolean setting.
Definition: settings_internal.h:193
StringSettingDesc::Write
void Write(const void *object, const std::string &str) const
Write a string to the actual setting.
Definition: settings.cpp:542
IntSettingDesc::max
uint32 max
maximum values
Definition: settings_internal.h:162
SF_SCENEDIT_TOO
@ SF_SCENEDIT_TOO
This setting can be changed in the scenario editor (only makes sense when SF_NEWGAME_ONLY is set).
Definition: settings_internal.h:25
StringSettingDesc::def
std::string def
Default value given when none is present.
Definition: settings_internal.h:269
IntSettingDesc::PostChangeCallback
void PostChangeCallback(int32 value)
A callback to denote that a setting has been changed.
Definition: settings_internal.h:150
IntSettingDesc::post_callback
PostChangeCallback * post_callback
Callback when the setting has been changed.
Definition: settings_internal.h:169
SettingCategory
SettingCategory
A SettingCategory defines a grouping of the settings.
Definition: settings_internal.h:42
ST_ALL
@ ST_ALL
Used in setting filter to match all types.
Definition: settings_internal.h:66
SC_ADVANCED_LIST
@ SC_ADVANCED_LIST
Settings displayed in the list of advanced settings.
Definition: settings_internal.h:47
SaveLoad::name
std::string name
Name of this field (optional, used for tables).
Definition: saveload.h:653
SC_EXPERT
@ SC_EXPERT
Expert settings can only be seen in the expert list.
Definition: settings_internal.h:53
SettingDesc::IsIntSetting
virtual bool IsIntSetting() const
Check whether this setting is an integer type setting.
Definition: settings_internal.h:97
BoolSettingDesc::FormatValue
void FormatValue(char *buf, const char *last, const void *object) const override
Format the value of the setting associated with this object.
Definition: settings.cpp:684
SaveLoad
SaveLoad type struct.
Definition: saveload.h:652
SF_NO_NETWORK
@ SF_NO_NETWORK
This setting does not apply to network games; it may not be changed during the game.
Definition: settings_internal.h:23
IntSettingDesc::def
int32 def
default value given when none is present
Definition: settings_internal.h:160
OneOfManySettingDesc::OnConvert
size_t OnConvert(const char *value)
callback prototype for conversion error
Definition: settings_internal.h:208
OneOfManySettingDesc::ParseSingleValue
static size_t ParseSingleValue(const char *str, size_t len, const std::vector< std::string > &many)
Find the index value of a ONEofMANY type in a string separated by |.
Definition: settings.cpp:172
SettingDesc::AsIntSetting
const struct IntSettingDesc * AsIntSetting() const
Get the setting description of this setting as an integer setting.
Definition: settings.cpp:827
IntSettingDesc::FormatValue
void FormatValue(char *buf, const char *last, const void *object) const override
Format the value of the setting associated with this object.
Definition: settings.cpp:678