MCPcopy Create free account
hub / github.com/JACoders/OpenJK / CL_Disconnect

Function CL_Disconnect

code/client/cl_main.cpp:252–286  ·  view source on GitHub ↗

===================== CL_Disconnect Called when a connection, or cinematic is being terminated. Goes from a connected state to either a menu state or a console state Sends a disconnect message to the server This is also called on Com_Error and Com_Quit, so it shouldn't cause any errors ===================== */

Source from the content-addressed store, hash-verified

250=====================
251*/
252void CL_Disconnect( void ) {
253 if ( !com_cl_running || !com_cl_running->integer ) {
254 return;
255 }
256
257 if (cls.uiStarted)
258 UI_SetActiveMenu( NULL,NULL );
259
260 SCR_StopCinematic ();
261 S_ClearSoundBuffer();
262
263 // send a disconnect message to the server
264 // send it a few times in case one is dropped
265 if ( cls.state >= CA_CONNECTED ) {
266 CL_AddReliableCommand( "disconnect" );
267 CL_WritePacket();
268 CL_WritePacket();
269 CL_WritePacket();
270 }
271
272 CL_ClearState ();
273
274 CL_FreeReliableCommands();
275
276 extern void CL_FreeServerCommands(void);
277 CL_FreeServerCommands();
278
279 memset( &clc, 0, sizeof( clc ) );
280
281 cls.state = CA_DISCONNECTED;
282
283 // allow cheats locally
284 Cvar_Set( "timescale", "1" );//jic we were skipping
285 Cvar_Set( "skippingCinematic", "0" );//jic we were skipping
286}
287
288
289/*

Callers 5

CL_MapLoadingFunction · 0.70
CL_DisconnectPacketFunction · 0.70
CL_CheckTimeoutFunction · 0.70
CL_ShutdownFunction · 0.70
Com_CatchErrorFunction · 0.50

Calls 9

CL_FreeReliableCommandsFunction · 0.85
CL_FreeServerCommandsFunction · 0.85
SCR_StopCinematicFunction · 0.70
S_ClearSoundBufferFunction · 0.70
CL_AddReliableCommandFunction · 0.70
CL_WritePacketFunction · 0.70
CL_ClearStateFunction · 0.70
UI_SetActiveMenuFunction · 0.50
Cvar_SetFunction · 0.50

Tested by

no test coverage detected