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
|
; 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/>.
;
; Difficulty settings as stored in the main configuration file ("openttd.cfg")
; and in the savegame PATS chunk.
[pre-amble]
const std::array<std::string, GAME_DIFFICULTY_NUM> _old_diff_settings{"max_no_competitors", "competitor_start_time", "number_towns", "industry_density", "max_loan", "initial_interest", "vehicle_costs", "competitor_speed", "competitor_intelligence", "vehicle_breakdowns", "subsidy_multiplier", "construction_cost", "terrain_type", "quantity_sea_lakes", "economy", "line_reverse_mode", "disasters", "town_council_tolerance"};
uint16 _old_diff_custom[GAME_DIFFICULTY_NUM];
uint8 _old_diff_level; ///< Old difficulty level from old savegames
static void DifficultyNoiseChange(int32 new_value);
static void MaxNoAIsChange(int32 new_value);
static const SettingVariant _difficulty_settings_table[] = {
[post-amble]
};
[templates]
SDTG_VAR = SDTG_VAR($name, $type, $flags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDT_BOOL = SDT_BOOL(GameSettings, $var, $flags, $def, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $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]
SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $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
; Saved settings variables.
; The next 18 entries are important for savegame compatibility. Do NOT remove those. See HandleOldDiffCustom() for more details.
[SDT_VAR]
var = difficulty.max_no_competitors
type = SLE_UINT8
from = SLV_97
def = 0
min = 0
max = MAX_COMPANIES - 1
interval = 1
post_cb = MaxNoAIsChange
cat = SC_BASIC
[SDT_VAR]
var = difficulty.competitor_start_time
type = SLE_UINT8
from = SLV_97
to = SLV_110
def = 2
min = 0
max = 3
[SDT_VAR]
var = difficulty.number_towns
type = SLE_UINT8
from = SLV_97
flags = SF_NEWGAME_ONLY
def = 2
min = 0
max = 4
interval = 1
strval = STR_NUM_VERY_LOW
cat = SC_BASIC
[SDT_VAR]
var = difficulty.industry_density
type = SLE_UINT8
from = SLV_97
flags = SF_GUI_DROPDOWN
def = ID_END - 1
min = 0
max = ID_END - 1
interval = 1
str = STR_CONFIG_SETTING_INDUSTRY_DENSITY
strhelp = STR_CONFIG_SETTING_INDUSTRY_DENSITY_HELPTEXT
strval = STR_FUNDING_ONLY
cat = SC_BASIC
[SDT_VAR]
var = difficulty.max_loan
type = SLE_UINT32
from = SLV_97
flags = SF_NEWGAME_ONLY | SF_SCENEDIT_TOO | SF_GUI_CURRENCY
def = 300000
min = 0
max = 2000000000
interval = 50000
str = STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN
strhelp = STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN_HELPTEXT
strval = STR_JUST_CURRENCY_LONG
cat = SC_BASIC
[SDT_VAR]
var = difficulty.initial_interest
type = SLE_UINT8
from = SLV_97
flags = SF_NEWGAME_ONLY | SF_SCENEDIT_TOO
def = 2
min = 2
max = 4
interval = 1
str = STR_CONFIG_SETTING_INTEREST_RATE
strhelp = STR_CONFIG_SETTING_INTEREST_RATE_HELPTEXT
strval = STR_CONFIG_SETTING_PERCENTAGE
[SDT_VAR]
var = difficulty.vehicle_costs
type = SLE_UINT8
from = SLV_97
flags = SF_NEWGAME_ONLY | SF_SCENEDIT_TOO | SF_GUI_DROPDOWN
def = 0
min = 0
max = 2
interval = 1
str = STR_CONFIG_SETTING_RUNNING_COSTS
strhelp = STR_CONFIG_SETTING_RUNNING_COSTS_HELPTEXT
strval = STR_SEA_LEVEL_LOW
cat = SC_BASIC
[SDT_VAR]
var = difficulty.competitor_speed
type = SLE_UINT8
from = SLV_97
flags = SF_GUI_DROPDOWN
def = 2
min = 0
max = 4
interval = 1
str = STR_CONFIG_SETTING_CONSTRUCTION_SPEED
strhelp = STR_CONFIG_SETTING_CONSTRUCTION_SPEED_HELPTEXT
strval = STR_AI_SPEED_VERY_SLOW
cat = SC_BASIC
[SDT_VAR]
var = difficulty.competitor_intelligence
type = SLE_UINT8
from = SLV_97
to = SLV_110
def = 0
min = 0
max = 2
[SDT_VAR]
var = difficulty.vehicle_breakdowns
type = SLE_UINT8
from = SLV_97
flags = SF_GUI_DROPDOWN
def = 1
min = 0
max = 2
interval = 1
str = STR_CONFIG_SETTING_VEHICLE_BREAKDOWNS
strhelp = STR_CONFIG_SETTING_VEHICLE_BREAKDOWNS_HELPTEXT
strval = STR_DISASTER_NONE
cat = SC_BASIC
[SDT_VAR]
var = difficulty.subsidy_multiplier
type = SLE_UINT8
from = SLV_97
flags = SF_GUI_DROPDOWN
def = 2
min = 0
max = 3
interval = 1
str = STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER
strhelp = STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER_HELPTEXT
strval = STR_SUBSIDY_X1_5
[SDT_VAR]
var = difficulty.subsidy_duration
type = SLE_UINT16
from = SLV_CUSTOM_SUBSIDY_DURATION
flags = SF_GUI_0_IS_SPECIAL
def = 1
min = 0
max = 5000
interval = 1
str = STR_CONFIG_SETTING_SUBSIDY_DURATION
strhelp = STR_CONFIG_SETTING_SUBSIDY_DURATION_HELPTEXT
strval = STR_CONFIG_SETTING_SUBSIDY_DURATION_VALUE
[SDT_VAR]
var = difficulty.construction_cost
type = SLE_UINT8
from = SLV_97
flags = SF_NEWGAME_ONLY | SF_SCENEDIT_TOO | SF_GUI_DROPDOWN
def = 0
min = 0
max = 2
interval = 1
str = STR_CONFIG_SETTING_CONSTRUCTION_COSTS
strhelp = STR_CONFIG_SETTING_CONSTRUCTION_COSTS_HELPTEXT
strval = STR_SEA_LEVEL_LOW
cat = SC_BASIC
[SDT_VAR]
var = difficulty.terrain_type
type = SLE_UINT8
from = SLV_97
flags = SF_GUI_DROPDOWN | SF_NEWGAME_ONLY
def = 1
min = 0
max = 5
interval = 1
str = STR_CONFIG_SETTING_TERRAIN_TYPE
strhelp = STR_CONFIG_SETTING_TERRAIN_TYPE_HELPTEXT
strval = STR_TERRAIN_TYPE_VERY_FLAT
cat = SC_BASIC
[SDT_VAR]
var = difficulty.quantity_sea_lakes
type = SLE_UINT8
from = SLV_97
flags = SF_NEWGAME_ONLY
def = 0
min = 0
max = 4
interval = 1
strval = STR_SEA_LEVEL_VERY_LOW
cat = SC_BASIC
[SDT_BOOL]
var = difficulty.economy
from = SLV_97
def = false
str = STR_CONFIG_SETTING_RECESSIONS
strhelp = STR_CONFIG_SETTING_RECESSIONS_HELPTEXT
[SDT_BOOL]
var = difficulty.line_reverse_mode
from = SLV_97
def = false
str = STR_CONFIG_SETTING_TRAIN_REVERSING
strhelp = STR_CONFIG_SETTING_TRAIN_REVERSING_HELPTEXT
[SDT_BOOL]
var = difficulty.disasters
from = SLV_97
def = false
str = STR_CONFIG_SETTING_DISASTERS
strhelp = STR_CONFIG_SETTING_DISASTERS_HELPTEXT
cat = SC_BASIC
[SDT_VAR]
var = difficulty.town_council_tolerance
type = SLE_UINT8
from = SLV_97
flags = SF_GUI_DROPDOWN
def = 0
min = 0
max = 2
interval = 1
str = STR_CONFIG_SETTING_CITY_APPROVAL
strhelp = STR_CONFIG_SETTING_CITY_APPROVAL_HELPTEXT
strval = STR_CITY_APPROVAL_PERMISSIVE
post_cb = DifficultyNoiseChange
[SDTG_VAR]
name = ""diff_level""
var = _old_diff_level
type = SLE_UINT8
flags = SF_NOT_IN_CONFIG
from = SLV_97
to = SLV_178
def = 3
min = 0
max = 3
cat = SC_BASIC
|