hedgewars/uStats.pas
changeset 13766 6fd56a26e8b8
parent 13763 b1177e9c9ee9
child 13770 3d2a7c563d8e
--- a/hedgewars/uStats.pas	Tue Sep 04 16:52:51 2018 +0200
+++ b/hedgewars/uStats.pas	Tue Sep 04 17:57:48 2018 +0200
@@ -42,6 +42,7 @@
 procedure Skipped;
 procedure TurnStats;
 procedure TurnReaction;
+procedure TurnStatsReset;
 procedure SendStats;
 procedure hedgehogFlight(Gear: PGear; time: Longword);
 procedure declareAchievement(id, teamname, location: shortstring; value: LongInt);
@@ -157,11 +158,6 @@
                     MaxStepDamageGiven:= StepDamageGiven;
                 if StepKills > MaxStepKills then
                     MaxStepKills:= StepKills;
-                StepKills:= 0;
-                StepDamageRecv:= 0;
-                StepDamageGiven:= 0;
-                StepPoisoned:= false;
-                StepDied:= false;
                 end;
 
 // Write into the death log which clans died in this turn,
@@ -198,16 +194,6 @@
     ClanDeathLog:= newEntry;
     end;
 
-Kills:= 0;
-KillsClan:= 0;
-DamageClan:= 0;
-DamageTurn:= 0;
-HitTargets:= 0;
-PoisonClan:= 0;
-PoisonTurn:= 0;
-AmmoUsedCount:= 0;
-AmmoDamagingUsed:= false;
-isTurnSkipped:= false;
 end;
 
 procedure TurnReaction;
@@ -284,6 +270,33 @@
     end;
 end;
 
+procedure TurnStatsReset;
+var t, i: LongInt;
+begin
+for t:= 0 to Pred(TeamsCount) do // send even on zero turn
+    with TeamsArray[t]^ do
+        for i:= 0 to cMaxHHIndex do
+            with Hedgehogs[i].stats do
+                begin
+                StepKills:= 0;
+                StepDamageRecv:= 0;
+                StepDamageGiven:= 0;
+                StepPoisoned:= false;
+                StepDied:= false;
+                end;
+
+Kills:= 0;
+KillsClan:= 0;
+DamageClan:= 0;
+DamageTurn:= 0;
+HitTargets:= 0;
+PoisonClan:= 0;
+PoisonTurn:= 0;
+AmmoUsedCount:= 0;
+AmmoDamagingUsed:= false;
+isTurnSkipped:= false;
+end;
+
 procedure AmmoUsed(am: TAmmoType);
 begin
 inc(AmmoUsedCount);