Tell the client that its put in a waiting queue. */
| 500 | |
| 501 | /** Tell the client that its put in a waiting queue. */ |
| 502 | NetworkRecvStatus 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 | |
| 520 | void ServerNetworkGameSocketHandler::CheckNextClientToSendMap(NetworkClientSocket *ignore_cs) |
| 521 | { |
no test coverage detected