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

Method SendClientInfo

src/network/network_admin.cpp:236–253  ·  view source on GitHub ↗

* Send an initial set of data from some client's information. * @param cs The socket of the client. * @param ci The information about the client. */

Source from the content-addressed store, hash-verified

234 * @param ci The information about the client.
235 */
236NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientInfo(const NetworkClientSocket *cs, const NetworkClientInfo *ci)
237{
238 /* Only send data when we're a proper client, not just someone trying to query the server. */
239 if (ci == nullptr) return NETWORK_RECV_STATUS_OKAY;
240
241 auto p = std::make_unique<Packet>(this, ADMIN_PACKET_SERVER_CLIENT_INFO);
242
243 p->Send_uint32(ci->client_id);
244 p->Send_string(cs == nullptr ? "" : const_cast<NetworkAddress &>(cs->client_address).GetHostname());
245 p->Send_string(ci->client_name);
246 p->Send_uint8 (0); // Used to be language
247 p->Send_uint32(ci->join_date.base());
248 p->Send_uint8 (ci->client_playas);
249
250 this->SendPacket(std::move(p));
251
252 return NETWORK_RECV_STATUS_OKAY;
253}
254
255
256/**

Callers 2

Receive_ADMIN_POLLMethod · 0.95
NetworkAdminClientInfoFunction · 0.45

Calls 5

Send_uint32Method · 0.80
Send_stringMethod · 0.80
Send_uint8Method · 0.45
baseMethod · 0.45
SendPacketMethod · 0.45

Tested by

no test coverage detected