Do not check games lasting for more than 3 hours
authorunc0rr
Mon, 14 Mar 2016 22:04:39 +0300
changeset 11605 dc8de75747f9
parent 11604 4df32636a4b2
child 11606 99966b4a6e1e
child 11608 ed70d59479d7
Do not check games lasting for more than 3 hours
hedgewars/uGame.pas
--- a/hedgewars/uGame.pas	Mon Mar 14 14:38:23 2016 +0100
+++ b/hedgewars/uGame.pas	Mon Mar 14 22:04:39 2016 +0300
@@ -31,6 +31,7 @@
      {$IFDEF USE_TOUCH_INTERFACE}, uTouch{$ENDIF}, uDebug;
 
 procedure DoGameTick(Lag: LongInt);
+const maxCheckedGameDuration = 3*60*60*1000;
 var i,j : LongInt;
     s: ansistring;
 begin
@@ -63,7 +64,15 @@
             else Lag:= Lag*80;
             end
         else if cOnlyStats then
-            Lag:= High(LongInt)
+            begin
+                if GameTicks >= maxCheckedGameDuration then
+                begin
+                    gameState:= gsExit;
+                    exit;
+                end;
+
+            Lag:= maxCheckedGameDuration + 60000;
+            end;
     end;
 
 if cTestLua then