Don't spawn team widget sorter on each frame when in lag. Issue 'spectate 0' instead, and only on first lag occasion.
authorunc0rr
Wed, 18 Mar 2015 23:18:52 +0300
changeset 10862 4575977d3ce0
parent 10861 d84c725fe332
child 10863 9d3e1123bd43
Don't spawn team widget sorter on each frame when in lag. Issue 'spectate 0' instead, and only on first lag occasion.
hedgewars/uCommandHandlers.pas
hedgewars/uIO.pas
--- a/hedgewars/uCommandHandlers.pas	Wed Mar 18 23:13:37 2015 +0300
+++ b/hedgewars/uCommandHandlers.pas	Wed Mar 18 23:18:52 2015 +0300
@@ -27,6 +27,7 @@
 
 implementation
 uses uCommands, uTypes, uVariables, uIO, uDebug, uConsts, uScript, uUtils, SDLh, uWorld, uRandom, uCaptions
+    , uVisualGearsList
      {$IFDEF USE_VIDEO_RECORDING}, uVideoRec {$ENDIF};
 
 var prevGState: TGameState = gsConfirm;
@@ -776,7 +777,14 @@
 
 procedure chFastUntilLag(var s: shortstring);
 begin
-fastUntilLag:= StrToInt(s) <> 0
+    fastUntilLag:= StrToInt(s) <> 0;
+
+    if not fastUntilLag then
+    begin
+        // update health bars and the wind indicator
+        AddVisualGear(0, 0, vgtTeamHealthSorter);
+        AddVisualGear(0, 0, vgtSmoothWindBar)
+    end
 end;
 
 procedure chCampVar(var s:shortstring);
--- a/hedgewars/uIO.pas	Wed Mar 18 23:13:37 2015 +0300
+++ b/hedgewars/uIO.pas	Wed Mar 18 23:18:52 2015 +0300
@@ -435,7 +435,11 @@
 
 isInLag:= (headcmd = nil) and tmpflag and (not CurrentTeam^.hasGone);
 
-if isInLag then fastUntilLag:= false
+if isInLag and fastUntilLag then 
+begin
+    ParseCommand('spectate 0', true);
+    fastUntilLag:= false
+end;
 end;
 
 procedure chFatalError(var s: shortstring);