Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef SETTINGS_INTERNAL_H
00013 #define SETTINGS_INTERNAL_H
00014
00015 #include "saveload/saveload.h"
00016
00023 enum SettingDescTypeLong {
00024
00025 SDT_BEGIN = 0,
00026 SDT_NUMX = 0,
00027 SDT_BOOLX = 1,
00028 SDT_ONEOFMANY = 2,
00029 SDT_MANYOFMANY = 3,
00030 SDT_INTLIST = 4,
00031 SDT_STRING = 5,
00032 SDT_END,
00033
00034 };
00035 typedef SimpleTinyEnumT<SettingDescTypeLong, byte> SettingDescType;
00036
00037
00038 enum SettingGuiFlagLong {
00039
00040
00041 SGF_NONE = 0,
00042 SGF_0ISDISABLED = 1 << 0,
00043 SGF_DISPLAY_ABS = 1 << 1,
00044 SGF_MULTISTRING = 1 << 2,
00045 SGF_NETWORK_ONLY = 1 << 3,
00046 SGF_CURRENCY = 1 << 4,
00047 SGF_NO_NETWORK = 1 << 5,
00048 SGF_NEWGAME_ONLY = 1 << 6,
00049 SGF_SCENEDIT_TOO = 1 << 7,
00050 SGF_PER_COMPANY = 1 << 8,
00051 };
00052 DECLARE_ENUM_AS_BIT_SET(SettingGuiFlagLong)
00053 typedef SimpleTinyEnumT<SettingGuiFlagLong, uint16> SettingGuiFlag;
00054
00055
00056 typedef bool OnChange(int32 var);
00057 typedef size_t OnConvert(const char *value);
00058
00060 struct SettingDescBase {
00061 const char *name;
00062 const void *def;
00063 SettingDescType cmd;
00064 SettingGuiFlag flags;
00065 int32 min;
00066 uint32 max;
00067 int32 interval;
00068 const char *many;
00069 StringID str;
00070 StringID str_help;
00071 StringID str_val;
00072 OnChange *proc;
00073 OnConvert *proc_cnvt;
00074 };
00075
00076 struct SettingDesc {
00077 SettingDescBase desc;
00078 SaveLoad save;
00079 };
00080
00081
00082
00083
00084
00085
00086
00087
00088 typedef SettingDesc SettingDescGlobVarList;
00089
00090 const SettingDesc *GetSettingFromName(const char *name, uint *i);
00091 bool SetSettingValue(uint index, int32 value, bool force_newgame = false);
00092 bool SetSettingValue(uint index, const char *value, bool force_newgame = false);
00093 void SetCompanySetting(uint index, int32 value);
00094
00095 #endif