Files @ r26911:c2c571bbaef9
Branch filter:

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

Rubidium
Codechange: split large function into smaller steps and simplify logic
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25975:101b063336cf
r25975:101b063336cf
r25817:3f5c3838fe0a
r25769:50d51bb3d751
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25817:3f5c3838fe0a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25817:3f5c3838fe0a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25817:3f5c3838fe0a
r25817:3f5c3838fe0a
r25817:3f5c3838fe0a
r25746:bc8cb364038a
r25817:3f5c3838fe0a
r25817:3f5c3838fe0a
r25817:3f5c3838fe0a
r25817:3f5c3838fe0a
r25817:3f5c3838fe0a
r25817:3f5c3838fe0a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25746:bc8cb364038a
r25849:38205b3e59c6
r25849:38205b3e59c6
r25849:38205b3e59c6
r25849:38205b3e59c6
r25849:38205b3e59c6
r25849:38205b3e59c6
r25849:38205b3e59c6
r25849:38205b3e59c6
r25849:38205b3e59c6
r25849:38205b3e59c6
r25849:38205b3e59c6
r25849:38205b3e59c6
r25849:38205b3e59c6
; 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