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

Method SendWait

src/network/network_server.cpp:502–518  ·  view source on GitHub ↗

Tell the client that its put in a waiting queue. */

Source from the content-addressed store, hash-verified

500
501/** Tell the client that its put in a waiting queue. */
502NetworkRecvStatus ServerNetworkGameSocketHandler::SendWait()
503{
504 Debug(net, 9, "client[{}] SendWait()", this->client_id);
505
506 int waiting = 1; // current player getting the map counts as 1
507
508 /* Count how many clients are waiting in the queue, in front of you! */
509 for (NetworkClientSocket *new_cs : NetworkClientSocket::Iterate()) {
510 if (new_cs->status != STATUS_MAP_WAIT) continue;
511 if (new_cs->GetInfo()->join_date < this->GetInfo()->join_date || (new_cs->GetInfo()->join_date == this->GetInfo()->join_date && new_cs->client_id < this->client_id)) waiting++;
512 }
513
514 auto p = std::make_unique<Packet>(this, PACKET_SERVER_WAIT);
515 p->Send_uint8(waiting);
516 this->SendPacket(std::move(p));
517 return NETWORK_RECV_STATUS_OKAY;
518}
519
520void ServerNetworkGameSocketHandler::CheckNextClientToSendMap(NetworkClientSocket *ignore_cs)
521{

Callers 3

Receive_CLIENT_GETMAPMethod · 0.95
NetworkServer_TickFunction · 0.80

Calls 3

GetInfoMethod · 0.45
Send_uint8Method · 0.45
SendPacketMethod · 0.45

Tested by

no test coverage detected