/* ================= Host_Shutdown ================= */ void EXPORT Host_Shutdown( void ) { if( host.shutdown_issued ) return; host.shutdown_issued = true; switch( host.state ) { case HOST_INIT: case HOST_CRASHED: case HOST_ERR_FATAL: if( host.type == HOST_NORMAL ) MsgDev( D_WARN, "Not shutting down normally (%d), skipping config save!\n", host.state ); if( host.state != HOST_ERR_FATAL) host.state = HOST_SHUTDOWN; break; default: if( host.type == HOST_NORMAL ) { Host_WriteConfig(); IN_TouchWriteConfig(); } host.state = HOST_SHUTDOWN; // prepare host to normal shutdown } if( !host.change_game ) Q_strncpy( host.finalmsg, "Server shutdown", sizeof( host.finalmsg )); Log_Printf( "Server shutdown\n" ); Log_Close(); SV_Shutdown( false ); CL_Shutdown(); Mod_Shutdown(); NET_Shutdown(); HTTP_Shutdown(); Cmd_Shutdown(); Host_FreeCommon(); Con_DestroyConsole(); Sys_RestoreCrashHandler(); }
void CL_Crashed( void ) { // already freed if( host.state == HOST_CRASHED ) return; if( host.type != HOST_NORMAL ) return; if( !cls.initialized ) return; host.state = HOST_CRASHED; CL_Stop_f(); // stop any demos // send a disconnect message to the server CL_SendDisconnectMessage(); Host_WriteOpenGLConfig(); Host_WriteConfig(); // write config // never write video.cfg here because reason to crash may be provoked // with some renderer variables VID_RestoreGamma(); }
/* ================= Host_Shutdown ================= */ void EXPORT Host_Shutdown( void ) { if( host.shutdown_issued ) return; host.shutdown_issued = true; if( host.state != HOST_ERR_FATAL ) host.state = HOST_SHUTDOWN; // prepare host to normal shutdown if( !host.change_game ) Q_strncpy( host.finalmsg, "Server shutdown", sizeof( host.finalmsg )); if( host.type == HOST_NORMAL ) Host_WriteConfig(); SV_Shutdown( false ); CL_Shutdown(); Mod_Shutdown(); NET_Shutdown(); Host_FreeCommon(); Con_DestroyConsole(); #ifdef _WIN32 // restore filter if( host.oldFilter ) SetUnhandledExceptionFilter( host.oldFilter ); }