=============== SV_SetConfigstring =============== */
| 46 | =============== |
| 47 | */ |
| 48 | void SV_SetConfigstring (int index, const char *val) { |
| 49 | if ( index < 0 || index >= MAX_CONFIGSTRINGS ) { |
| 50 | Com_Error (ERR_DROP, "SV_SetConfigstring: bad index %i\n", index); |
| 51 | } |
| 52 | |
| 53 | if ( !val ) { |
| 54 | val = ""; |
| 55 | } |
| 56 | |
| 57 | // don't bother broadcasting an update if no change |
| 58 | if ( !strcmp( val, sv.configstrings[ index ] ) ) { |
| 59 | return; |
| 60 | } |
| 61 | |
| 62 | // change the string in sv |
| 63 | Z_Free( sv.configstrings[index] ); |
| 64 | sv.configstrings[index] = CopyString( val ); |
| 65 | |
| 66 | // send it to all the clients if we aren't |
| 67 | // spawning a new server |
| 68 | if ( sv.state == SS_GAME ) { |
| 69 | SV_SendServerCommand( NULL, "cs %i \"%s\"\n", index, val ); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | |
| 74 |
no test coverage detected