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

Method Receive_CLIENT_JOIN

src/network/network_server.cpp:846–870  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

844}
845
846NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_JOIN(Packet &p)
847{
848 if (this->status != STATUS_INACTIVE) {
849 /* Illegal call, return error and ignore the packet */
850 return this->SendError(NETWORK_ERROR_NOT_EXPECTED);
851 }
852
853 if (_network_game_info.clients_on >= _settings_client.network.max_clients) {
854 /* Turns out we are full. Inform the user about this. */
855 return this->SendError(NETWORK_ERROR_FULL);
856 }
857
858 std::string client_revision = p.Recv_string(NETWORK_REVISION_LENGTH);
859 uint32_t newgrf_version = p.Recv_uint32();
860
861 Debug(net, 9, "client[{}] Receive_CLIENT_JOIN(): client_revision={}, newgrf_version={}", this->client_id, client_revision, newgrf_version);
862
863 /* Check if the client has revision control enabled */
864 if (!IsNetworkCompatibleVersion(client_revision) || _openttd_newgrf_version != newgrf_version) {
865 /* Different revisions!! */
866 return this->SendError(NETWORK_ERROR_WRONG_REVISION);
867 }
868
869 return this->SendAuthRequest();
870}
871
872NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_IDENTIFY(Packet &p)
873{

Callers

nothing calls this directly

Calls 5

SendErrorMethod · 0.95
SendAuthRequestMethod · 0.95
Recv_stringMethod · 0.80
Recv_uint32Method · 0.80

Tested by

no test coverage detected