This commit is contained in:
Tim Angus 2005-10-28 21:09:50 +00:00
parent b1b7f975f1
commit 4c63d1ed40
4 changed files with 27 additions and 1 deletions

View file

@ -166,6 +166,8 @@ typedef struct client_s {
// buffer them into this queue, and hand them out to netchan as needed // buffer them into this queue, and hand them out to netchan as needed
netchan_buffer_t *netchan_start_queue; netchan_buffer_t *netchan_start_queue;
netchan_buffer_t **netchan_end_queue; netchan_buffer_t **netchan_end_queue;
int oldServerTime;
} client_t; } client_t;
//============================================================================= //=============================================================================

View file

@ -1500,6 +1500,13 @@ void SV_ExecuteClientMessage( client_t *cl, msg_t *msg ) {
return; return;
} }
// this client has acknowledged the new gamestate so it's
// safe to start sending it the real time again
if( cl->oldServerTime && serverId == sv.serverId ){
Com_DPrintf( "%s acknowledged gamestate\n", cl->name );
cl->oldServerTime = 0;
}
// read optional clientCommand strings // read optional clientCommand strings
do { do {
c = MSG_ReadByte( msg ); c = MSG_ReadByte( msg );

View file

@ -396,6 +396,13 @@ void SV_SpawnServer( char *server, qboolean killBots ) {
Cvar_Set( "nextmap", "map_restart 0"); Cvar_Set( "nextmap", "map_restart 0");
// Cvar_Set( "nextmap", va("map %s", server) ); // Cvar_Set( "nextmap", va("map %s", server) );
for (i=0 ; i<sv_maxclients->integer ; i++) {
// save when the server started for each client already connected
if (svs.clients[i].state >= CS_CONNECTED) {
svs.clients[i].oldServerTime = sv.time;
}
}
// wipe the entire per-level structure // wipe the entire per-level structure
SV_ClearServer(); SV_ClearServer();
for ( i = 0 ; i < MAX_CONFIGSTRINGS ; i++ ) { for ( i = 0 ; i < MAX_CONFIGSTRINGS ; i++ ) {

View file

@ -160,7 +160,17 @@ static void SV_WriteSnapshotToClient( client_t *client, msg_t *msg ) {
// send over the current server time so the client can drift // send over the current server time so the client can drift
// its view of time to try to match // its view of time to try to match
if( client->oldServerTime ) {
// The server has not yet got an acknowledgement of the
// new gamestate from this client, so continue to send it
// a time as if the server has not restarted. Note from
// the client's perspective this time is strictly speaking
// incorrect, but since it'll be busy loading a map at
// the time it doesn't really matter.
MSG_WriteLong (msg, sv.time + client->oldServerTime);
} else {
MSG_WriteLong (msg, sv.time); MSG_WriteLong (msg, sv.time);
}
// what we are delta'ing from // what we are delta'ing from
MSG_WriteByte (msg, lastframe); MSG_WriteByte (msg, lastframe);