MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / CheckClientAndServerName

Function CheckClientAndServerName

src/network/network.cpp:874–889  ·  view source on GitHub ↗

* Check whether the client and server name are set, for a dedicated server and if not set them to some default * value and tell the user to change this as soon as possible. * If the saved name is the default value, then the user is told to override this value too. * This is only meant dedicated servers, as for the other servers the GUI ensures a name has been entered. */

Source from the content-addressed store, hash-verified

872 * This is only meant dedicated servers, as for the other servers the GUI ensures a name has been entered.
873 */
874static void CheckClientAndServerName()
875{
876 static const std::string fallback_client_name = "Unnamed Client";
877 StrTrimInPlace(_settings_client.network.client_name);
878 if (_settings_client.network.client_name.empty() || _settings_client.network.client_name == fallback_client_name) {
879 Debug(net, 1, "No \"client_name\" has been set, using \"{}\" instead. Please set this now using the \"name <new name>\" command", fallback_client_name);
880 _settings_client.network.client_name = fallback_client_name;
881 }
882
883 static const std::string fallback_server_name = "Unnamed Server";
884 StrTrimInPlace(_settings_client.network.server_name);
885 if (_settings_client.network.server_name.empty() || _settings_client.network.server_name == fallback_server_name) {
886 Debug(net, 1, "No \"server_name\" has been set, using \"{}\" instead. Please set this now using the \"server_name <new name>\" command", fallback_server_name);
887 _settings_client.network.server_name = fallback_server_name;
888 }
889}
890
891bool NetworkServerStart()
892{

Callers 1

NetworkServerStartFunction · 0.85

Calls 2

StrTrimInPlaceFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected