Index: code/server/sv_client.c =================================================================== --- code/server/sv_client.c (revision 913) +++ code/server/sv_client.c (working copy) @@ -618,7 +618,11 @@ sharedEntity_t *ent; Com_DPrintf( "Going from CS_PRIMED to CS_ACTIVE for %s\n", client->name ); + client->state = CS_ACTIVE; + // resend all configstrings using the cs commands since these are + // no longer sent when the client is CS_PRIMED + SV_UpdateConfigstrings( client ); // set up the entity for the client clientNum = client - svs.clients; Index: code/server/sv_init.c =================================================================== --- code/server/sv_init.c (revision 913) +++ code/server/sv_init.c (working copy) @@ -22,15 +22,62 @@ #include "server.h" + /* =============== +SV_SendConfigstring +=============== +*/ +static void SV_SendConfigString(client_t *client, int index) +{ + int maxChunkSize = MAX_STRING_CHARS - 24; + int len; + + if(!sv.configstrings[index][0]) + return; + + len = strlen(sv.configstrings[index]); + + if( len >= maxChunkSize ) { + int sent = 0; + int remaining = len; + char *cmd; + char buf[MAX_STRING_CHARS]; + + while (remaining > 0 ) { + if ( sent == 0 ) { + cmd = "bcs0"; + } + else if( remaining < maxChunkSize ) { + cmd = "bcs2"; + } + else { + cmd = "bcs1"; + } + Q_strncpyz( buf, &sv.configstrings[index][sent], + maxChunkSize ); + + SV_SendServerCommand( client, "%s %i \"%s\"\n", cmd, + index, buf ); + + sent += (maxChunkSize - 1); + remaining -= (maxChunkSize - 1); + } + } else { + // standard cs, just send it + SV_SendServerCommand( client, "cs %i \"%s\"\n", index, + sv.configstrings[index] ); + } +} + +/* +=============== SV_SetConfigstring =============== */ void SV_SetConfigstring (int index, const char *val) { int len, i; - int maxChunkSize = MAX_STRING_CHARS - 24; client_t *client; if ( index < 0 || index >= MAX_CONFIGSTRINGS ) { @@ -56,48 +103,41 @@ // send the data to all relevent clients for (i = 0, client = svs.clients; i < sv_maxclients->integer ; i++, client++) { - if ( client->state < CS_PRIMED ) { + if ( client->state < CS_ACTIVE ) { + client->csupdated[index] = qtrue; continue; } // do not always send server info to all clients if ( index == CS_SERVERINFO && client->gentity && (client->gentity->r.svFlags & SVF_NOSERVERINFO) ) { continue; } + len = strlen( val ); - if( len >= maxChunkSize ) { - int sent = 0; - int remaining = len; - char *cmd; - char buf[MAX_STRING_CHARS]; + SV_SendConfigString(client, index); + } + } +} - while (remaining > 0 ) { - if ( sent == 0 ) { - cmd = "bcs0"; - } - else if( remaining < maxChunkSize ) { - cmd = "bcs2"; - } - else { - cmd = "bcs1"; - } - Q_strncpyz( buf, &val[sent], maxChunkSize ); +void SV_UpdateConfigstrings(client_t *client) +{ + int index; - SV_SendServerCommand( client, "%s %i \"%s\"\n", cmd, index, buf ); + for( index = 0; index <= MAX_CONFIGSTRINGS; index++ ) { + // if the CS hasn't changed since we went to CS_PRIMED, ignore + if(!client->csupdated[index]) + continue; - sent += (maxChunkSize - 1); - remaining -= (maxChunkSize - 1); - } - } else { - // standard cs, just send it - SV_SendServerCommand( client, "cs %i \"%s\"\n", index, val ); - } + // do not always send server info to all clients + if ( index == CS_SERVERINFO && client->gentity && + (client->gentity->r.svFlags & SVF_NOSERVERINFO) ) { + continue; } + SV_SendConfigString(client, index); } } - /* =============== SV_GetConfigstring Index: code/server/server.h =================================================================== --- code/server/server.h (revision 913) +++ code/server/server.h (working copy) @@ -168,6 +168,7 @@ netchan_buffer_t **netchan_end_queue; int oldServerTime; + qboolean csupdated[MAX_CONFIGSTRINGS+1]; } client_t; //============================================================================= @@ -272,6 +273,7 @@ // void SV_SetConfigstring( int index, const char *val ); void SV_GetConfigstring( int index, char *buffer, int bufferSize ); +void SV_UpdateConfigstrings( client_t *client ); void SV_SetUserinfo( int index, const char *val ); void SV_GetUserinfo( int index, char *buffer, int bufferSize );