src/settings.h
branchgamebalance
changeset 9895 7bd07f43b0e3
parent 5838 9c3129cb019b
child 6303 84c215fc8eb8
equal deleted inserted replaced
9894:70d78ac95d6c 9895:7bd07f43b0e3
    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);
    48 
    48 
    49 typedef struct SettingDescBase {
    49 struct SettingDescBase {
    50 	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
    51 	const void *def;        ///< default value given when none is present
    51 	const void *def;        ///< default value given when none is present
    52 	SettingDescType cmd;    ///< various flags for the variable
    52 	SettingDescType cmd;    ///< various flags for the variable
    53 	SettingGuiFlag flags;   ///< handles how a setting would show up in the GUI (text/currency, etc.)
    53 	SettingGuiFlag flags;   ///< handles how a setting would show up in the GUI (text/currency, etc.)
    54 	int32 min, max;         ///< minimum and maximum values
    54 	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
    55 	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
    56 	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
    57 	StringID str;           ///< (translated) string with descriptive text; gui and console
    58 	OnChange *proc;         ///< callback procedure for when the value is changed
    58 	OnChange *proc;         ///< callback procedure for when the value is changed
    59 } SettingDescBase;
    59 };
    60 
    60 
    61 typedef struct SettingDesc {
    61 struct SettingDesc {
    62 	SettingDescBase desc;   ///< Settings structure (going to configuration file)
    62 	SettingDescBase desc;   ///< Settings structure (going to configuration file)
    63 	SaveLoad save;          ///< Internal structure (going to savegame, parts to config)
    63 	SaveLoad save;          ///< Internal structure (going to savegame, parts to config)
    64 } SettingDesc;
    64 };
    65 
    65 
    66 /* NOTE: The only difference between SettingDesc and SettingDescGlob is
    66 /* NOTE: The only difference between SettingDesc and SettingDescGlob is
    67  * that one uses global variables as a source and the other offsets
    67  * that one uses global variables as a source and the other offsets
    68  * in a struct which are bound to a certain variable during runtime.
    68  * in a struct which are bound to a certain variable during runtime.
    69  * The only way to differentiate between these two is to check if an object
    69  * The only way to differentiate between these two is to check if an object
    70  * has been passed to the function or not. If not, then it is a global variable
    70  * has been passed to the function or not. If not, then it is a global variable
    71  * and save->variable has its address, otherwise save->variable only holds the
    71  * and save->variable has its address, otherwise save->variable only holds the
    72  * offset in a certain struct */
    72  * offset in a certain struct */
    73 typedef SettingDesc SettingDescGlobVarList;
    73 typedef SettingDesc SettingDescGlobVarList;
    74 
    74 
    75 typedef enum {
    75 enum IniGroupType {
    76 	IGT_VARIABLES = 0, ///< values of the form "landscape = hilly"
    76 	IGT_VARIABLES = 0, ///< values of the form "landscape = hilly"
    77 	IGT_LIST      = 1, ///< a list of values, seperated by \n and terminated by the next group block
    77 	IGT_LIST      = 1, ///< a list of values, seperated by \n and terminated by the next group block
    78 } IniGroupType;
    78 };
    79 
    79 
    80 /** The patch values that are used for new games and/or modified in config file */
    80 /** The patch values that are used for new games and/or modified in config file */
    81 extern Patches _patches_newgame;
    81 extern Patches _patches_newgame;
    82 
    82 
    83 bool IConsoleSetPatchSetting(const char *name, int32 value);
    83 bool IConsoleSetPatchSetting(const char *name, int32 value);