summaryrefslogtreecommitdiff
path: root/source/sv_main.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2009-04-22 23:40:03 +0000
committerAndrey Nazarov <skuller@skuller.net>2009-04-22 23:40:03 +0000
commit275f310df767a57b8cf409acdcbd14c63cb90df9 (patch)
tree3b59e2751c32b2f15fcfabb1af8b03e702cd5230 /source/sv_main.c
parent385ccd0e9a518933019a8c6f1fecad2ae660b766 (diff)
Don't execute ‘cl_beginmapcmd’, ‘cl_changemapcmd’ and ‘cl_disconnectcmd’ triggers when playing back demos.
Fixed automatic restart of sound subsystem after cvar change not working randomly. Don't crash in CL_Disconnect() on dedicated server exit. Added ‘sv_redirect_address’ variable. Fixed ‘\r’ char not stripped properly from filename when processing ‘\include’ directive in AC config files. Made AC config parser compliant with reference format as defined by R1Q2 implementation. Updated documentation.
Diffstat (limited to 'source/sv_main.c')
-rw-r--r--source/sv_main.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/sv_main.c b/source/sv_main.c
index ce0036e..22890b6 100644
--- a/source/sv_main.c
+++ b/source/sv_main.c
@@ -55,6 +55,7 @@ cvar_t *sv_reserved_slots;
cvar_t *sv_showclamp;
cvar_t *sv_locked;
cvar_t *sv_downloadserver;
+cvar_t *sv_redirect_address;
cvar_t *sv_hostname;
cvar_t *sv_public; // should heartbeats be sent
@@ -475,6 +476,21 @@ static void SVC_GetChallenge( void ) {
"challenge %u p=34,35,36", challenge );
}
+static void send_redirect_hack( const char *addr ) {
+ Netchan_OutOfBand( NS_SERVER, &net_from, "client_connect" );
+
+ MSG_WriteLong( 1 );
+ MSG_WriteLong( 0 );
+ MSG_WriteByte( svc_print );
+ MSG_WriteByte( PRINT_HIGH );
+ MSG_WriteString( va( "Server is full.\nRedirecting you to %s...\n", addr ) );
+ MSG_WriteByte( svc_stufftext );
+ MSG_WriteString( va( "connect %s\n", addr ) );
+
+ NET_SendPacket( NS_SERVER, &net_from, msg_write.cursize, msg_write.data );
+ SZ_Clear( &msg_write );
+}
+
#define SV_OobPrintf(...) \
Netchan_OutOfBand( NS_SERVER, &net_from, "print\n" __VA_ARGS__ )
@@ -778,6 +794,11 @@ static void SVC_DirectConnect( void ) {
} else {
SV_OobPrintf( "Server is full.\n" );
Com_DPrintf( " rejected - server is full.\n" );
+
+ // optionally redirect them to a different address
+ if( sv_redirect_address->string[0] ) {
+ send_redirect_hack( sv_redirect_address->string );
+ }
}
return;
}
@@ -1753,6 +1774,7 @@ void SV_Init( void ) {
sv_locked = Cvar_Get( "sv_locked", "0", 0 );
sv_novis = Cvar_Get ("sv_novis", "0", 0);
sv_downloadserver = Cvar_Get( "sv_downloadserver", "", 0 );
+ sv_redirect_address = Cvar_Get( "sv_redirect_address", "", 0 );
#if USE_CLIENT
sv_debug_send = Cvar_Get( "sv_debug_send", "0", 0 );