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

Method SendNewGRFCheck

src/network/network_server.cpp:404–430  ·  view source on GitHub ↗

Send the check for the NewGRFs. */

Source from the content-addressed store, hash-verified

402
403/** Send the check for the NewGRFs. */
404NetworkRecvStatus 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. */
433NetworkRecvStatus ServerNetworkGameSocketHandler::SendAuthRequest()

Callers 1

Calls 7

CloseConnectionMethod · 0.95
SendWelcomeMethod · 0.95
SerializeGRFIdentifierFunction · 0.85
TestMethod · 0.80
emptyMethod · 0.45
Send_uint8Method · 0.45
SendPacketMethod · 0.45

Tested by

no test coverage detected