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:
@@ -934,7 +934,7 @@ bool NetworkServerStart()
|
||||
|
||||
NetworkInitGameInfo();
|
||||
|
||||
if (_settings_client.network.server_advertise) {
|
||||
if (_settings_client.network.server_game_type != SERVER_GAME_TYPE_LOCAL) {
|
||||
_network_coordinator_client.Register();
|
||||
}
|
||||
|
||||
@@ -999,6 +999,29 @@ void NetworkDisconnect(bool blocking, bool close_admins)
|
||||
NetworkUDPInitialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* The setting server_game_type was updated; possibly we need to take some
|
||||
* action.
|
||||
*/
|
||||
void NetworkUpdateServerGameType()
|
||||
{
|
||||
if (!_networking) return;
|
||||
|
||||
switch (_settings_client.network.server_game_type) {
|
||||
case SERVER_GAME_TYPE_LOCAL:
|
||||
_network_coordinator_client.CloseConnection();
|
||||
break;
|
||||
|
||||
case SERVER_GAME_TYPE_INVITE_ONLY:
|
||||
case SERVER_GAME_TYPE_PUBLIC:
|
||||
_network_coordinator_client.Register();
|
||||
break;
|
||||
|
||||
default:
|
||||
NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Receives something from the network.
|
||||
* @return true if everything went fine, false when the connection got closed.
|
||||
|
Reference in New Issue
Block a user