Skip to content

Commit

Permalink
engine: always include reason to server shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
a1batross committed Dec 25, 2024
1 parent fd2b7e9 commit 48bdd42
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion engine/client/cl_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ static void CL_DemoStartPlayback( int mode )
{
// NOTE: at this point demo is still valid
CL_Disconnect();
Host_ShutdownServer();
SV_Shutdown( "Server was killed due to demo playback start\n" );

Con_FastClose();
UI_SetActiveMenu( false );
Expand Down
3 changes: 2 additions & 1 deletion engine/client/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,8 @@ static void CL_Connect_f( void )
Q_strncpy( server, Cmd_Argv( 1 ), sizeof( server ));

// if running a local server, kill it and reissue
if( SV_Active( )) Host_ShutdownServer();
if( SV_Active( ))
SV_Shutdown( "Server was killed due to connection to remote server\n" );
NET_Config( true, !cl_nat.value ); // allow remote

Con_Printf( "server %s\n", server );
Expand Down
1 change: 0 additions & 1 deletion engine/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@ void Host_WriteServerConfig( const char *name );
void Host_WriteOpenGLConfig( void );
void Host_WriteVideoConfig( void );
void Host_WriteConfig( void );
void Host_ShutdownServer( void );
void Host_Error( const char *error, ... ) FORMAT_CHECK( 1 );
void Host_ValidateEngineFeatures( uint32_t mask, uint32_t features );
void Host_Frame( double time );
Expand Down
7 changes: 1 addition & 6 deletions engine/common/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,6 @@ static void Sys_PrintBugcompUsage( const char *exename )
Sys_Quit();
}

void Host_ShutdownServer( void )
{
SV_Shutdown( "Server was killed\n" );
}

/*
================
Host_PrintEngineFeatures
Expand Down Expand Up @@ -841,7 +836,7 @@ void GAME_EXPORT Host_Error( const char *error, ... )
COM_InitHostState();
Cbuf_Clear();

Host_ShutdownServer();
SV_Shutdown( "Server was killed due to an error\n" );
CL_Drop(); // drop clients

// recreate world if needs
Expand Down
2 changes: 1 addition & 1 deletion engine/server/sv_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ Kick everyone off, possibly in preparation for a new game
*/
static void SV_KillServer_f( void )
{
Host_ShutdownServer();
SV_Shutdown( "Server was killed due to shutdownserver command\n" );
}

/*
Expand Down
3 changes: 2 additions & 1 deletion engine/server/sv_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,8 @@ static void SV_SetupClients( void )
if( !changed_maxclients ) return; // nothing to change

// if clients count was changed we need to run full shutdown procedure
if( svs.maxclients ) Host_ShutdownServer();
if( svs.maxclients )
SV_Shutdown( "Server was killed due to maxclients change\n" );

// copy the actual value from cvar
svs.maxclients = (int)sv_maxclients.value;
Expand Down

0 comments on commit 48bdd42

Please sign in to comment.