From: Rudolf Polzer Date: Fri, 14 Jan 2011 22:27:48 +0000 (+0100) Subject: playerstats: properly handle different ways of match ending X-Git-Tag: xonotic-v0.5.0~318^2~116 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=aafe6ec8a5ca9a6f2a18e9b2922657264b28ac56;p=xonotic%2Fxonotic-data.pk3dir.git playerstats: properly handle different ways of match ending --- diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index b01d8515b..67fb91fc2 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1523,11 +1523,6 @@ void DumpStats(float final) fputs(file, ":end\n"); fclose(file); } - - // send statistics - FOR_EACH_CLIENT(e) - PlayerStats_AddGlobalInfo(e); - PlayerStats_Shutdown(); } void FixIntermissionClient(entity e) @@ -1595,7 +1590,13 @@ void NextLevel() VoteReset(); DumpStats(TRUE); - PlayerStats_EndMatch(); + + // send statistics + entity e; + PlayerStats_EndMatch(1); + FOR_EACH_CLIENT(e) + PlayerStats_AddGlobalInfo(e); + PlayerStats_Shutdown(); if(autocvar_sv_eventlog) GameLogEcho(":gameover"); @@ -2941,6 +2942,7 @@ void SV_Shutdown() print("Saving persistent data...\n"); Ban_SaveBans(); + PlayerStats_EndMatch(0); FOR_EACH_CLIENT(e) PlayerStats_AddGlobalInfo(e); PlayerStats_Shutdown(); diff --git a/qcsrc/server/playerstats.qc b/qcsrc/server/playerstats.qc index a8efa82c8..2d1e21912 100644 --- a/qcsrc/server/playerstats.qc +++ b/qcsrc/server/playerstats.qc @@ -179,13 +179,16 @@ void PlayerStats_AddGlobalInfo(entity p) p.playerstats_id = string_null; } -void PlayerStats_EndMatch() +void PlayerStats_EndMatch(float finished) { entity p; FOR_EACH_PLAYER(p) { PlayerScore_PlayerStats(p); - PlayerStats_Event(p, PLAYERSTATS_WINS, p.winning); - PlayerStats_Event(p, PLAYERSTATS_MATCHES, 1); + if(finished) + { + PlayerStats_Event(p, PLAYERSTATS_WINS, p.winning); + PlayerStats_Event(p, PLAYERSTATS_MATCHES, 1); + } } } diff --git a/qcsrc/server/playerstats.qh b/qcsrc/server/playerstats.qh index 1dea13ce7..5f765e211 100644 --- a/qcsrc/server/playerstats.qh +++ b/qcsrc/server/playerstats.qh @@ -30,4 +30,4 @@ void PlayerStats_Sent_URI_Get_Callback(float id, float status, string data); void PlayerStats_AddGlobalInfo(entity p); // call this at the end of the match -void PlayerStats_EndMatch() +void PlayerStats_EndMatch(float finished);