7 |
7 |
8 /** Convention/Type of settings. This is then further specified if necessary |
8 /** Convention/Type of settings. This is then further specified if necessary |
9 * with the SLE_ (SLE_VAR/SLE_FILE) enums in saveload.h |
9 * with the SLE_ (SLE_VAR/SLE_FILE) enums in saveload.h |
10 * @see VarTypes |
10 * @see VarTypes |
11 * @see SettingDescBase */ |
11 * @see SettingDescBase */ |
12 enum SettingDescType { |
12 enum SettingDescTypeLong { |
13 /* 4 bytes allocated a maximum of 16 types for GenericType */ |
13 /* 4 bytes allocated a maximum of 16 types for GenericType */ |
|
14 SDT_BEGIN = 0, |
14 SDT_NUMX = 0, // any number-type |
15 SDT_NUMX = 0, // any number-type |
15 SDT_BOOLX = 1, // a boolean number |
16 SDT_BOOLX = 1, // a boolean number |
16 SDT_ONEOFMANY = 2, // bitmasked number where only ONE bit may be set |
17 SDT_ONEOFMANY = 2, // bitmasked number where only ONE bit may be set |
17 SDT_MANYOFMANY = 3, // bitmasked number where MULTIPLE bits may be set |
18 SDT_MANYOFMANY = 3, // bitmasked number where MULTIPLE bits may be set |
18 SDT_INTLIST = 4, // list of integers seperated by a comma ',' |
19 SDT_INTLIST = 4, // list of integers seperated by a comma ',' |
19 SDT_STRING = 5, // string with a pre-allocated buffer |
20 SDT_STRING = 5, // string with a pre-allocated buffer |
|
21 SDT_END, |
20 /* 10 more possible primitives */ |
22 /* 10 more possible primitives */ |
21 }; |
23 }; |
22 |
24 |
23 enum SettingGuiFlag { |
25 template <> struct EnumPropsT<SettingDescTypeLong> : MakeEnumPropsT<SettingDescTypeLong, byte, SDT_BEGIN, SDT_END, SDT_END> {}; |
|
26 typedef TinyEnumT<SettingDescTypeLong> SettingDescType; |
|
27 |
|
28 |
|
29 enum SettingGuiFlagLong { |
24 /* 8 bytes allocated for a maximum of 8 flags |
30 /* 8 bytes allocated for a maximum of 8 flags |
25 * Flags directing saving/loading of a variable */ |
31 * Flags directing saving/loading of a variable */ |
|
32 SGF_NONE = 0, |
26 SGF_0ISDISABLED = 1 << 0, ///< a value of zero means the feature is disabled |
33 SGF_0ISDISABLED = 1 << 0, ///< a value of zero means the feature is disabled |
27 SGF_NOCOMMA = 1 << 1, ///< number without any thousand seperators (no formatting) |
34 SGF_NOCOMMA = 1 << 1, ///< number without any thousand seperators (no formatting) |
28 SGF_MULTISTRING = 1 << 2, ///< the value represents a limited number of string-options (internally integer) |
35 SGF_MULTISTRING = 1 << 2, ///< the value represents a limited number of string-options (internally integer) |
29 SGF_NETWORK_ONLY = 1 << 3, ///< this setting only applies to network games |
36 SGF_NETWORK_ONLY = 1 << 3, ///< this setting only applies to network games |
30 SGF_CURRENCY = 1 << 4, ///< the number represents money, so when reading value multiply by exchange rate |
37 SGF_CURRENCY = 1 << 4, ///< the number represents money, so when reading value multiply by exchange rate |
|
38 SGF_END = 1 << 5, |
31 /* 3 more possible flags */ |
39 /* 3 more possible flags */ |
32 }; |
40 }; |
33 |
41 |
|
42 DECLARE_ENUM_AS_BIT_SET(SettingGuiFlagLong); |
|
43 template <> struct EnumPropsT<SettingGuiFlagLong> : MakeEnumPropsT<SettingGuiFlagLong, byte, SGF_NONE, SGF_END, SGF_END> {}; |
|
44 typedef TinyEnumT<SettingGuiFlagLong> SettingGuiFlag; |
|
45 |
|
46 |
34 typedef int32 OnChange(int32 var); |
47 typedef int32 OnChange(int32 var); |
35 typedef byte SettingDescType; |
|
36 typedef byte SettingGuiFlag; |
|
37 |
48 |
38 typedef struct SettingDescBase { |
49 typedef struct SettingDescBase { |
39 const char *name; ///< name of the setting. Used in configuration file and for console |
50 const char *name; ///< name of the setting. Used in configuration file and for console |
40 const void *def; ///< default value given when none is present |
51 const void *def; ///< default value given when none is present |
41 SettingDescType cmd; ///< various flags for the variable |
52 SettingDescType cmd; ///< various flags for the variable |