]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make sure to send correctly encoded ping values
authorterencehill <piuntn@gmail.com>
Sat, 3 Sep 2016 18:49:23 +0000 (20:49 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 3 Sep 2016 18:49:23 +0000 (20:49 +0200)
qcsrc/server/g_world.qc

index e3bc706979607a7aa99c1e7a6203027cd67dd417..fe7822bc161549c5ab9f45a93eb5b61d6df24aad 100644 (file)
@@ -56,9 +56,9 @@ void PingPLReport_Think(entity this)
        {
                WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT);
                WriteByte(MSG_BROADCAST, this.cnt);
-               WriteShort(MSG_BROADCAST, max(1, e.ping));
-               WriteByte(MSG_BROADCAST, ceil(e.ping_packetloss * 255));
-               WriteByte(MSG_BROADCAST, ceil(e.ping_movementloss * 255));
+               WriteShort(MSG_BROADCAST, bound(1, e.ping, 65535));
+               WriteByte(MSG_BROADCAST, min(ceil(e.ping_packetloss * 255), 255));
+               WriteByte(MSG_BROADCAST, min(ceil(e.ping_movementloss * 255), 255));
 
                // record latency times for clients throughout the match so we can report it to playerstats
                if(time > (e.latency_time + LATENCY_THINKRATE))