]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Reset weapon accuracy on readyrestart
authorterencehill <piuntn@gmail.com>
Fri, 10 Dec 2021 15:39:28 +0000 (16:39 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 10 Dec 2021 15:39:28 +0000 (16:39 +0100)
qcsrc/server/command/vote.qc
qcsrc/server/weapons/accuracy.qc
qcsrc/server/weapons/accuracy.qh

index ffc81c4685794480cf749cea7b87129134b8de71..71fb0902b3f22d390bada64e0728802111be9794 100644 (file)
@@ -441,7 +441,10 @@ void ReadyRestart_force()
        game_starttime = time + RESTART_COUNTDOWN;
 
        // clear player attributes
-       FOREACH_CLIENT(IS_PLAYER(it), {
+       FOREACH_CLIENT(true, {
+               accuracy_reset(it);
+               if (!IS_PLAYER(it))
+                       continue;
                it.alivetime = 0;
                CS(it).killcount = 0;
                float val = PlayerStats_GameReport_Event_Player(it, PLAYERSTATS_ALIVETIME, 0);
index 2fe010f645c0c9a2c953df6c875cf50d0351c5c2..337ae54a98c86d4b889bb03da4b1cac0439116ee 100644 (file)
@@ -55,6 +55,21 @@ void accuracy_free(entity e)
        delete(CS(e).accuracy);
 }
 
+void accuracy_reset(entity e)
+{
+       entity a = CS(e).accuracy;
+       if (!a) return;
+
+       for (int i = 0; i < REGISTRY_MAX(Weapons); i++)
+       {
+               a.accuracy_frags[i] = 0;
+               a.accuracy_hit[i] = 0;
+               a.accuracy_fired[i] = 0;
+               a.accuracy_cnt_hit[i] = 0;
+               a.accuracy_cnt_fired[i] = 0;
+       }
+}
+
 // force a resend of a player's accuracy stats
 void accuracy_resend(entity e)
 {
index fcdf7c481ae3a185f2c81067be1cbd3c6560c606..81d2b1763bfe4c8e9f82b408cf61be22c60ee314 100644 (file)
@@ -38,6 +38,8 @@ REPLICATE(cvar_cl_accuracy_data_receive, bool, "cl_accuracy_data_receive");
 void accuracy_init(entity e);
 void accuracy_free(entity e);
 
+void accuracy_reset(entity e);
+
 // force a resend of a player's accuracy stats
 void accuracy_resend(entity e);