[quake3-commits] r1829 - trunk/code/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Jan 29 17:01:56 EST 2011


Author: thilo
Date: 2011-01-29 17:01:55 -0500 (Sat, 29 Jan 2011)
New Revision: 1829

Modified:
   trunk/code/server/sv_snapshot.c
Log:
Fix floating point imprecision causing glitches in snapshot sending


Modified: trunk/code/server/sv_snapshot.c
===================================================================
--- trunk/code/server/sv_snapshot.c	2011-01-27 17:07:07 UTC (rev 1828)
+++ trunk/code/server/sv_snapshot.c	2011-01-29 22:01:55 UTC (rev 1829)
@@ -555,7 +555,7 @@
 			rate = sv_minRate->integer;
 	}
 
-	rateMsec = ( messageSize + HEADER_RATE_BYTES ) * 1000 / rate * com_timescale->value;
+	rateMsec = ( messageSize + HEADER_RATE_BYTES ) * 1000 / ((int) (rate * com_timescale->value));
 
 	return rateMsec;
 }
@@ -584,7 +584,7 @@
 	// TTimo - https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=491
 	// added sv_lanForceRate check
 	if ( client->netchan.remoteAddress.type == NA_LOOPBACK || (sv_lanForceRate->integer && Sys_IsLANAddress (client->netchan.remoteAddress)) ) {
-		client->nextSnapshotTime = svs.time + (1000.0 / sv_fps->integer * com_timescale->value);
+		client->nextSnapshotTime = svs.time + ((int) (1000.0 / sv_fps->integer * com_timescale->value));
 		return;
 	}
 	
@@ -599,15 +599,15 @@
 		client->rateDelayed = qtrue;
 	}
 
-	client->nextSnapshotTime = svs.time + rateMsec * com_timescale->value;
+	client->nextSnapshotTime = svs.time + ((int) (rateMsec * com_timescale->value));
 
 	// don't pile up empty snapshots while connecting
 	if ( client->state != CS_ACTIVE ) {
 		// a gigantic connection message may have already put the nextSnapshotTime
 		// more than a second away, so don't shorten it
 		// do shorten if client is downloading
-		if (!*client->downloadName && client->nextSnapshotTime < svs.time + 1000 * com_timescale->value)
-			client->nextSnapshotTime = svs.time + 1000 * com_timescale->value;
+		if (!*client->downloadName && client->nextSnapshotTime < svs.time + ((int) (1000.0 * com_timescale->value)))
+			client->nextSnapshotTime = svs.time + ((int) (1000 * com_timescale->value));
 	}
 }
 



More information about the quake3-commits mailing list