hedgewars/uGame.pas
changeset 2382 bfd378dfc4e7
parent 1727 bddbb2400c30
child 2579 e5e4ebf528b5
equal deleted inserted replaced
2381:959da8402cac 2382:bfd378dfc4e7
    29    implementation
    29    implementation
    30 ////////////////////
    30 ////////////////////
    31 uses uMisc, uConsts, uWorld, uKeys, uTeams, uIO, uAI, uGears, uConsole;
    31 uses uMisc, uConsts, uWorld, uKeys, uTeams, uIO, uAI, uGears, uConsole;
    32 
    32 
    33 procedure DoGameTick(Lag: LongInt);
    33 procedure DoGameTick(Lag: LongInt);
    34 const SendEmptyPacketTicks: LongWord = 0;
       
    35 var i: LongInt;
    34 var i: LongInt;
    36 begin
    35 begin
    37 if isPaused then exit;
    36 if isPaused then exit;
    38 if (not CurrentTeam^.ExtDriven) then
    37 if (not CurrentTeam^.ExtDriven) then
    39    begin
    38 	begin
    40    NetGetNextCmd; // its for the case of receiving "/say" message
    39 	NetGetNextCmd; // its for the case of receiving "/say" message
    41    isInLag:= false;
    40 	isInLag:= false;
    42    inc(SendEmptyPacketTicks, Lag);
    41 	SendKeepAliveMessage(Lag)
    43    if (SendEmptyPacketTicks >= cSendEmptyPacketTime) then
    42 	end;
    44       begin
       
    45       SendIPC('+');
       
    46       SendEmptyPacketTicks:= 0
       
    47       end
       
    48    end;
       
    49 if Lag > 100 then Lag:= 100
    43 if Lag > 100 then Lag:= 100
    50 else if (GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) then Lag:= 2500;
    44 else if (GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) then Lag:= 2500;
    51 if (GameType = gmtDemo) and isSpeed then Lag:= Lag * 10;
    45 if (GameType = gmtDemo) and isSpeed then Lag:= Lag * 10;
    52 
    46 
    53 i:= 1;
    47 i:= 1;