=============== SV_SetConfigstring =============== */
| 110 | =============== |
| 111 | */ |
| 112 | void SV_SetConfigstring (int index, const char *val) { |
| 113 | int i; |
| 114 | client_t *client; |
| 115 | |
| 116 | if ( index < 0 || index >= MAX_CONFIGSTRINGS ) { |
| 117 | Com_Error (ERR_DROP, "SV_SetConfigstring: bad index %i\n", index); |
| 118 | } |
| 119 | |
| 120 | if ( !val ) { |
| 121 | val = ""; |
| 122 | } |
| 123 | |
| 124 | // don't bother broadcasting an update if no change |
| 125 | if ( !strcmp( val, sv.configstrings[ index ] ) ) { |
| 126 | return; |
| 127 | } |
| 128 | |
| 129 | // change the string in sv |
| 130 | Z_Free( sv.configstrings[index] ); |
| 131 | sv.configstrings[index] = CopyString( val ); |
| 132 | |
| 133 | // send it to all the clients if we aren't |
| 134 | // spawning a new server |
| 135 | if ( sv.state == SS_GAME || sv.restarting ) { |
| 136 | |
| 137 | // send the data to all relevent clients |
| 138 | for (i = 0, client = svs.clients; i < sv_maxclients->integer ; i++, client++) { |
| 139 | if ( client->state < CS_ACTIVE ) { |
| 140 | if ( client->state == CS_PRIMED ) |
| 141 | client->csUpdated[ index ] = qtrue; |
| 142 | continue; |
| 143 | } |
| 144 | // do not always send server info to all clients |
| 145 | if ( index == CS_SERVERINFO && client->gentity && (client->gentity->r.svFlags & SVF_NOSERVERINFO) ) { |
| 146 | continue; |
| 147 | } |
| 148 | |
| 149 | SV_SendConfigstring(client, index); |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | /* |
| 155 | =============== |
no test coverage detected