hedgewars/uGame.pas
changeset 351 29bc9c36ad5f
parent 281 5b483aa9f2ab
child 358 236bbd12d4d9
equal deleted inserted replaced
350:c3ccec3834e8 351:29bc9c36ad5f
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  *)
    17  *)
    18 
    18 
    19 unit uGame;
    19 unit uGame;
    20 interface
    20 interface
       
    21 uses uFloat;
    21 {$INCLUDE options.inc}
    22 {$INCLUDE options.inc}
    22 
    23 
    23 procedure DoGameTick(Lag: integer);
    24 procedure DoGameTick(Lag: integer);
    24 
    25 
    25 ////////////////////
    26 ////////////////////
    30 procedure DoGameTick(Lag: integer);
    31 procedure DoGameTick(Lag: integer);
    31 const SendEmptyPacketTicks: LongWord = 0;
    32 const SendEmptyPacketTicks: LongWord = 0;
    32 var i: integer;
    33 var i: integer;
    33 begin
    34 begin
    34 if isPaused then exit;
    35 if isPaused then exit;
    35 if not CurrentTeam.ExtDriven then
    36 if not CurrentTeam^.ExtDriven then
    36    begin
    37    begin
    37    NetGetNextCmd; // its for the case when receiving "/say" message
    38    NetGetNextCmd; // its for the case when receiving "/say" message
    38    isInLag:= false;
    39    isInLag:= false;
    39    inc(SendEmptyPacketTicks, Lag);
    40    inc(SendEmptyPacketTicks, Lag);
    40    if SendEmptyPacketTicks >= cSendEmptyPacketTime then
    41    if SendEmptyPacketTicks >= cSendEmptyPacketTime then
    47 else if GameType = gmtSave then Lag:= 2500;
    48 else if GameType = gmtSave then Lag:= 2500;
    48 
    49 
    49 i:= 1;
    50 i:= 1;
    50 while (GameState <> gsExit) and (i <= Lag) do
    51 while (GameState <> gsExit) and (i <= Lag) do
    51     begin
    52     begin
    52     if not CurrentTeam.ExtDriven then
    53     if not CurrentTeam^.ExtDriven then
    53        begin
    54        begin
    54        with CurrentTeam^ do
    55        with CurrentTeam^ do
    55            if Hedgehogs[CurrHedgehog].BotLevel <> 0 then ProcessBot(Frames);
    56            if Hedgehogs[CurrHedgehog].BotLevel <> 0 then ProcessBot(Frames);
    56        ProcessGears
    57        ProcessGears
    57        end else
    58        end else