hedgewars/uGame.pas
changeset 72 aeb2ac1878dc
parent 32 78bff13b11c0
child 74 42257fee61ae
equal deleted inserted replaced
71:5f56c6979496 72:aeb2ac1878dc
    39 procedure DoGameTick(Lag: integer);
    39 procedure DoGameTick(Lag: integer);
    40 
    40 
    41 ////////////////////
    41 ////////////////////
    42    implementation
    42    implementation
    43 ////////////////////
    43 ////////////////////
    44 uses uMisc, uConsts, uWorld, uKeys, uTeams, uIO, uAI, uGears;
    44 uses uMisc, uConsts, uWorld, uKeys, uTeams, uIO, uAI, uGears, uConsole;
    45 
    45 
    46 procedure DoGameTick(Lag: integer);
    46 procedure DoGameTick(Lag: integer);
    47 const SendEmptyPacketTicks: LongWord = 0;
    47 const SendEmptyPacketTicks: LongWord = 0;
    48 var i: integer;
    48 var i: integer;
    49 begin
    49 begin
    61       SendEmptyPacketTicks:= 0
    61       SendEmptyPacketTicks:= 0
    62       end;
    62       end;
    63    inc(SendEmptyPacketTicks, Lag)
    63    inc(SendEmptyPacketTicks, Lag)
    64    end;
    64    end;
    65 
    65 
    66 if Lag > 100 then Lag:= 100;
    66 if Lag > 100 then Lag:= 100
       
    67 else if GameType = gmtSave then Lag:= 1000;
    67 
    68 
    68 for i:= 1 to Lag do
    69 for i:= 1 to Lag do
    69     if not CurrentTeam.ExtDriven then
    70     if not CurrentTeam.ExtDriven then
    70        begin
    71        begin
    71        with CurrentTeam^ do
    72        with CurrentTeam^ do
    76        NetGetNextCmd;
    77        NetGetNextCmd;
    77        if isInLag then
    78        if isInLag then
    78           case GameType of
    79           case GameType of
    79                gmtNet: break;
    80                gmtNet: break;
    80                gmtDemo: begin
    81                gmtDemo: begin
    81                         SendIPC('q');
    82                         ParseCommand('/quit');
    82                         GameState:= gsExit;
    83                         GameState:= gsExit;
    83                         exit
    84                         exit
    84                         end
    85                         end;
       
    86                gmtSave: begin
       
    87                         RestoreTeamsFromSave;
       
    88                         isSoundEnabled:= isSEBackup;
       
    89                         GameType:= gmtLocal
       
    90                         end;
    85                end
    91                end
    86           else ProcessGears
    92           else ProcessGears
    87        end;
    93        end;
    88 if not CurrentTeam.ExtDriven then isInLag:= false;
    94 if not CurrentTeam.ExtDriven then isInLag:= false;
    89 
    95