]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Avoid division by zero on latency calculation (real clients only)
authorSamual Lenks <samual@xonotic.org>
Mon, 31 Dec 2012 18:50:06 +0000 (13:50 -0500)
committerSamual Lenks <samual@xonotic.org>
Mon, 31 Dec 2012 18:50:06 +0000 (13:50 -0500)
qcsrc/server/playerstats.qc

index a95eed67ad7fa0ce4b970394cd08cf5473d0b849..41af3015798d5fc167e97d36c257df040299e3d7 100644 (file)
@@ -377,8 +377,14 @@ void PlayerStats_EndMatch(float finished)
                if((g_arena || g_lms || g_ca) && (p.alivetime <= 0)) { continue; }
                else if(p.classname != "player") { continue; }
 
-               float latency = (p.latency_sum / p.latency_cnt);
-               if(latency) { PlayerStats_Event(p, PLAYERSTATS_AVGLATENCY, latency); }
+               if(clienttype(p) == CLIENTTYPE_REAL)
+               {
+                       if(p.latency_cnt)
+                       {
+                               float latency = (p.latency_sum / p.latency_cnt);
+                               if(latency) { PlayerStats_Event(p, PLAYERSTATS_AVGLATENCY, latency); }
+                       }
+               }
                
                PlayerScore_PlayerStats(p);
                PlayerStats_Event(p, PLAYERSTATS_SCOREBOARD_VALID, 1);