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.
This commit is contained in:
Patric Stout
2021-07-11 21:57:05 +02:00
committed by GitHub
parent 8bb9c3f646
commit b6a116a247
10 changed files with 86 additions and 31 deletions

View File

@@ -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