r192 - trunk/code/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Oct 28 17:09:50 EDT 2005


Author: tma
Date: 2005-10-28 17:09:50 -0400 (Fri, 28 Oct 2005)
New Revision: 192

Modified:
   trunk/code/server/server.h
   trunk/code/server/sv_client.c
   trunk/code/server/sv_init.c
   trunk/code/server/sv_snapshot.c
Log:
* Fix to https://bugzilla.icculus.org/show_bug.cgi?id=2454


Modified: trunk/code/server/server.h
===================================================================
--- trunk/code/server/server.h	2005-10-27 22:38:25 UTC (rev 191)
+++ trunk/code/server/server.h	2005-10-28 21:09:50 UTC (rev 192)
@@ -166,6 +166,8 @@
 	// buffer them into this queue, and hand them out to netchan as needed
 	netchan_buffer_t *netchan_start_queue;
 	netchan_buffer_t **netchan_end_queue;
+
+	int				oldServerTime;
 } client_t;
 
 //=============================================================================

Modified: trunk/code/server/sv_client.c
===================================================================
--- trunk/code/server/sv_client.c	2005-10-27 22:38:25 UTC (rev 191)
+++ trunk/code/server/sv_client.c	2005-10-28 21:09:50 UTC (rev 192)
@@ -1500,6 +1500,13 @@
 		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
 	do {
 		c = MSG_ReadByte( msg );

Modified: trunk/code/server/sv_init.c
===================================================================
--- trunk/code/server/sv_init.c	2005-10-27 22:38:25 UTC (rev 191)
+++ trunk/code/server/sv_init.c	2005-10-28 21:09:50 UTC (rev 192)
@@ -396,6 +396,13 @@
 	Cvar_Set( "nextmap", "map_restart 0");
 //	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
 	SV_ClearServer();
 	for ( i = 0 ; i < MAX_CONFIGSTRINGS ; i++ ) {

Modified: trunk/code/server/sv_snapshot.c
===================================================================
--- trunk/code/server/sv_snapshot.c	2005-10-27 22:38:25 UTC (rev 191)
+++ trunk/code/server/sv_snapshot.c	2005-10-28 21:09:50 UTC (rev 192)
@@ -160,7 +160,17 @@
 
 	// send over the current server time so the client can drift
 	// its view of time to try to match
-	MSG_WriteLong (msg, sv.time);
+	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);
+	}
 
 	// what we are delta'ing from
 	MSG_WriteByte (msg, lastframe);




More information about the quake3-commits mailing list