From: cloudwalk Date: Tue, 26 May 2020 04:04:05 +0000 (+0000) Subject: Change the ping calculation back. It wasn't necessary to change it. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9d91046070e8cd69d68efd43e1a96a5288987d41;p=xonotic%2Fdarkplaces.git Change the ping calculation back. It wasn't necessary to change it. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12583 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/netconn.c b/netconn.c index 799e0493..5874e7f9 100755 --- a/netconn.c +++ b/netconn.c @@ -1575,6 +1575,7 @@ int NetConn_IsLocalGame(void) static int NetConn_ClientParsePacket_ServerList_ProcessReply(const char *addressstring) { int n; + int pingtime; serverlist_entry_t *entry = NULL; // search the cache for this server and update it @@ -1611,10 +1612,15 @@ static int NetConn_ClientParsePacket_ServerList_ProcessReply(const char *address ++serverlist_cachecount; } // if this is the first reply from this server, count it as having replied - entry->info.ping = bound(0, (int)floor((realtime - entry->querytime) * 1000 + 0.5),9999); + pingtime = (int)((realtime - entry->querytime) * 1000.0 + 0.5); + pingtime = bound(0, pingtime, 9999); if (entry->query == SQS_REFRESHING) { + entry->info.ping = pingtime; entry->query = SQS_QUERIED; } else { + // convert to unsigned to catch the -1 + // I still dont like this but its better than the old 10000 magic ping number - as in easier to type and read :( [11/8/2007 Black] + entry->info.ping = min((unsigned) entry->info.ping, (unsigned) pingtime); serverreplycount++; }