Fix team stats screwing up if game ends due to drowning in rising Sudden Death water
--- a/hedgewars/uGears.pas Wed Sep 12 19:51:45 2018 +0300
+++ b/hedgewars/uGears.pas Sat Sep 15 15:26:23 2018 +0200
@@ -336,14 +336,18 @@
if TotalRoundsPre = cSuddenDTurns + 1 then
bWaterRising:= true;
if bWaterRising and (cWaterRise > 0) then
+ begin
+ bDuringWaterRise:= true;
AddGear(0, 0, gtWaterUp, 0, _0, _0, 0)^.Tag:= cWaterRise;
+ end;
inc(step)
end
- else // since we are not raising the water, a second win-check isn't needed
+ else // since we are not raising the water, another win-check isn't needed
inc(step,2);
stChWin3:
begin
CheckForWin;
+ bDuringWaterRise:= false;
inc(step)
end;
--- a/hedgewars/uTeams.pas Wed Sep 12 19:51:45 2018 +0300
+++ b/hedgewars/uTeams.pas Sat Sep 15 15:26:23 2018 +0200
@@ -76,11 +76,13 @@
TurnTimeLeft:= 0;
ReadyTimeLeft:= 0;
-// if the game ends during a multishot, do last TurnStats + TurnReaction
-if (not bBetweenTurns) and isInMultiShoot then
+// If the game ends during a multishot, or after the Sudden Death
+// water has risen, do last turn stats / reaction.
+if ((not bBetweenTurns) and isInMultiShoot) or (bDuringWaterRise) then
begin
TurnStats();
- TurnReaction();
+ if (not bDuringWaterRise) then
+ TurnReaction();
TurnStatsReset();
end;
--- a/hedgewars/uVariables.pas Wed Sep 12 19:51:45 2018 +0300
+++ b/hedgewars/uVariables.pas Sat Sep 15 15:26:23 2018 +0200
@@ -177,6 +177,7 @@
bBetweenTurns : boolean;
bWaterRising : boolean;
+ bDuringWaterRise: boolean;
CrosshairX : LongInt;
CrosshairY : LongInt;
@@ -2856,6 +2857,7 @@
flagDumpLand := false;
bBetweenTurns := false;
bWaterRising := false;
+ bDuringWaterRise:= false;
isCursorVisible := false;
isInLag := false;
isPaused := false;