================== idAsyncClient::ConnectToServer ================== */
| 181 | ================== |
| 182 | */ |
| 183 | void idAsyncClient::ConnectToServer( const netadr_t adr ) { |
| 184 | // shutdown any current game. that includes network disconnect |
| 185 | session->Stop(); |
| 186 | |
| 187 | if ( !InitPort() ) { |
| 188 | return; |
| 189 | } |
| 190 | |
| 191 | if ( cvarSystem->GetCVarBool( "net_serverDedicated" ) ) { |
| 192 | common->Printf( "Can't connect to a server as dedicated\n" ); |
| 193 | return; |
| 194 | } |
| 195 | |
| 196 | // trash any currently pending packets |
| 197 | ClearPendingPackets(); |
| 198 | |
| 199 | serverAddress = adr; |
| 200 | |
| 201 | // clear the client state |
| 202 | Clear(); |
| 203 | |
| 204 | // get a pseudo random client id, but don't use the id which is reserved for connectionless packets |
| 205 | clientId = Sys_Milliseconds() & CONNECTIONLESS_MESSAGE_ID_MASK; |
| 206 | |
| 207 | // calculate a checksum on some of the essential data used |
| 208 | clientDataChecksum = declManager->GetChecksum(); |
| 209 | |
| 210 | // start challenging the server |
| 211 | clientState = CS_CHALLENGING; |
| 212 | |
| 213 | active = true; |
| 214 | |
| 215 | guiNetMenu = uiManager->FindGui( "guis/netmenu.gui", true, false, true ); |
| 216 | guiNetMenu->SetStateString( "status", va( common->GetLanguageDict()->GetString( "#str_06749" ), Sys_NetAdrToString( adr ) ) ); |
| 217 | session->SetGUI( guiNetMenu, HandleGuiCommand ); |
| 218 | } |
| 219 | |
| 220 | /* |
| 221 | ================== |
no test coverage detected