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

Method GetClientName

src/network/network_server.cpp:2104–2110  ·  view source on GitHub ↗

* Get the name of the client, if the user did not send it yet, Client ID is used. * @param client_name The variable to write the name to. * @param last The pointer to the last element of the destination buffer */

Source from the content-addressed store, hash-verified

2102 * @param last The pointer to the last element of the destination buffer
2103 */
2104std::string ServerNetworkGameSocketHandler::GetClientName() const
2105{
2106 const NetworkClientInfo *ci = this->GetInfo();
2107 if (ci != nullptr && !ci->client_name.empty()) return ci->client_name;
2108
2109 return fmt::format("Client #{}", this->client_id);
2110}
2111
2112/**
2113 * Print all the clients to the console

Callers 5

CloseConnectionMethod · 0.95
SendErrorMethod · 0.95
Receive_CLIENT_MAP_OKMethod · 0.95
Receive_CLIENT_ERRORMethod · 0.95
Receive_CLIENT_QUITMethod · 0.95

Calls 3

formatFunction · 0.50
GetInfoMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected