Fix sndBoring being placed if ending turn during multi-shoot via skip command
authorWuzzy <Wuzzy2@mail.ru>
Wed, 15 May 2019 20:40:37 +0200
changeset 14963 2d5f1dc637da
parent 14962 da7eb3414e02
child 14964 bcecb3349948
child 14970 6b5efc690472
Fix sndBoring being placed if ending turn during multi-shoot via skip command For example: - AI hog shoots once with shotgun - AI hog ends turn via ParseCommand("skip")
hedgewars/uGearsHedgehog.pas
hedgewars/uStats.pas
--- a/hedgewars/uGearsHedgehog.pas	Wed May 15 19:43:53 2019 +0200
+++ b/hedgewars/uGearsHedgehog.pas	Wed May 15 20:40:37 2019 +0200
@@ -1314,7 +1314,7 @@
     if TagTurnTimeLeft = 0 then
         TagTurnTimeLeft:= TurnTimeLeft;
     TurnTimeLeft:= 0;
-    if (GameOver = false) and ((GameFlags and gfInfAttack) = 0) and ((HHGear^.State and gstAttacked) = 0) and (HHGear^.Damage = 0) and (LuaNoEndTurnTaunts = false) then
+    if (GameOver = false) and ((GameFlags and gfInfAttack) = 0) and ((HHGear^.State and gstAttacked) = 0) and (HHGear^.Damage = 0) and (LuaNoEndTurnTaunts = false) and (uStats.getIsTurnSkipped() = false) then
         begin
         AddVoice(sndBoring, Hedgehog^.Team^.voicepack);
         if (GameFlags and gfInfAttack = 0) then
--- a/hedgewars/uStats.pas	Wed May 15 19:43:53 2019 +0200
+++ b/hedgewars/uStats.pas	Wed May 15 20:40:37 2019 +0200
@@ -42,6 +42,7 @@
 procedure HedgehogDamaged(Gear: PGear; Attacker: PHedgehog; Damage: Longword; killed: boolean);
 procedure TargetHit;
 procedure Skipped;
+function  getIsTurnSkipped: boolean;
 procedure TurnStats;
 procedure TurnReaction;
 procedure TurnStatsReset;
@@ -191,6 +192,11 @@
 isTurnSkipped:= true
 end;
 
+function getIsTurnSkipped: boolean;
+begin
+getIsTurnSkipped:= isTurnSkipped;
+end;
+
 procedure TurnStats;
 var i, t: LongInt;
     c: Longword;