MCPcopy Create free account
hub / github.com/JACoders/OpenJK / SV_SetConfigstring

Function SV_SetConfigstring

code/server/sv_init.cpp:48–71  ·  view source on GitHub ↗

=============== SV_SetConfigstring =============== */

Source from the content-addressed store, hash-verified

46===============
47*/
48void 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

Callers 3

SV_SpawnServerFunction · 0.70
SV_FrameFunction · 0.70

Calls 4

SV_SendServerCommandFunction · 0.70
Com_ErrorFunction · 0.50
Z_FreeFunction · 0.50
CopyStringFunction · 0.50

Tested by

no test coverage detected