summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cl_demo.c2
-rw-r--r--src/cl_main.c4
-rw-r--r--src/common.c20
-rw-r--r--src/common.h8
-rw-r--r--src/q_shared.h3
-rw-r--r--src/sv_ccmds.c4
-rw-r--r--src/sv_init.c2
-rw-r--r--src/sv_local.h2
-rw-r--r--src/sv_main.c13
-rw-r--r--src/sv_mvd.c4
-rw-r--r--src/sv_public.h2
-rw-r--r--src/sys_unix.c2
-rw-r--r--src/sys_win.c2
-rw-r--r--src/vid_sdl.c2
-rw-r--r--src/vid_win.c2
15 files changed, 35 insertions, 37 deletions
diff --git a/src/cl_demo.c b/src/cl_demo.c
index 95f12ad..d6c08a5 100644
--- a/src/cl_demo.c
+++ b/src/cl_demo.c
@@ -676,7 +676,7 @@ fail:
}
// if running a local server, kill it and reissue
- SV_Shutdown( "Server was killed.\n", KILL_DROP );
+ SV_Shutdown( "Server was killed.\n", ERR_DISCONNECT );
CL_Disconnect( ERR_DISCONNECT, NULL );
diff --git a/src/cl_main.c b/src/cl_main.c
index dac3d5c..25bae16 100644
--- a/src/cl_main.c
+++ b/src/cl_main.c
@@ -446,7 +446,7 @@ usage:
Q_strlcpy( cls.servername, server, sizeof( cls.servername ) );
// if running a local server, kill it and reissue
- SV_Shutdown( "Server was killed.\n", KILL_DROP );
+ SV_Shutdown( "Server was killed.\n", ERR_DISCONNECT );
NET_Config( NET_CLIENT );
@@ -482,7 +482,7 @@ static void CL_PassiveConnect_f( void ) {
}
// if running a local server, kill it and reissue
- SV_Shutdown( "Server was killed.\n", KILL_DROP );
+ SV_Shutdown( "Server was killed.\n", ERR_DISCONNECT );
NET_Config( NET_CLIENT );
diff --git a/src/common.c b/src/common.c
index a8ca792..5b40fed 100644
--- a/src/common.c
+++ b/src/common.c
@@ -475,11 +475,10 @@ void Com_Error( error_type_t code, const char *fmt, ... ) {
Com_AbortRedirect();
X86_POP_FPCW;
-
- if( code == ERR_DISCONNECT ) {
+
+ if( code == ERR_DISCONNECT || code == ERR_RECONNECT ) {
Com_WPrintf( "%s\n", com_errorMsg );
- SV_Shutdown( va( "Server was killed: %s", com_errorMsg ),
- KILL_DISCONNECT );
+ SV_Shutdown( va( "Server was killed: %s", com_errorMsg ), code );
#if USE_CLIENT
CL_Disconnect( code, com_errorMsg );
#endif
@@ -501,7 +500,7 @@ void Com_Error( error_type_t code, const char *fmt, ... ) {
Com_EPrintf( "********************\n"
"ERROR: %s\n"
"********************\n", com_errorMsg );
- SV_Shutdown( va( "Server crashed: %s\n", com_errorMsg ), KILL_DROP );
+ SV_Shutdown( va( "Server crashed: %s\n", com_errorMsg ), ERR_DROP );
#if USE_CLIENT
CL_Disconnect( ERR_DROP, com_errorMsg );
#endif
@@ -512,7 +511,7 @@ void Com_Error( error_type_t code, const char *fmt, ... ) {
FS_FPrintf( com_logFile, "FATAL: %s\n", com_errorMsg );
}
- SV_Shutdown( va( "Server fatal crashed: %s\n", com_errorMsg ), KILL_DROP );
+ SV_Shutdown( va( "Server fatal crashed: %s\n", com_errorMsg ), ERR_FATAL );
#if USE_CLIENT
CL_Shutdown();
#endif
@@ -543,9 +542,9 @@ Both client and server can use this, and it will
do the apropriate things. This function never returns.
=============
*/
-void Com_Quit( const char *reason, killtype_t type ) {
+void Com_Quit( const char *reason, error_type_t type ) {
char buffer[MAX_STRING_CHARS];
- char *what = type == KILL_RESTART ? "restarted" : "quit";
+ char *what = type == ERR_RECONNECT ? "restarted" : "quit";
if( reason && *reason ) {
Q_snprintf( buffer, sizeof( buffer ),
@@ -554,6 +553,7 @@ void Com_Quit( const char *reason, killtype_t type ) {
Q_snprintf( buffer, sizeof( buffer ),
"Server %s\n", what );
}
+
SV_Shutdown( buffer, type );
#if USE_CLIENT
@@ -565,12 +565,12 @@ void Com_Quit( const char *reason, killtype_t type ) {
}
static void Com_Quit_f( void ) {
- Com_Quit( Cmd_Args(), KILL_DROP );
+ Com_Quit( Cmd_Args(), ERR_DISCONNECT );
}
#if !USE_CLIENT
static void Com_Recycle_f( void ) {
- Com_Quit( Cmd_Args(), KILL_RESTART );
+ Com_Quit( Cmd_Args(), ERR_RECONNECT );
}
#endif
diff --git a/src/common.h b/src/common.h
index 906d52c..de1c78c 100644
--- a/src/common.h
+++ b/src/common.h
@@ -475,12 +475,6 @@ typedef enum {
COLOR_NONE
} color_index_t;
-typedef enum {
- KILL_RESTART,
- KILL_DISCONNECT,
- KILL_DROP
-} killtype_t;
-
typedef struct {
const char *name;
void (* const func)( void );
@@ -512,7 +506,7 @@ void Com_AbortFrame( void );
char *Com_GetLastError( void );
void Com_SetLastError( const char *msg );
-void Com_Quit( const char *reason, killtype_t type ) q_noreturn;
+void Com_Quit( const char *reason, error_type_t type ) q_noreturn;
void Com_SetColor( color_index_t color );
diff --git a/src/q_shared.h b/src/q_shared.h
index 790049c..7fa1ad2 100644
--- a/src/q_shared.h
+++ b/src/q_shared.h
@@ -120,7 +120,8 @@ typedef int qerror_t;
typedef enum {
ERR_FATAL, // exit the entire game with a popup window
ERR_DROP, // print to console and disconnect from game
- ERR_DISCONNECT, // don't kill server
+ ERR_DISCONNECT, // like drop, but not an error
+ ERR_RECONNECT // make server broadcast 'reconnect' message
} error_type_t;
typedef enum {
diff --git a/src/sv_ccmds.c b/src/sv_ccmds.c
index cdbf8bc..64d0cd9 100644
--- a/src/sv_ccmds.c
+++ b/src/sv_ccmds.c
@@ -283,7 +283,7 @@ static void SV_GameMap_f( void ) {
// admin option to reload the game DLL or entire server
if( sv_recycle->integer > 0 ) {
if( sv_recycle->integer > 1 ) {
- Com_Quit( NULL, KILL_RESTART );
+ Com_Quit( NULL, ERR_RECONNECT );
}
SV_Map( Cmd_Argv( 1 ), qtrue );
return;
@@ -847,7 +847,7 @@ static void SV_KillServer_f( void ) {
return;
}
- SV_Shutdown( "Server was killed.\n", KILL_DROP );
+ SV_Shutdown( "Server was killed.\n", ERR_DISCONNECT );
}
/*
diff --git a/src/sv_init.c b/src/sv_init.c
index 402f23a..bd647e7 100644
--- a/src/sv_init.c
+++ b/src/sv_init.c
@@ -204,7 +204,7 @@ void SV_InitGame( qboolean ismvd ) {
if( svs.initialized ) {
// cause any connected clients to reconnect
- SV_Shutdown( "Server restarted\n", KILL_RESTART );
+ SV_Shutdown( "Server restarted\n", ERR_RECONNECT );
} else {
#if USE_CLIENT
// make sure the client is down
diff --git a/src/sv_local.h b/src/sv_local.h
index 797cce6..9ea26cd 100644
--- a/src/sv_local.h
+++ b/src/sv_local.h
@@ -521,7 +521,7 @@ void SV_InitClientSend( client_t *newcl );
//
void SV_MvdRegister( void );
void SV_MvdInit( void );
-void SV_MvdShutdown( killtype_t type );
+void SV_MvdShutdown( error_type_t type );
void SV_MvdBeginFrame( void );
void SV_MvdEndFrame( void );
void SV_MvdRunClients( void );
diff --git a/src/sv_main.c b/src/sv_main.c
index fbbcdde..54b30b3 100644
--- a/src/sv_main.c
+++ b/src/sv_main.c
@@ -1984,9 +1984,12 @@ static void SV_FinalMessage( const char *message, int cmd ) {
netchan_t *netchan;
int i;
- MSG_WriteByte( svc_print );
- MSG_WriteByte( PRINT_HIGH );
- MSG_WriteString( message );
+ if( message ) {
+ MSG_WriteByte( svc_print );
+ MSG_WriteByte( PRINT_HIGH );
+ MSG_WriteString( message );
+ }
+
MSG_WriteByte( cmd );
// send it twice
@@ -2023,7 +2026,7 @@ SV_Shutdown
Called when each game quits, from Com_Quit or Com_Error
================
*/
-void SV_Shutdown( const char *finalmsg, killtype_t type ) {
+void SV_Shutdown( const char *finalmsg, error_type_t type ) {
master_t *m;
Cvar_Set( "sv_running", "0" );
@@ -2045,7 +2048,7 @@ void SV_Shutdown( const char *finalmsg, killtype_t type ) {
SV_MvdShutdown( type );
#endif
- if( type == KILL_RESTART ) {
+ if( type == ERR_RECONNECT ) {
SV_FinalMessage( finalmsg, svc_reconnect );
} else {
SV_FinalMessage( finalmsg, svc_disconnect );
diff --git a/src/sv_mvd.c b/src/sv_mvd.c
index ae0b61b..b1f0eab 100644
--- a/src/sv_mvd.c
+++ b/src/sv_mvd.c
@@ -1949,9 +1949,9 @@ SV_MvdShutdown
Server is shutting down, clean everything up.
==================
*/
-void SV_MvdShutdown( killtype_t type ) {
+void SV_MvdShutdown( error_type_t type ) {
// drop all clients
- mvd_drop( type == KILL_RESTART ? GTS_RECONNECT : GTS_DISCONNECT );
+ mvd_drop( type == ERR_RECONNECT ? GTS_RECONNECT : GTS_DISCONNECT );
// free static data
Z_Free( mvd.message.data );
diff --git a/src/sv_public.h b/src/sv_public.h
index 89b0abb..3b60b16 100644
--- a/src/sv_public.h
+++ b/src/sv_public.h
@@ -31,7 +31,7 @@ typedef enum {
void SV_ErrorEvent( int info );
#endif
void SV_Init (void);
-void SV_Shutdown( const char *finalmsg, killtype_t type );
+void SV_Shutdown( const char *finalmsg, error_type_t type );
unsigned SV_Frame (unsigned msec);
#if USE_SYSCON
void SV_SetConsoleTitle( void );
diff --git a/src/sys_unix.c b/src/sys_unix.c
index 4d3ab0c..facace9 100644
--- a/src/sys_unix.c
+++ b/src/sys_unix.c
@@ -614,7 +614,7 @@ static void term_handler( int signum ) {
#else
Com_Printf( "Received signal %d, exiting\n", signum );
#endif
- Com_Quit( NULL, KILL_DROP );
+ Com_Quit( NULL, ERR_DISCONNECT );
}
static void kill_handler( int signum ) {
diff --git a/src/sys_win.c b/src/sys_win.c
index 906a6d3..5412ce7 100644
--- a/src/sys_win.c
+++ b/src/sys_win.c
@@ -1042,7 +1042,7 @@ static int Sys_Main( int argc, char **argv ) {
#if USE_WINSVC
if( shouldExit == SE_FULL )
#endif
- Com_Quit( NULL, KILL_DROP );
+ Com_Quit( NULL, ERR_DISCONNECT );
break;
}
}
diff --git a/src/vid_sdl.c b/src/vid_sdl.c
index a263c4f..9b5c7a7 100644
--- a/src/vid_sdl.c
+++ b/src/vid_sdl.c
@@ -482,7 +482,7 @@ void VID_PumpEvents( void ) {
activate_event();
break;
case SDL_QUIT:
- Com_Quit( NULL, KILL_DROP );
+ Com_Quit( NULL, ERR_DISCONNECT );
break;
case SDL_VIDEORESIZE:
resize_event( event.resize.w, event.resize.h );
diff --git a/src/vid_win.c b/src/vid_win.c
index a3f20e5..bc6f1b4 100644
--- a/src/vid_win.c
+++ b/src/vid_win.c
@@ -798,7 +798,7 @@ void VID_PumpEvents( void ) {
while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) {
if( msg.message == WM_QUIT ) {
- Com_Quit( NULL, KILL_DROP );
+ Com_Quit( NULL, ERR_DISCONNECT );
break;
}
win.lastMsgTime = msg.time;