settings_internal.h
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 #include "settings_type.h"
00017 #include "strings_type.h"
00018
00025 enum SettingDescTypeLong {
00026
00027 SDT_BEGIN = 0,
00028 SDT_NUMX = 0,
00029 SDT_BOOLX = 1,
00030 SDT_ONEOFMANY = 2,
00031 SDT_MANYOFMANY = 3,
00032 SDT_INTLIST = 4,
00033 SDT_STRING = 5,
00034 SDT_END,
00035
00036 };
00037 typedef SimpleTinyEnumT<SettingDescTypeLong, byte> SettingDescType;
00038
00039
00040 enum SettingGuiFlagLong {
00041
00042
00043 SGF_NONE = 0,
00044 SGF_0ISDISABLED = 1 << 0,
00045 SGF_NOCOMMA = 1 << 1,
00046 SGF_MULTISTRING = 1 << 2,
00047 SGF_NETWORK_ONLY = 1 << 3,
00048 SGF_CURRENCY = 1 << 4,
00049 SGF_NO_NETWORK = 1 << 5,
00050 SGF_NEWGAME_ONLY = 1 << 6,
00051 SGF_SCENEDIT_TOO = 1 << 7,
00052 SGF_PER_COMPANY = 1 << 8,
00053 };
00054 DECLARE_ENUM_AS_BIT_SET(SettingGuiFlagLong)
00055 typedef SimpleTinyEnumT<SettingGuiFlagLong, uint16> SettingGuiFlag;
00056
00057
00058 typedef bool OnChange(int32 var);
00059 typedef int32 OnConvert(const char *value);
00060
00062 struct SettingDescBase {
00063 const char *name;
00064 const void *def;
00065 SettingDescType cmd;
00066 SettingGuiFlag flags;
00067 int32 min;
00068 uint32 max;
00069 int32 interval;
00070 const char *many;
00071 StringID str;
00072 StringID val_str;
00073 OnChange *proc;
00074 OnConvert *proc_cnvt;
00075 };
00076
00077 struct SettingDesc {
00078 SettingDescBase desc;
00079 SaveLoad save;
00080 };
00081
00082
00083
00084
00085
00086
00087
00088
00089 typedef SettingDesc SettingDescGlobVarList;
00090
00091 const SettingDesc *GetSettingFromName(const char *name, uint *i);
00092 bool SetSettingValue(uint index, int32 value, bool force_newgame = false);
00093 bool SetSettingValue(uint index, const char *value, bool force_newgame = false);
00094 void SetCompanySetting(uint index, int32 value);
00095
00096 extern VehicleDefaultSettings _old_vds;
00097
00098 #endif