X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fplayerstats.qc;h=e83305886cee1522ddbb5b8db4c11388ee59e0e7;hb=fbd3279e575e41377901f1536e14fe45e540405b;hp=6ffc506170a077d91b309fe7dd86a3afb1d7ba09;hpb=a4133baa73c78a12232ee297177451c729bede72;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/playerstats.qc b/qcsrc/common/playerstats.qc index 6ffc506170..e83305886c 100644 --- a/qcsrc/common/playerstats.qc +++ b/qcsrc/common/playerstats.qc @@ -40,8 +40,10 @@ void PlayerStats_GameReport_Reset_All() strfree(PS_GR_OUT_EVL); if (PS_GR_OUT_DB >= 0) + { db_close(PS_GR_OUT_DB); - PlayerStats_GameReport_Init(); + PlayerStats_GameReport_Init(); + } if(PS_GR_OUT_DB < 0) return; @@ -205,7 +207,13 @@ void PlayerStats_GameReport_FinalizePlayer(entity p) { float latency = max(0, CS(p).latency_sum / CS(p).latency_cnt); if(latency) - PlayerStats_GameReport_Event_Player(p, PLAYERSTATS_AVGLATENCY, latency); + { + // if previous average latency exists (player disconnected and reconnected) + // make the average of previous and current average latency + float prev_latency = PlayerStats_GameReport_Event_Player(p, PLAYERSTATS_AVGLATENCY, 0); + float new_latency = !prev_latency ? latency : (prev_latency + latency) / 2; + PlayerStats_GameReport_Event_Player(p, PLAYERSTATS_AVGLATENCY, -prev_latency + new_latency); + } } db_put(PS_GR_OUT_DB, sprintf("%s:_ranked", p.playerstats_id), ftos(CS_CVAR(p).cvar_cl_allow_uidranking)); @@ -364,6 +372,7 @@ void PlayerStats_GameReport_Handler(entity fh, entity pass, float status) * i: player index * n: nickname of the player (optional) * t: team ID + * r: player ranking enabled / disabled * e: followed by an event name, a space, and the event count/score * event names can be: * alivetime: total playing time of the player