]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/playerstats.qc
Assault: add a couple informational messages and fix various bugs related to the...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / playerstats.qc
index c11efed8b78af9868d79c635bc0761fe483e7c62..e648d29538ce507d0f524b780bc941b5e4e6f09f 100644 (file)
@@ -21,6 +21,47 @@ void PlayerStats_Prematch()
        //foobar
 }
 
+// Deletes current playerstats DB, creates a new one and fully initializes it
+void PlayerStats_GameReport_Reset_All()
+{
+       strfree(PS_GR_OUT_TL);
+       strfree(PS_GR_OUT_PL);
+       strfree(PS_GR_OUT_EVL);
+
+       if (PS_GR_OUT_DB >= 0)
+               db_close(PS_GR_OUT_DB);
+       PlayerStats_GameReport_Init();
+       if(PS_GR_OUT_DB < 0)
+               return;
+
+       for (int i = 0; i < 16; i++)
+               if (teamscorekeepers[i])
+                       PlayerStats_GameReport_AddTeam(i + 1);
+       FOREACH_CLIENT(true, {
+               // NOTE Adding back a player we are applying any cl_allow_uidtracking change
+               // usually only possible by reconnecting to the server
+               strfree(it.playerstats_id);
+               PlayerStats_GameReport_AddEvent(sprintf("kills-%d", it.playerid));
+               if (IS_BOT_CLIENT(it) || CS_CVAR(it).cvar_cl_allow_uidtracking)
+                       PlayerStats_GameReport_AddPlayer(it);
+       });
+       FOREACH(Scores, true, {
+               string label = scores_label(it);
+               if (label == "")
+                       continue;
+               PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_TOTAL, label));
+               PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_SCOREBOARD, label));
+       });
+       for(int i = 0; i < MAX_TEAMSCORE; ++i)
+       {
+               string label = teamscores_label(i);
+               if (label == "")
+                       continue;
+               PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_TOTAL, label));
+               PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_SCOREBOARD, label));
+       }
+}
+
 void PlayerStats_GameReport_AddPlayer(entity e)
 {
        if((PS_GR_OUT_DB < 0) || (e.playerstats_id)) { return; }