]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Change the ping calculation back. It wasn't necessary to change it.
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 26 May 2020 04:04:05 +0000 (04:04 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 26 May 2020 04:04:05 +0000 (04:04 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12583 d7cf8633-e32d-0410-b094-e92efae38249

netconn.c

index 799e049395f32d2adb14173debf4619a94a96fd5..5874e7f9c2ecc7974245b5b68b1a5e38841a379a 100755 (executable)
--- 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++;
        }