================ SV_SendClientGameState Sends the first message from the server to a connected client. This will be sent on the initial connection and upon each new map load. It will be resent if the client acknowledges a later message but has the wrong gamestate. ================ */
| 193 | ================ |
| 194 | */ |
| 195 | void SV_SendClientGameState( client_t *client ) { |
| 196 | int start; |
| 197 | msg_t msg; |
| 198 | byte msgBuffer[MAX_MSGLEN]; |
| 199 | |
| 200 | Com_DPrintf ("SV_SendGameState() for %s\n", client->name); |
| 201 | client->state = CS_PRIMED; |
| 202 | |
| 203 | // when we receive the first packet from the client, we will |
| 204 | // notice that it is from a different serverid and that the |
| 205 | // gamestate message was not just sent, forcing a retransmit |
| 206 | client->gamestateMessageNum = client->netchan.outgoingSequence; |
| 207 | |
| 208 | // clear the reliable message list for this client |
| 209 | client->reliableSequence = 0; |
| 210 | client->reliableAcknowledge = 0; |
| 211 | |
| 212 | MSG_Init( &msg, msgBuffer, sizeof( msgBuffer ) ); |
| 213 | |
| 214 | // send the gamestate |
| 215 | MSG_WriteByte( &msg, svc_gamestate ); |
| 216 | MSG_WriteLong( &msg, client->reliableSequence ); |
| 217 | |
| 218 | // write the configstrings |
| 219 | for ( start = 0 ; start < MAX_CONFIGSTRINGS ; start++ ) { |
| 220 | if (sv.configstrings[start][0]) { |
| 221 | MSG_WriteByte( &msg, svc_configstring ); |
| 222 | MSG_WriteShort( &msg, start ); |
| 223 | MSG_WriteString( &msg, sv.configstrings[start] ); |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | MSG_WriteByte( &msg, 0 ); |
| 228 | |
| 229 | // check for overflow |
| 230 | if ( msg.overflowed ) { |
| 231 | Com_Printf ("WARNING: GameState overflowed for %s\n", client->name); |
| 232 | } |
| 233 | |
| 234 | // deliver this to the client |
| 235 | SV_SendMessageToClient( &msg, client ); |
| 236 | } |
| 237 | |
| 238 | |
| 239 | /* |
no test coverage detected