Fix sndBoring being played when force-ending turn due to victory
authorWuzzy <almikes@aol.com>
Tue, 25 Apr 2017 04:54:46 +0200
changeset 12327 9aa483762025
parent 12326 1be56fa243c8
child 12328 7c04b4c4ffc2
Fix sndBoring being played when force-ending turn due to victory
hedgewars/uGears.pas
hedgewars/uGearsHedgehog.pas
hedgewars/uTeams.pas
hedgewars/uVariables.pas
--- a/hedgewars/uGears.pas	Tue Apr 25 02:50:28 2017 +0200
+++ b/hedgewars/uGears.pas	Tue Apr 25 04:54:46 2017 +0200
@@ -439,6 +439,7 @@
                 step:= stChDmg;
                 if TagTurnTimeLeft = 0 then
                     TagTurnTimeLeft:= TurnTimeLeft;
+                GameOver:= true;
                 TurnTimeLeft:= 0
                 end
             end
--- a/hedgewars/uGearsHedgehog.pas	Tue Apr 25 02:50:28 2017 +0200
+++ b/hedgewars/uGearsHedgehog.pas	Tue Apr 25 04:54:46 2017 +0200
@@ -1239,7 +1239,7 @@
     if TagTurnTimeLeft = 0 then
         TagTurnTimeLeft:= TurnTimeLeft;
     TurnTimeLeft:= 0;
-    if ((HHGear^.State and gstAttacked) = 0) and (HHGear^.Damage = 0) and (LuaNoEndTurnTaunts = false) then
+    if (GameOver = false) and ((HHGear^.State and gstAttacked) = 0) and (HHGear^.Damage = 0) and (LuaNoEndTurnTaunts = false) then
         begin
         AddVoice(sndBoring, Hedgehog^.Team^.voicepack);
         if (GameFlags and gfInfAttack = 0) then
--- a/hedgewars/uTeams.pas	Tue Apr 25 02:50:28 2017 +0200
+++ b/hedgewars/uTeams.pas	Tue Apr 25 04:54:46 2017 +0200
@@ -49,7 +49,7 @@
     uGearsUtils, uGearsList, uVisualGearsList, uTextures
     {$IFDEF USE_TOUCH_INTERFACE}, uTouch{$ENDIF};
 
-var GameOver: boolean;
+var TeamsGameOver: boolean;
     NextClan: boolean;
 
 function CheckForWin: boolean;
@@ -77,7 +77,7 @@
 if (not bBetweenTurns) and isInMultiShoot then
     TurnReaction();
 
-if not GameOver then
+if not TeamsGameOver then
     begin
     if AliveCount = 0 then
         begin // draw
@@ -118,6 +118,7 @@
             end;
     SendStats;
     end;
+TeamsGameOver:= true;
 GameOver:= true
 end;
 
--- a/hedgewars/uVariables.pas	Tue Apr 25 02:50:28 2017 +0200
+++ b/hedgewars/uVariables.pas	Tue Apr 25 04:54:46 2017 +0200
@@ -97,6 +97,7 @@
     TagTurnTimeLeft : Longword;
     ReadyTimeLeft   : Longword;
     IsGetAwayTime   : boolean;
+    GameOver        : boolean;
     cSuddenDTurns   : LongInt;
     cDamagePercent  : LongInt;
     cMineDudPercent : LongWord;
@@ -2729,6 +2730,7 @@
     RightImpactTimer    := 0;
     TurnTimeLeft        := 0;
     IsGetAwayTime       := false;
+    GameOver            := false;
     TurnClockActive     := true;
     TagTurnTimeLeft     := 0;
     cSuddenDTurns       := 15;