Files
@ r26911:c2c571bbaef9
Branch filter:
Location: cpp/openttd-patchpack/source/src/table/settings/network_settings.ini
r26911:c2c571bbaef9
7.4 KiB
text/x-ini
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 | ; 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/>.
;
; Network settings as stored in the main configuration file ("openttd.cfg").
[pre-amble]
static void UpdateClientConfigValues();
static constexpr std::initializer_list<const char*> _server_game_type{"local", "public", "invite-only"};
static constexpr std::initializer_list<const char*> _use_relay_service{"never", "ask", "allow"};
static const SettingVariant _network_settings_table[] = {
[post-amble]
};
[templates]
SDTC_BOOL = SDTC_BOOL( $var, $flags, $def, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTC_OMANY = SDTC_OMANY( $var, $type, $flags, $def, $max, $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
SDTC_VAR = SDTC_VAR( $var, $type, $flags, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
[validation]
SDTC_OMANY = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
SDTC_VAR = static_assert($max <= MAX_$type, "Maximum value for $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
[SDTC_VAR]
var = network.sync_freq
type = SLE_UINT16
flags = SF_NOT_IN_SAVE | SF_NOT_IN_CONFIG | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = 100
min = 0
max = 100
cat = SC_EXPERT
[SDTC_VAR]
var = network.frame_freq
type = SLE_UINT8
flags = SF_NOT_IN_SAVE | SF_NOT_IN_CONFIG | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = 0
min = 0
max = 100
cat = SC_EXPERT
[SDTC_VAR]
var = network.commands_per_frame
type = SLE_UINT16
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = 2
min = 1
max = 65535
cat = SC_EXPERT
[SDTC_VAR]
var = network.max_commands_in_queue
type = SLE_UINT16
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = 16
min = 1
max = 65535
cat = SC_EXPERT
[SDTC_VAR]
var = network.bytes_per_frame
type = SLE_UINT16
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = 8
min = 1
max = 65535
cat = SC_EXPERT
[SDTC_VAR]
var = network.bytes_per_frame_burst
type = SLE_UINT16
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = 256
min = 1
max = 65535
cat = SC_EXPERT
[SDTC_VAR]
var = network.max_init_time
type = SLE_UINT16
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = 100
min = 0
max = 32000
cat = SC_EXPERT
[SDTC_VAR]
var = network.max_join_time
type = SLE_UINT16
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = 500
min = 0
max = 32000
[SDTC_VAR]
var = network.max_download_time
type = SLE_UINT16
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = 1000
min = 0
max = 32000
[SDTC_VAR]
var = network.max_password_time
type = SLE_UINT16
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = 2000
min = 0
max = 32000
[SDTC_VAR]
var = network.max_lag_time
type = SLE_UINT16
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = 500
min = 0
max = 32000
[SDTC_BOOL]
var = network.pause_on_join
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = true
[SDTC_VAR]
var = network.server_port
type = SLE_UINT16
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = NETWORK_DEFAULT_PORT
min = 0
max = 65535
cat = SC_EXPERT
[SDTC_VAR]
var = network.server_admin_port
type = SLE_UINT16
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = NETWORK_ADMIN_PORT
min = 0
max = 65535
cat = SC_EXPERT
[SDTC_BOOL]
var = network.server_admin_chat
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = true
cat = SC_EXPERT
[SDTC_OMANY]
var = network.server_game_type
type = SLE_UINT8
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = SERVER_GAME_TYPE_LOCAL
min = SERVER_GAME_TYPE_LOCAL
max = SERVER_GAME_TYPE_INVITE_ONLY
full = _server_game_type
post_cb = [](auto) { NetworkUpdateServerGameType(); }
cat = SC_BASIC
[SDTC_BOOL]
var = network.autoclean_companies
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = false
[SDTC_VAR]
var = network.autoclean_unprotected
type = SLE_UINT8
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_GUI_0_IS_SPECIAL | SF_NETWORK_ONLY
def = 12
min = 0
max = 240
[SDTC_VAR]
var = network.autoclean_protected
type = SLE_UINT8
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_GUI_0_IS_SPECIAL | SF_NETWORK_ONLY
def = 36
min = 0
max = 240
[SDTC_VAR]
var = network.autoclean_novehicles
type = SLE_UINT8
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_GUI_0_IS_SPECIAL | SF_NETWORK_ONLY
def = 0
min = 0
max = 240
[SDTC_VAR]
var = network.max_companies
type = SLE_UINT8
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = 15
min = 1
max = MAX_COMPANIES
post_cb = [](auto) { UpdateClientConfigValues(); }
cat = SC_BASIC
[SDTC_VAR]
var = network.max_clients
type = SLE_UINT8
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = 25
min = 2
max = MAX_CLIENTS
post_cb = [](auto) { UpdateClientConfigValues(); }
cat = SC_BASIC
[SDTC_VAR]
var = network.restart_game_year
type = SLE_INT32
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_GUI_0_IS_SPECIAL | SF_NETWORK_ONLY
def = 0
min = MIN_YEAR
max = MAX_YEAR
interval = 1
[SDTC_VAR]
var = network.min_active_clients
type = SLE_UINT8
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = 0
min = 0
max = MAX_CLIENTS
[SDTC_BOOL]
var = network.reload_cfg
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = false
cat = SC_EXPERT
[SDTC_BOOL]
var = network.no_http_content_downloads
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
def = false
cat = SC_EXPERT
[SDTC_OMANY]
var = network.use_relay_service
type = SLE_UINT8
flags = SF_GUI_DROPDOWN | SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
def = URS_ASK
min = URS_NO
max = URS_ALLOW
full = _use_relay_service
str = STR_CONFIG_SETTING_USE_RELAY_SERVICE
strhelp = STR_CONFIG_SETTING_USE_RELAY_SERVICE_HELPTEXT
strval = STR_CONFIG_SETTING_USE_RELAY_SERVICE_NEVER
cat = SC_BASIC
|