Files
@ r24755:9b2ef076754d
Branch filter:
Location: cpp/openttd-patchpack/source/src/table/misc_settings.ini
r24755:9b2ef076754d
7.6 KiB
text/x-ini
Codechange: Don't use cpp_offsetof in the save/load code.
Many of the member variables that are used in save/load are inside types
that are not standard layout types. Using pointer arithmetics to determine
addresses of members inside types that are not standard layout is generally
undefined behaviour. If we'd use C++17, it is conditionally supported, which means
each compiler may or may not support it. And even then using it for individual
array elements is syntactically not supported the the standard offsetof function.
Unfortunately, the trickery employed for saving linkgraph settings causes quite some
clutter in the settings ini files.
Many of the member variables that are used in save/load are inside types
that are not standard layout types. Using pointer arithmetics to determine
addresses of members inside types that are not standard layout is generally
undefined behaviour. If we'd use C++17, it is conditionally supported, which means
each compiler may or may not support it. And even then using it for individual
array elements is syntactically not supported the the standard offsetof function.
Unfortunately, the trickery employed for saving linkgraph settings causes quite some
clutter in the settings ini files.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | ; This file is part of OpenTTD.
; OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
; OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
; See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
;
[pre-amble]
extern std::string _config_language_file;
static const char *_support8bppmodes = "no|system|hardware";
static const SettingDescGlobVarList _misc_settings[] = {
[post-amble]
};
[templates]
SDTG_LIST = SDTG_LIST($name, $type, $length, $flags, $guiflags, $var, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra),
SDTG_MMANY = SDTG_MMANY($name, $type, $flags, $guiflags, $var, $def, $full, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra),
SDTG_OMANY = SDTG_OMANY($name, $type, $flags, $guiflags, $var, $def, $max, $full, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra),
SDTG_STR = SDTG_STR($name, $type, $flags, $guiflags, $var, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra),
SDTG_SSTR = SDTG_SSTR($name, $type, $flags, $guiflags, $var, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra),
SDTG_BOOL = SDTG_BOOL($name, $flags, $guiflags, $var, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra),
SDTG_VAR = SDTG_VAR($name, $type, $flags, $guiflags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra),
SDTG_END = SDTG_END()
[defaults]
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
guiflags = SGF_NONE
interval = 0
str = STR_NULL
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
strval = STR_NULL
proc = nullptr
load = nullptr
from = SL_MIN_VERSION
to = SL_MAX_VERSION
cat = SC_ADVANCED
extra = 0
[SDTG_MMANY]
name = ""display_opt""
type = SLE_UINT8
var = _display_opt
def = (1 << DO_SHOW_TOWN_NAMES | 1 << DO_SHOW_STATION_NAMES | 1 << DO_SHOW_SIGNS | 1 << DO_FULL_ANIMATION | 1 << DO_FULL_DETAIL | 1 << DO_SHOW_WAYPOINT_NAMES | 1 << DO_SHOW_COMPETITOR_SIGNS)
full = ""SHOW_TOWN_NAMES|SHOW_STATION_NAMES|SHOW_SIGNS|FULL_ANIMATION||FULL_DETAIL|WAYPOINTS|SHOW_COMPETITOR_SIGNS""
[SDTG_BOOL]
name = ""fullscreen""
var = _fullscreen
def = false
cat = SC_BASIC
[SDTG_OMANY]
name = ""support8bpp""
type = SLE_UINT8
var = _support8bpp
def = 0
max = 2
full = _support8bppmodes
cat = SC_BASIC
[SDTG_SSTR]
name = ""graphicsset""
type = SLE_STRQ
var = BaseGraphics::ini_set
def = nullptr
cat = SC_BASIC
[SDTG_SSTR]
name = ""soundsset""
type = SLE_STRQ
var = BaseSounds::ini_set
def = nullptr
cat = SC_BASIC
[SDTG_SSTR]
name = ""musicset""
type = SLE_STRQ
var = BaseMusic::ini_set
def = nullptr
cat = SC_BASIC
[SDTG_SSTR]
name = ""videodriver""
type = SLE_STRQ
var = _ini_videodriver
def = nullptr
cat = SC_EXPERT
[SDTG_SSTR]
name = ""musicdriver""
type = SLE_STRQ
var = _ini_musicdriver
def = nullptr
cat = SC_EXPERT
[SDTG_SSTR]
name = ""sounddriver""
type = SLE_STRQ
var = _ini_sounddriver
def = nullptr
cat = SC_EXPERT
[SDTG_SSTR]
name = ""blitter""
type = SLE_STRQ
var = _ini_blitter
def = nullptr
[SDTG_SSTR]
name = ""language""
type = SLE_STR
var = _config_language_file
def = nullptr
cat = SC_BASIC
; workaround for implicit lengthof() in SDTG_LIST
[SDTG_LIST]
name = ""resolution""
type = SLE_INT
length = 2
var = _cur_resolution
def = ""0,0""
cat = SC_BASIC
[SDTG_STR]
name = ""screenshot_format""
type = SLE_STRB
var = _screenshot_format_name
def = nullptr
cat = SC_EXPERT
[SDTG_STR]
name = ""savegame_format""
type = SLE_STRB
var = _savegame_format
def = nullptr
cat = SC_EXPERT
[SDTG_BOOL]
name = ""rightclick_emulate""
var = _rightclick_emulate
def = false
[SDTG_STR]
ifdef = HAS_TRUETYPE_FONT
name = ""small_font""
type = SLE_STRB
var = _freetype.small.font
def = nullptr
[SDTG_STR]
ifdef = HAS_TRUETYPE_FONT
name = ""medium_font""
type = SLE_STRB
var = _freetype.medium.font
def = nullptr
[SDTG_STR]
ifdef = HAS_TRUETYPE_FONT
name = ""large_font""
type = SLE_STRB
var = _freetype.large.font
def = nullptr
[SDTG_STR]
ifdef = HAS_TRUETYPE_FONT
name = ""mono_font""
type = SLE_STRB
var = _freetype.mono.font
def = nullptr
[SDTG_VAR]
ifdef = HAS_TRUETYPE_FONT
name = ""small_size""
type = SLE_UINT
var = _freetype.small.size
def = 0
min = 0
max = 72
[SDTG_VAR]
ifdef = HAS_TRUETYPE_FONT
name = ""medium_size""
type = SLE_UINT
var = _freetype.medium.size
def = 0
min = 0
max = 72
[SDTG_VAR]
ifdef = HAS_TRUETYPE_FONT
name = ""large_size""
type = SLE_UINT
var = _freetype.large.size
def = 0
min = 0
max = 72
[SDTG_VAR]
ifdef = HAS_TRUETYPE_FONT
name = ""mono_size""
type = SLE_UINT
var = _freetype.mono.size
def = 0
min = 0
max = 72
[SDTG_BOOL]
ifdef = HAS_TRUETYPE_FONT
name = ""small_aa""
var = _freetype.small.aa
def = false
[SDTG_BOOL]
ifdef = HAS_TRUETYPE_FONT
name = ""medium_aa""
var = _freetype.medium.aa
def = false
[SDTG_BOOL]
ifdef = HAS_TRUETYPE_FONT
name = ""large_aa""
var = _freetype.large.aa
def = false
[SDTG_BOOL]
ifdef = HAS_TRUETYPE_FONT
name = ""mono_aa""
var = _freetype.mono.aa
def = false
[SDTG_VAR]
name = ""sprite_cache_size_px""
type = SLE_UINT
var = _sprite_cache_size
def = 128
min = 1
max = 512
cat = SC_EXPERT
[SDTG_VAR]
name = ""player_face""
type = SLE_UINT32
var = _company_manager_face
def = 0
min = 0
max = 0xFFFFFFFF
cat = SC_BASIC
[SDTG_VAR]
name = ""transparency_options""
type = SLE_UINT
var = _transparency_opt
def = 0
min = 0
max = 0x1FF
cat = SC_BASIC
[SDTG_VAR]
name = ""transparency_locks""
type = SLE_UINT
var = _transparency_lock
def = 0
min = 0
max = 0x1FF
cat = SC_BASIC
[SDTG_VAR]
name = ""invisibility_options""
type = SLE_UINT
var = _invisibility_opt
def = 0
min = 0
max = 0xFF
cat = SC_BASIC
[SDTG_STR]
name = ""keyboard""
type = SLE_STRB
var = _keyboard_opt[0]
def = nullptr
cat = SC_EXPERT
[SDTG_STR]
name = ""keyboard_caps""
type = SLE_STRB
var = _keyboard_opt[1]
def = nullptr
cat = SC_EXPERT
[SDTG_VAR]
name = ""last_newgrf_count""
type = SLE_UINT32
var = _settings_client.gui.last_newgrf_count
def = 100
min = 0
max = UINT32_MAX
cat = SC_EXPERT
[SDTG_VAR]
name = ""gui_zoom""
type = SLE_UINT8
var = _gui_zoom
def = ZOOM_LVL_OUT_4X
min = ZOOM_LVL_MIN
max = ZOOM_LVL_OUT_4X
cat = SC_BASIC
[SDTG_VAR]
name = ""font_zoom""
type = SLE_UINT8
var = _font_zoom
def = ZOOM_LVL_OUT_4X
min = ZOOM_LVL_MIN
max = ZOOM_LVL_OUT_4X
cat = SC_BASIC
[SDTG_END]
|