From: Rudolf Polzer Date: Mon, 3 Oct 2011 16:46:45 +0000 (+0200) Subject: player stats: include accuracy for ALL players, not just those playing at the end X-Git-Tag: xonotic-v0.6.0~40^2~101^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3fbc65fe1dae027f4265fa678348fe2bc57976c4;p=xonotic%2Fxonotic-data.pk3dir.git player stats: include accuracy for ALL players, not just those playing at the end --- diff --git a/qcsrc/server/playerstats.qc b/qcsrc/server/playerstats.qc index 35ad9b6185..b55861e91c 100644 --- a/qcsrc/server/playerstats.qc +++ b/qcsrc/server/playerstats.qc @@ -295,6 +295,26 @@ void PlayerStats_Shutdown() } //#NO AUTOCVARS END +void PlayerStats_Accuracy(entity p) +{ + entity a, w; + a = p.accuracy; + float i; + + for(i = WEP_FIRST; i <= WEP_LAST; ++i) + { + w = get_weaponinfo(i); + + PlayerStats_Event(p, strcat("acc-", w.netname, "-hit"), a.(accuracy_hit[i-1])); + PlayerStats_Event(p, strcat("acc-", w.netname, "-fired"), a.(accuracy_fired[i-1])); + + PlayerStats_Event(p, strcat("acc-", w.netname, "-cnt-hit"), a.(accuracy_cnt_hit[i-1])); + PlayerStats_Event(p, strcat("acc-", w.netname, "-cnt-fired"), a.(accuracy_cnt_fired[i-1])); + + PlayerStats_Event(p, strcat("acc-", w.netname, "-frags"), a.(accuracy_frags[i-1])); + } +} + void PlayerStats_AddGlobalInfo(entity p) { if(playerstats_db < 0) @@ -321,30 +341,12 @@ void PlayerStats_AddGlobalInfo(entity p) if(stof(db_get(playerstats_db, sprintf("%d:%s", p.playerstats_id, PLAYERSTATS_ALIVETIME))) > 0) PlayerStats_Event(p, PLAYERSTATS_JOINS, 1); + PlayerStats_Accuracy(p); + strunzone(p.playerstats_id); p.playerstats_id = string_null; } -void PlayerStats_Accuracy(entity p) -{ - entity a, w; - a = p.accuracy; - float i; - - for(i = WEP_FIRST; i <= WEP_LAST; ++i) - { - w = get_weaponinfo(i); - - PlayerStats_Event(p, strcat("acc-", w.netname, "-hit"), a.(accuracy_hit[i-1])); - PlayerStats_Event(p, strcat("acc-", w.netname, "-fired"), a.(accuracy_fired[i-1])); - - PlayerStats_Event(p, strcat("acc-", w.netname, "-cnt-hit"), a.(accuracy_cnt_hit[i-1])); - PlayerStats_Event(p, strcat("acc-", w.netname, "-cnt-fired"), a.(accuracy_cnt_fired[i-1])); - - PlayerStats_Event(p, strcat("acc-", w.netname, "-frags"), a.(accuracy_frags[i-1])); - } -} - void PlayerStats_EndMatch(float finished) { entity p, winner;