From: terencehill Date: Sat, 3 Sep 2016 18:49:23 +0000 (+0200) Subject: Make sure to send correctly encoded ping values X-Git-Tag: xonotic-v0.8.2~621 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d96d5e5d37835ff0703df203274c1e764ec6661a;p=xonotic%2Fxonotic-data.pk3dir.git Make sure to send correctly encoded ping values --- diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index e3bc70697..fe7822bc1 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -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))