From 9c0375ebfa74bf7d025a286789106bdbd388b82e Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Mon, 25 May 2020 23:19:38 +0000 Subject: [PATCH] Calculate ping in the server list better. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12580 d7cf8633-e32d-0410-b094-e92efae38249 --- netconn.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/netconn.c b/netconn.c index fc5c4d8c..584b3279 100755 --- a/netconn.c +++ b/netconn.c @@ -1575,7 +1575,6 @@ 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 @@ -1612,15 +1611,10 @@ 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 - pingtime = (int)((realtime - entry->querytime) * 1000.0 + 0.5); - pingtime = bound(0, pingtime, 9999); + entry->info.ping = bound(0, (int)floor((realtime - entry->querytime) * 1000 + 0.5),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++; } -- 2.39.2