summaryrefslogtreecommitdiff
path: root/src/qcommon/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/qcommon/common.c')
-rw-r--r--src/qcommon/common.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/qcommon/common.c b/src/qcommon/common.c
index c074aa74..586c334c 100644
--- a/src/qcommon/common.c
+++ b/src/qcommon/common.c
@@ -269,15 +269,18 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
com_errorEntered = qtrue;
va_start (argptr,fmt);
- vsprintf (com_errorMessage,fmt,argptr);
+ Q_vsnprintf (com_errorMessage, sizeof(com_errorMessage),fmt,argptr);
va_end (argptr);
if (code != ERR_DISCONNECT && code != ERR_NEED_CD)
Cvar_Set("com_errorMessage", com_errorMessage);
if (code == ERR_DISCONNECT || code == ERR_SERVERDISCONNECT) {
+ SV_Shutdown( "Server disconnected" );
CL_Disconnect( qtrue );
+ VM_Forced_Unload_Start();
CL_FlushMemory( );
+ VM_Forced_Unload_Done();
// make sure we can get at our local stuff
FS_PureServerSetLoadedPaks("", "");
com_errorEntered = qfalse;
@@ -286,7 +289,9 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
Com_Printf ("********************\nERROR: %s\n********************\n", com_errorMessage);
SV_Shutdown (va("Server crashed: %s", com_errorMessage));
CL_Disconnect( qtrue );
+ VM_Forced_Unload_Start();
CL_FlushMemory( );
+ VM_Forced_Unload_Done();
FS_PureServerSetLoadedPaks("", "");
com_errorEntered = qfalse;
longjmp (abortframe, -1);
@@ -294,7 +299,9 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
SV_Shutdown( "Server didn't have CD" );
if ( com_cl_running && com_cl_running->integer ) {
CL_Disconnect( qtrue );
+ VM_Forced_Unload_Start();
CL_FlushMemory( );
+ VM_Forced_Unload_Done();
com_errorEntered = qfalse;
CL_CDDialog();
} else {
@@ -323,8 +330,9 @@ do the apropriate things.
*/
void Com_Quit_f( void ) {
// don't try to shutdown if we are in a recursive error
+ char *p = Cmd_Args( );
if ( !com_errorEntered ) {
- SV_Shutdown ("Server quit");
+ SV_Shutdown (p[0] ? p : "Server quit");
CL_Shutdown ();
Com_Shutdown ();
FS_Shutdown(qtrue);
@@ -464,10 +472,12 @@ qboolean Com_AddStartupCommands( void ) {
continue;
}
- // set commands won't override menu startup
- if ( Q_stricmpn( com_consoleLines[i], "set", 3 ) ) {
- added = qtrue;
+ // set commands already added with Com_StartupVariable
+ if ( !Q_stricmpn( com_consoleLines[i], "set", 3 ) ) {
+ continue;
}
+
+ added = qtrue;
Cbuf_AddText( com_consoleLines[i] );
Cbuf_AddText( "\n" );
}
@@ -2430,9 +2440,11 @@ void Com_Init( char *commandLine ) {
// get dedicated here for proper hunk megs initialization
#ifdef DEDICATED
- com_dedicated = Cvar_Get ("dedicated", "1", CVAR_ROM);
+ com_dedicated = Cvar_Get ("dedicated", "1", CVAR_INIT);
+ Cvar_CheckRange( com_dedicated, 1, 2, qtrue );
#else
com_dedicated = Cvar_Get ("dedicated", "0", CVAR_LATCH);
+ Cvar_CheckRange( com_dedicated, 0, 2, qtrue );
#endif
// allocate the stack based hunk allocator
Com_InitHunkMemory();