src/settings.h
branchcpp_gui
changeset 6303 84c215fc8eb8
parent 6298 c30fe89622df
child 6307 f40e88cff863
child 6916 e87d54a598ea
equal deleted inserted replaced
6302:bd80897189ba 6303:84c215fc8eb8
    42 DECLARE_ENUM_AS_BIT_SET(SettingGuiFlagLong);
    42 DECLARE_ENUM_AS_BIT_SET(SettingGuiFlagLong);
    43 template <> struct EnumPropsT<SettingGuiFlagLong> : MakeEnumPropsT<SettingGuiFlagLong, byte, SGF_NONE, SGF_END, SGF_END> {};
    43 template <> struct EnumPropsT<SettingGuiFlagLong> : MakeEnumPropsT<SettingGuiFlagLong, byte, SGF_NONE, SGF_END, SGF_END> {};
    44 typedef TinyEnumT<SettingGuiFlagLong> SettingGuiFlag;
    44 typedef TinyEnumT<SettingGuiFlagLong> SettingGuiFlag;
    45 
    45 
    46 
    46 
    47 typedef int32 OnChange(int32 var);
    47 typedef int32 OnChange(int32 var);          ///< callback prototype on data modification
       
    48 typedef int32 OnConvert(const char *value); ///< callback prototype for convertion error
    48 
    49 
    49 struct SettingDescBase {
    50 struct SettingDescBase {
    50 	const char *name;       ///< name of the setting. Used in configuration file and for console
    51 	const char *name;       ///< name of the setting. Used in configuration file and for console
    51 	const void *def;        ///< default value given when none is present
    52 	const void *def;        ///< default value given when none is present
    52 	SettingDescType cmd;    ///< various flags for the variable
    53 	SettingDescType cmd;    ///< various flags for the variable
    54 	int32 min, max;         ///< minimum and maximum values
    55 	int32 min, max;         ///< minimum and maximum values
    55 	int32 interval;         ///< the interval to use between settings in the 'patches' window. If interval is '0' the interval is dynamically determined
    56 	int32 interval;         ///< the interval to use between settings in the 'patches' window. If interval is '0' the interval is dynamically determined
    56 	const char *many;       ///< ONE/MANY_OF_MANY: string of possible values for this type
    57 	const char *many;       ///< ONE/MANY_OF_MANY: string of possible values for this type
    57 	StringID str;           ///< (translated) string with descriptive text; gui and console
    58 	StringID str;           ///< (translated) string with descriptive text; gui and console
    58 	OnChange *proc;         ///< callback procedure for when the value is changed
    59 	OnChange *proc;         ///< callback procedure for when the value is changed
       
    60 	OnConvert *proc_cnvt;   ///< callback procedure when loading value mechanism fails
    59 };
    61 };
    60 
    62 
    61 struct SettingDesc {
    63 struct SettingDesc {
    62 	SettingDescBase desc;   ///< Settings structure (going to configuration file)
    64 	SettingDescBase desc;   ///< Settings structure (going to configuration file)
    63 	SaveLoad save;          ///< Internal structure (going to savegame, parts to config)
    65 	SaveLoad save;          ///< Internal structure (going to savegame, parts to config)