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

Function SV_SetConfigstring

codemp/server/sv_init.cpp:112–152  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

110===============
111*/
112void 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===============

Callers 4

SV_GameSystemCallsFunction · 0.70
SV_SpawnServerFunction · 0.70
SV_FrameFunction · 0.70
SV_MapRestart_fFunction · 0.70

Calls 4

SV_SendConfigstringFunction · 0.85
Com_ErrorFunction · 0.50
Z_FreeFunction · 0.50
CopyStringFunction · 0.50

Tested by

no test coverage detected