Files @ r26911:c2c571bbaef9
Branch filter:

Location: cpp/openttd-patchpack/source/src/table/settings/world_settings.ini

Rubidium
Codechange: split large function into smaller steps and simplify logic
  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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
; 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/>.
;

; World settings as stored in the main configuration file ("openttd.cfg")
; and in the savegame PATS chunk.
; World settings are everything related to how the world came to be, so
; basically construction and game_creation settings.

[pre-amble]
static bool CheckMaxHeightLevel(int32 &new_value);
static bool CheckFreeformEdges(int32 &new_value);
static void UpdateFreeformEdges(int32 new_value);

static const SettingVariant _world_settings_table[] = {
[post-amble]
};
[templates]
SDT_BOOL   =   SDT_BOOL(GameSettings, $var,        $flags, $def,                              $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to,        $cat, $extra, $startup),
SDT_OMANY  =  SDT_OMANY(GameSettings, $var, $type, $flags, $def,             $max, $full,     $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $load, $cat, $extra, $startup),
SDT_VAR    =    SDT_VAR(GameSettings, $var, $type, $flags, $def,       $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to,        $cat, $extra, $startup),

[validation]
SDT_OMANY = static_assert($max <= MAX_$type, "Maximum value for GameSettings.$var exceeds storage size");
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for GameSettings.$var exceeds storage size");

[defaults]
flags    = SF_NONE
interval = 0
str      = STR_NULL
strhelp  = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
strval   = STR_NULL
pre_cb   = nullptr
post_cb  = nullptr
load     = nullptr
from     = SL_MIN_VERSION
to       = SL_MAX_VERSION
cat      = SC_ADVANCED
extra    = 0
startup  = false


; There are only 21 predefined town_name values (0-20), but you can have more with newgrf action F so allow
; these bigger values (21-255). Invalid values will fallback to english on use and (undefined string) in GUI.
[SDT_OMANY]
var      = game_creation.town_name
type     = SLE_UINT8
from     = SLV_97
flags    = SF_NO_NETWORK
def      = 0
max      = 255
full     = _town_names
cat      = SC_BASIC

[SDT_OMANY]
var      = game_creation.landscape
type     = SLE_UINT8
from     = SLV_97
flags    = SF_GUI_DROPDOWN | SF_NEWGAME_ONLY
def      = 0
max      = 3
full     = _climates
load     = ConvertLandscape
str      = STR_CONFIG_SETTING_LANDSCAPE
strhelp  = STR_CONFIG_SETTING_LANDSCAPE_HELPTEXT
strval   = STR_CLIMATE_TEMPERATE_LANDSCAPE
cat      = SC_BASIC

[SDT_VAR]
var      = game_creation.heightmap_height
type     = SLE_UINT8
from     = SLV_MAPGEN_SETTINGS_REVAMP
flags    = SF_NEWGAME_ONLY
def      = MAP_HEIGHT_LIMIT_AUTO_MINIMUM
min      = MIN_HEIGHTMAP_HEIGHT
max      = MAX_MAP_HEIGHT_LIMIT
interval = 1

[SDT_VAR]
var      = game_creation.snow_line_height
type     = SLE_UINT8
flags    = SF_SCENEDIT_ONLY
def      = DEF_SNOWLINE_HEIGHT
min      = MIN_SNOWLINE_HEIGHT
max      = MAX_SNOWLINE_HEIGHT
interval = 1
str      = STR_CONFIG_SETTING_SNOWLINE_HEIGHT
strhelp  = STR_CONFIG_SETTING_SNOWLINE_HEIGHT_HELPTEXT
strval   = STR_JUST_COMMA
cat      = SC_BASIC

[SDT_VAR]
var      = game_creation.snow_coverage
type     = SLE_UINT8
from     = SLV_MAPGEN_SETTINGS_REVAMP
flags    = SF_NEWGAME_ONLY
def      = DEF_SNOW_COVERAGE
min      = 0
max      = 100
interval = 10
str      = STR_CONFIG_SETTING_SNOW_COVERAGE
strhelp  = STR_CONFIG_SETTING_SNOW_COVERAGE_HELPTEXT
strval   = STR_CONFIG_SETTING_SNOW_COVERAGE_VALUE
cat      = SC_BASIC

[SDT_VAR]
var      = game_creation.desert_coverage
type     = SLE_UINT8
from     = SLV_MAPGEN_SETTINGS_REVAMP
flags    = SF_NEWGAME_ONLY
def      = DEF_DESERT_COVERAGE
min      = 0
max      = 100
interval = 10
str      = STR_CONFIG_SETTING_DESERT_COVERAGE
strhelp  = STR_CONFIG_SETTING_DESERT_COVERAGE_HELPTEXT
strval   = STR_CONFIG_SETTING_DESERT_COVERAGE_VALUE
cat      = SC_BASIC

[SDT_VAR]
var      = game_creation.starting_year
type     = SLE_INT32
def      = DEF_START_YEAR
min      = MIN_YEAR
max      = MAX_YEAR
interval = 1
str      = STR_CONFIG_SETTING_STARTING_YEAR
strval   = STR_JUST_INT
cat      = SC_BASIC

[SDT_VAR]
var      = game_creation.ending_year
type     = SLE_INT32
from     = SLV_ENDING_YEAR
flags    = SF_GUI_0_IS_SPECIAL
def      = DEF_END_YEAR
min      = MIN_YEAR
max      = MAX_YEAR - 1
interval = 1
str      = STR_CONFIG_SETTING_ENDING_YEAR
strhelp  = STR_CONFIG_SETTING_ENDING_YEAR_HELPTEXT
strval   = STR_CONFIG_SETTING_ENDING_YEAR_VALUE
cat      = SC_ADVANCED

[SDT_VAR]
var      = game_creation.land_generator
type     = SLE_UINT8
from     = SLV_30
flags    = SF_GUI_DROPDOWN | SF_NEWGAME_ONLY
def      = 1
min      = 0
max      = 1
str      = STR_CONFIG_SETTING_LAND_GENERATOR
strhelp  = STR_CONFIG_SETTING_LAND_GENERATOR_HELPTEXT
strval   = STR_CONFIG_SETTING_LAND_GENERATOR_ORIGINAL

[SDT_VAR]
var      = game_creation.oil_refinery_limit
type     = SLE_UINT8
from     = SLV_30
def      = 32
min      = 12
max      = 128
str      = STR_CONFIG_SETTING_OIL_REF_EDGE_DISTANCE
strval   = STR_CONFIG_SETTING_TILE_LENGTH
strhelp  = STR_CONFIG_SETTING_OIL_REF_EDGE_DISTANCE_HELPTEXT

[SDT_VAR]
var      = game_creation.tgen_smoothness
type     = SLE_UINT8
from     = SLV_30
flags    = SF_GUI_DROPDOWN | SF_NEWGAME_ONLY
def      = 1
min      = TGEN_SMOOTHNESS_BEGIN
max      = TGEN_SMOOTHNESS_END - 1
str      = STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN
strhelp  = STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_HELPTEXT
strval   = STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_SMOOTH
cat      = SC_BASIC

[SDT_VAR]
var      = game_creation.variety
type     = SLE_UINT8
from     = SLV_197
flags    = SF_GUI_DROPDOWN | SF_NEWGAME_ONLY
def      = 0
min      = 0
max      = 5
str      = STR_CONFIG_SETTING_VARIETY
strhelp  = STR_CONFIG_SETTING_VARIETY_HELPTEXT
strval   = STR_VARIETY_NONE

[SDT_VAR]
var      = game_creation.generation_seed
type     = SLE_UINT32
from     = SLV_30
def      = GENERATE_NEW_SEED
min      = 0
max      = UINT32_MAX
cat      = SC_EXPERT

[SDT_VAR]
var      = game_creation.tree_placer
type     = SLE_UINT8
from     = SLV_30
flags    = SF_GUI_DROPDOWN | SF_NEWGAME_ONLY | SF_SCENEDIT_TOO
def      = 2
min      = 0
max      = 2
str      = STR_CONFIG_SETTING_TREE_PLACER
strhelp  = STR_CONFIG_SETTING_TREE_PLACER_HELPTEXT
strval   = STR_CONFIG_SETTING_TREE_PLACER_NONE
cat      = SC_BASIC

[SDT_VAR]
var      = game_creation.heightmap_rotation
type     = SLE_UINT8
flags    = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_GUI_DROPDOWN
def      = 0
min      = 0
max      = 1
str      = STR_CONFIG_SETTING_HEIGHTMAP_ROTATION
strval   = STR_CONFIG_SETTING_HEIGHTMAP_ROTATION_COUNTER_CLOCKWISE
cat      = SC_BASIC

[SDT_VAR]
var      = game_creation.se_flat_world_height
type     = SLE_UINT8
flags    = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
def      = 1
min      = 0
max      = 15
str      = STR_CONFIG_SETTING_SE_FLAT_WORLD_HEIGHT
strval   = STR_JUST_COMMA
cat      = SC_BASIC

[SDT_VAR]
var      = game_creation.map_x
type     = SLE_UINT8
flags    = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
def      = 8
min      = MIN_MAP_SIZE_BITS
max      = MAX_MAP_SIZE_BITS
cat      = SC_BASIC

[SDT_VAR]
var      = game_creation.map_y
type     = SLE_UINT8
flags    = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
def      = 8
min      = MIN_MAP_SIZE_BITS
max      = MAX_MAP_SIZE_BITS
cat      = SC_BASIC

[SDT_VAR]
var      = game_creation.water_borders
type     = SLE_UINT8
from     = SLV_111
def      = 15
min      = 0
max      = 16

[SDT_VAR]
var      = game_creation.custom_town_number
type     = SLE_UINT16
from     = SLV_115
def      = 1
min      = 1
max      = 5000
cat      = SC_BASIC

[SDT_VAR]
var      = game_creation.custom_industry_number
type     = SLE_UINT16
def      = 1
min      = 1
max      = 64000

[SDT_VAR]
var      = game_creation.custom_terrain_type
type     = SLE_UINT8
from     = SLV_MAPGEN_SETTINGS_REVAMP
flags    = SF_NEWGAME_ONLY
def      = MAP_HEIGHT_LIMIT_AUTO_MINIMUM
min      = MIN_CUSTOM_TERRAIN_TYPE
max      = MAX_MAP_HEIGHT_LIMIT
interval = 1

[SDT_VAR]
var      = game_creation.custom_sea_level
type     = SLE_UINT8
from     = SLV_149
def      = CUSTOM_SEA_LEVEL_MIN_PERCENTAGE
min      = CUSTOM_SEA_LEVEL_MIN_PERCENTAGE
max      = CUSTOM_SEA_LEVEL_MAX_PERCENTAGE
cat      = SC_BASIC

[SDT_VAR]
var      = game_creation.min_river_length
type     = SLE_UINT8
from     = SLV_163
def      = 16
min      = 2
max      = 255
cat      = SC_EXPERT

[SDT_VAR]
var      = game_creation.river_route_random
type     = SLE_UINT8
from     = SLV_163
def      = 5
min      = 1
max      = 255
cat      = SC_EXPERT

[SDT_VAR]
var      = game_creation.amount_of_rivers
type     = SLE_UINT8
from     = SLV_163
flags    = SF_GUI_DROPDOWN | SF_NEWGAME_ONLY
def      = 2
min      = 0
max      = 3
str      = STR_CONFIG_SETTING_RIVER_AMOUNT
strhelp  = STR_CONFIG_SETTING_RIVER_AMOUNT_HELPTEXT
strval   = STR_RIVERS_NONE

[SDT_VAR]
var      = construction.map_height_limit
type     = SLE_UINT8
from     = SLV_194
flags    = SF_NEWGAME_ONLY | SF_SCENEDIT_TOO | SF_GUI_0_IS_SPECIAL
def      = 0
min      = MIN_MAP_HEIGHT_LIMIT
max      = MAX_MAP_HEIGHT_LIMIT
interval = 1
str      = STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT
strhelp  = STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT_HELPTEXT
strval   = STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT_VALUE
pre_cb   = CheckMaxHeightLevel
post_cb  = [](auto) { InvalidateWindowClassesData(WC_SMALLMAP, 2); }
cat      = SC_ADVANCED

[SDT_BOOL]
var      = construction.build_on_slopes
flags    = SF_NO_NETWORK
def      = true
cat      = SC_EXPERT

[SDT_VAR]
var      = construction.command_pause_level
type     = SLE_UINT8
from     = SLV_154
flags    = SF_GUI_DROPDOWN | SF_NO_NETWORK
def      = 1
min      = 0
max      = 3
interval = 1
str      = STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL
strhelp  = STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL_HELPTEXT
strval   = STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL_NO_ACTIONS

[SDT_VAR]
var      = construction.terraform_per_64k_frames
type     = SLE_UINT32
from     = SLV_156
def      = 64 << 16
min      = 0
max      = 1 << 30
interval = 1
cat      = SC_EXPERT

[SDT_VAR]
var      = construction.terraform_frame_burst
type     = SLE_UINT16
from     = SLV_156
def      = 4096
min      = 0
max      = 1 << 15
interval = 1
cat      = SC_EXPERT

[SDT_VAR]
var      = construction.clear_per_64k_frames
type     = SLE_UINT32
from     = SLV_156
def      = 64 << 16
min      = 0
max      = 1 << 30
interval = 1
cat      = SC_EXPERT

[SDT_VAR]
var      = construction.clear_frame_burst
type     = SLE_UINT16
from     = SLV_156
def      = 4096
min      = 0
max      = 1 << 15
interval = 1
cat      = SC_EXPERT

[SDT_VAR]
var      = construction.tree_per_64k_frames
type     = SLE_UINT32
from     = SLV_175
def      = 64 << 16
min      = 0
max      = 1 << 30
interval = 1
cat      = SC_EXPERT

[SDT_VAR]
var      = construction.tree_frame_burst
type     = SLE_UINT16
from     = SLV_175
def      = 4096
min      = 0
max      = 1 << 15
interval = 1
cat      = SC_EXPERT

[SDT_VAR]
var      = construction.build_object_per_64k_frames
type     = SLE_UINT32
def      = 32 << 16
min      = 0
max      = 1 << 30
interval = 1
cat      = SC_EXPERT

[SDT_VAR]
var      = construction.build_object_frame_burst
type     = SLE_UINT16
def      = 2048
min      = 0
max      = 1 << 15
interval = 1
cat      = SC_EXPERT

[SDT_BOOL]
var      = construction.autoslope
from     = SLV_75
def      = true
str      = STR_CONFIG_SETTING_AUTOSLOPE
strhelp  = STR_CONFIG_SETTING_AUTOSLOPE_HELPTEXT
cat      = SC_EXPERT

[SDT_BOOL]
var      = construction.extra_dynamite
def      = true
str      = STR_CONFIG_SETTING_EXTRADYNAMITE
strhelp  = STR_CONFIG_SETTING_EXTRADYNAMITE_HELPTEXT

[SDT_VAR]
var      = construction.max_bridge_length
type     = SLE_UINT16
from     = SLV_159
flags    = SF_NO_NETWORK
def      = 64
min      = 1
max      = MAX_MAP_SIZE
interval = 1
str      = STR_CONFIG_SETTING_MAX_BRIDGE_LENGTH
strhelp  = STR_CONFIG_SETTING_MAX_BRIDGE_LENGTH_HELPTEXT
strval   = STR_CONFIG_SETTING_TILE_LENGTH

[SDT_VAR]
var      = construction.max_bridge_height
type     = SLE_UINT8
from     = SLV_194
flags    = SF_NO_NETWORK
def      = 12
min      = 1
max      = MAX_TILE_HEIGHT
interval = 1
str      = STR_CONFIG_SETTING_MAX_BRIDGE_HEIGHT
strhelp  = STR_CONFIG_SETTING_MAX_BRIDGE_HEIGHT_HELPTEXT
strval   = STR_JUST_COMMA
cat      = SC_EXPERT

[SDT_VAR]
var      = construction.max_tunnel_length
type     = SLE_UINT16
from     = SLV_159
flags    = SF_NO_NETWORK
def      = 64
min      = 1
max      = MAX_MAP_SIZE
interval = 1
str      = STR_CONFIG_SETTING_MAX_TUNNEL_LENGTH
strhelp  = STR_CONFIG_SETTING_MAX_TUNNEL_LENGTH_HELPTEXT
strval   = STR_CONFIG_SETTING_TILE_LENGTH

[SDT_VAR]
var      = construction.train_signal_side
type     = SLE_UINT8
flags    = SF_GUI_DROPDOWN | SF_NO_NETWORK
def      = 1
min      = 0
max      = 2
str      = STR_CONFIG_SETTING_SIGNALSIDE
strhelp  = STR_CONFIG_SETTING_SIGNALSIDE_HELPTEXT
strval   = STR_CONFIG_SETTING_SIGNALSIDE_LEFT
post_cb  = [](auto) { MarkWholeScreenDirty(); }
cat      = SC_BASIC

[SDT_BOOL]
var      = construction.road_stop_on_town_road
from     = SLV_47
def      = true
str      = STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD
strhelp  = STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD_HELPTEXT
cat      = SC_BASIC

[SDT_BOOL]
var      = construction.road_stop_on_competitor_road
from     = SLV_114
def      = true
str      = STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD
strhelp  = STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD_HELPTEXT
cat      = SC_BASIC

[SDT_VAR]
var      = construction.raw_industry_construction
type     = SLE_UINT8
flags    = SF_GUI_DROPDOWN
def      = 0
min      = 0
max      = 2
str      = STR_CONFIG_SETTING_RAW_INDUSTRY_CONSTRUCTION_METHOD
strhelp  = STR_CONFIG_SETTING_RAW_INDUSTRY_CONSTRUCTION_METHOD_HELPTEXT
strval   = STR_CONFIG_SETTING_RAW_INDUSTRY_CONSTRUCTION_METHOD_NONE
post_cb  = [](auto) { InvalidateWindowData(WC_BUILD_INDUSTRY, 0); }
cat      = SC_BASIC

[SDT_VAR]
var      = construction.industry_platform
type     = SLE_UINT8
from     = SLV_148
def      = 1
min      = 0
max      = 4
str      = STR_CONFIG_SETTING_INDUSTRY_PLATFORM
strhelp  = STR_CONFIG_SETTING_INDUSTRY_PLATFORM_HELPTEXT
strval   = STR_CONFIG_SETTING_TILE_LENGTH
cat      = SC_EXPERT

[SDT_BOOL]
var      = construction.freeform_edges
from     = SLV_111
def      = true
pre_cb   = CheckFreeformEdges
post_cb  = UpdateFreeformEdges
cat      = SC_EXPERT

[SDT_VAR]
var      = construction.extra_tree_placement
type     = SLE_UINT8
from     = SLV_132
flags    = SF_GUI_DROPDOWN
def      = 2
min      = 0
max      = 3
str      = STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT
strhelp  = STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_HELPTEXT
strval   = STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_NO_SPREAD
cat      = SC_BASIC