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

Method Receive_SERVER_CHECK_NEWGRFS

src/network/network_client.cpp:630–661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

628}
629
630NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_CHECK_NEWGRFS(Packet &p)
631{
632 if (this->status != STATUS_ENCRYPTED) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
633
634 uint grf_count = p.Recv_uint8();
635 NetworkRecvStatus ret = NETWORK_RECV_STATUS_OKAY;
636
637 Debug(net, 9, "Client::Receive_SERVER_CHECK_NEWGRFS(): grf_count={}", grf_count);
638
639 /* Check all GRFs */
640 for (; grf_count > 0; grf_count--) {
641 GRFIdentifier c;
642 DeserializeGRFIdentifier(p, c);
643
644 /* Check whether we know this GRF */
645 const GRFConfig *f = FindGRFConfig(c.grfid, FGCM_EXACT, &c.md5sum);
646 if (f == nullptr) {
647 /* We do not know this GRF, bail out of initialization */
648 Debug(grf, 0, "NewGRF {:08X} not found; checksum {}", std::byteswap(c.grfid), FormatArrayAsHex(c.md5sum));
649 ret = NETWORK_RECV_STATUS_NEWGRF_MISMATCH;
650 }
651 }
652
653 if (ret == NETWORK_RECV_STATUS_OKAY) {
654 /* Start receiving the map */
655 return SendNewGRFsOk();
656 }
657
658 /* NewGRF mismatch, bail out */
659 ShowErrorMessage(GetEncodedString(STR_NETWORK_ERROR_NEWGRF_MISMATCH), {}, WL_CRITICAL);
660 return ret;
661}
662
663class ClientGamePasswordRequestHandler : public NetworkAuthenticationPasswordRequestHandler {
664 virtual void SendResponse() override { MyClient::SendAuthResponse(); }

Callers

nothing calls this directly

Calls 7

DeserializeGRFIdentifierFunction · 0.85
FindGRFConfigFunction · 0.85
byteswapFunction · 0.85
FormatArrayAsHexFunction · 0.85
ShowErrorMessageFunction · 0.85
Recv_uint8Method · 0.80
GetEncodedStringFunction · 0.50

Tested by

no test coverage detected