|
@@ -16,28 +16,22 @@
|
|
|
* 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 SettingDescBase
|
|
|
*/
|
|
|
enum SettingDescType : byte {
|
|
|
/* 4 bytes allocated a maximum of 16 types for GenericType */
|
|
|
SDT_BEGIN = 0,
|
|
|
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_END,
|
|
|
/* 9 more possible primitives */
|
|
|
};
|
|
|
|
|
|
|
|
|
enum SettingGuiFlag : uint16 {
|
|
|
/* 1 byte allocated for a maximum of 8 flags
|
|
|
* Flags directing saving/loading of a variable */
|
|
|
/* 2 bytes allocated for a maximum of 16 flags. */
|
|
|
SGF_NONE = 0,
|
|
|
SGF_0ISDISABLED = 1 << 0, ///< a value of zero means the feature is disabled
|
|
|
SGF_DISPLAY_ABS = 1 << 1, ///< display absolute value of the setting
|
|
|
SGF_MULTISTRING = 1 << 2, ///< the value represents a limited number of string-options (internally integer)
|
|
|
SGF_NETWORK_ONLY = 1 << 3, ///< this setting only applies to network games
|
|
|
SGF_CURRENCY = 1 << 4, ///< the number represents money, so when reading value multiply by exchange rate
|
|
@@ -111,21 +105,12 @@ struct SettingDesc {
|
|
|
SaveLoad save; ///< Internal structure (going to savegame, parts to config)
|
|
|
|
|
|
bool IsEditable(bool do_command = false) const;
|
|
|
SettingType GetType() const;
|
|
|
};
|
|
|
|
|
|
/* NOTE: The only difference between SettingDesc and SettingDescGlob is
|
|
|
* that one uses global variables as a source and the other offsets
|
|
|
* in a struct which are bound to a certain variable during runtime.
|
|
|
* The only way to differentiate between these two is to check if an object
|
|
|
* has been passed to the function or not. If not, then it is a global variable
|
|
|
* and save->variable has its address, otherwise save->variable only holds the
|
|
|
* offset in a certain struct */
|
|
|
typedef SettingDesc SettingDescGlobVarList;
|
|
|
|
|
|
const SettingDesc *GetSettingFromName(const char *name);
|
|
|
bool SetSettingValue(const SettingDesc *sd, int32 value, bool force_newgame = false);
|
|
|
bool SetSettingValue(const SettingDesc *sd, const char *value, bool force_newgame = false);
|
|
|
uint GetSettingIndex(const SettingDesc *sd);
|
|
|
|
|
|
#endif /* SETTINGS_INTERNAL_H */
|