===================== 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 ===================== */
| 250 | ===================== |
| 251 | */ |
| 252 | void 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 | /* |
no test coverage detected