* send along the reason for disconnection when sending the disconnect

cmd to all clients in SV_FinalMessage()
* on Com_Error(), set the cvar "com_errorCode" with the errorParm_t integer
  value for the error.  This can be used by a mod's ui to an draw error
  dialog specific for the error (e.g. Reconnect button on ERR_SERVERDISCONNECT)
This commit is contained in:
Tony J. White = 2007-12-31 22:35:22 +00:00
parent 45698be226
commit 4c3b7def84
2 changed files with 3 additions and 1 deletions

View file

@ -244,6 +244,8 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
static int errorCount; static int errorCount;
int currentTime; int currentTime;
Cvar_Set( "com_errorCode", va( "%i", code ) );
// when we are running automated scripts, make sure we // when we are running automated scripts, make sure we
// know if anything failed // know if anything failed
if ( com_buildScript && com_buildScript->integer ) { if ( com_buildScript && com_buildScript->integer ) {

View file

@ -708,7 +708,7 @@ void SV_FinalMessage( char *message ) {
// don't send a disconnect to a local client // don't send a disconnect to a local client
if ( cl->netchan.remoteAddress.type != NA_LOOPBACK ) { if ( cl->netchan.remoteAddress.type != NA_LOOPBACK ) {
SV_SendServerCommand( cl, "print \"%s\n\"\n", message ); SV_SendServerCommand( cl, "print \"%s\n\"\n", message );
SV_SendServerCommand( cl, "disconnect" ); SV_SendServerCommand( cl, "disconnect \"%s\"", message );
} }
// force a snapshot to be sent // force a snapshot to be sent
cl->nextSnapshotTime = -1; cl->nextSnapshotTime = -1;