Send the check for the NewGRFs. */
| 402 | |
| 403 | /** Send the check for the NewGRFs. */ |
| 404 | NetworkRecvStatus ServerNetworkGameSocketHandler::SendNewGRFCheck() |
| 405 | { |
| 406 | Debug(net, 9, "client[{}] SendNewGRFCheck()", this->client_id); |
| 407 | |
| 408 | /* Invalid packet when status is anything but STATUS_IDENTIFY. */ |
| 409 | if (this->status != STATUS_IDENTIFY) return this->CloseConnection(NETWORK_RECV_STATUS_MALFORMED_PACKET); |
| 410 | |
| 411 | Debug(net, 9, "client[{}] status = NEWGRFS_CHECK", this->client_id); |
| 412 | this->status = STATUS_NEWGRFS_CHECK; |
| 413 | |
| 414 | if (_grfconfig.empty()) { |
| 415 | /* There are no NewGRFs, so they're welcome. */ |
| 416 | return this->SendWelcome(); |
| 417 | } |
| 418 | |
| 419 | auto p = std::make_unique<Packet>(this, PACKET_SERVER_CHECK_NEWGRFS, TCP_MTU); |
| 420 | |
| 421 | uint grf_count = std::ranges::count_if(_grfconfig, [](const auto &c){ return !c->flags.Test(GRFConfigFlag::Static); }); |
| 422 | p->Send_uint8 (grf_count); |
| 423 | |
| 424 | for (const auto &c : _grfconfig) { |
| 425 | if (!c->flags.Test(GRFConfigFlag::Static)) SerializeGRFIdentifier(*p, c->ident); |
| 426 | } |
| 427 | |
| 428 | this->SendPacket(std::move(p)); |
| 429 | return NETWORK_RECV_STATUS_OKAY; |
| 430 | } |
| 431 | |
| 432 | /** Request the game password. */ |
| 433 | NetworkRecvStatus ServerNetworkGameSocketHandler::SendAuthRequest() |
no test coverage detected