MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / ProcessConnectResponseMessage

Method ProcessConnectResponseMessage

neo/framework/async/AsyncClient.cpp:1105–1142  ·  view source on GitHub ↗

================== idAsyncClient::ProcessConnectResponseMessage ================== */

Source from the content-addressed store, hash-verified

1103==================
1104*/
1105void idAsyncClient::ProcessConnectResponseMessage( const netadr_t from, const idBitMsg &msg ) {
1106 int serverGameInitId, serverGameFrame, serverGameTime;
1107 idDict serverSI;
1108
1109 if ( clientState >= CS_CONNECTED ) {
1110 common->Printf( "Duplicate connect received.\n" );
1111 return;
1112 }
1113 if ( clientState != CS_CONNECTING ) {
1114 common->Printf( "Connect response packet while not connecting.\n" );
1115 return;
1116 }
1117 if ( !Sys_CompareNetAdrBase( from, serverAddress ) ) {
1118 common->Printf( "Connect response from a different server.\n" );
1119 common->Printf( "%s should have been %s\n", Sys_NetAdrToString( from ), Sys_NetAdrToString( serverAddress ) );
1120 return;
1121 }
1122
1123 common->Printf( "received connect response from %s\n", Sys_NetAdrToString( from ) );
1124
1125 channel.Init( from, clientId );
1126 clientNum = msg.ReadInt();
1127 clientState = CS_CONNECTED;
1128 lastPacketTime = -9999;
1129
1130 serverGameInitId = msg.ReadInt();
1131 serverGameFrame = msg.ReadInt();
1132 serverGameTime = msg.ReadInt();
1133 msg.ReadDeltaDict( serverSI, NULL );
1134
1135 InitGame( serverGameInitId, serverGameFrame, serverGameTime, serverSI );
1136
1137 // load map
1138 session->SetGUI( NULL, NULL );
1139 sessLocal.ExecuteMapChange();
1140
1141 clientPredictTime = clientPrediction = idMath::ClampInt( 0, idAsyncNetwork::clientMaxPrediction.GetInteger(), clientTime - lastConnectTime );
1142}
1143
1144/*
1145==================

Callers

nothing calls this directly

Calls 9

ReadDeltaDictMethod · 0.80
SetGUIMethod · 0.80
GetIntegerMethod · 0.80
Sys_CompareNetAdrBaseFunction · 0.50
Sys_NetAdrToStringFunction · 0.50
PrintfMethod · 0.45
InitMethod · 0.45
ReadIntMethod · 0.45
ExecuteMapChangeMethod · 0.45

Tested by

no test coverage detected