summaryrefslogtreecommitdiff
path: root/src/table
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-07-11 21:57:05 +0200
committerGitHub <noreply@github.com>2021-07-11 21:57:05 +0200
commitb6a116a2479eb62aece540633c41d0f54a481fd6 (patch)
tree977ffda77d342bf5adc9105f25eed7e13e5d993f /src/table
parent8bb9c3f6466c6d15a1a02e963b06b95f9ffb6397 (diff)
downloadopenttd-b6a116a2479eb62aece540633c41d0f54a481fd6.tar.xz
Add: allow setting your server visibility to "invite-only" (#9434)
In this mode you do register to the Game Coordinator, but your server will not show up in the public server listing. You can give your friends the invite code of the server with which they can join.
Diffstat (limited to 'src/table')
-rw-r--r--src/table/settings/network_settings.ini16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/table/settings/network_settings.ini b/src/table/settings/network_settings.ini
index 45459b6e1..552f58823 100644
--- a/src/table/settings/network_settings.ini
+++ b/src/table/settings/network_settings.ini
@@ -9,14 +9,18 @@
[pre-amble]
static void UpdateClientConfigValues();
+static std::initializer_list<const char*> _server_game_type{"local", "public", "invite-only"};
+
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]
@@ -159,10 +163,16 @@ flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = true
cat = SC_EXPERT
-[SDTC_BOOL]
-var = network.server_advertise
+[SDTC_OMANY]
+var = network.server_game_type
+type = SLE_UINT8
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
-def = false
+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