hedgewars/uAI.pas
changeset 740 5ac69a012b69
parent 676 2aa3082937ac
child 741 8bf8c0ac8d94
equal deleted inserted replaced
739:b6849ece8fee 740:5ac69a012b69
    50         if BotLevel <> 0 then
    50         if BotLevel <> 0 then
    51            begin
    51            begin
    52            if (Gear^.Message and gm_Left) <> 0 then ParseCommand('-left', true);
    52            if (Gear^.Message and gm_Left) <> 0 then ParseCommand('-left', true);
    53            if (Gear^.Message and gm_Right) <> 0 then ParseCommand('-right', true);
    53            if (Gear^.Message and gm_Right) <> 0 then ParseCommand('-right', true);
    54            end;
    54            end;
    55      
    55 
    56 BestActions.Count:= 0;
    56 BestActions.Count:= 0;
    57 BestActions.Pos:= 0
    57 BestActions.Pos:= 0
    58 end;
    58 end;
    59 
    59 
    60 procedure TestAmmos(var Actions: TActions; Me: PGear; isMoved: boolean);
    60 procedure TestAmmos(var Actions: TActions; Me: PGear; isMoved: boolean);
   323         and (TurnTimeLeft < cHedgehogTurnTime - 50) then
   323         and (TurnTimeLeft < cHedgehogTurnTime - 50) then
   324         if ((Gear^.State and gstHHThinking) = 0) then
   324         if ((Gear^.State and gstHHThinking) = 0) then
   325            if (BestActions.Pos >= BestActions.Count)
   325            if (BestActions.Pos >= BestActions.Count)
   326               and (TurnTimeLeft > cStopThinkTime) then
   326               and (TurnTimeLeft > cStopThinkTime) then
   327               begin
   327               begin
   328               TryDo(Gear^.Message = 0, 'Engine bug: AI may break demos playing', true);
   328               TryDo((Gear^.Message = 0) and (gameType <> gmtSave), 'Engine bug: AI may break demos playing', true);
   329               StartThink(Gear);
   329               StartThink(Gear);
   330               StartTicks:= GameTicks
   330               StartTicks:= GameTicks
   331               end else ProcessAction(BestActions, Gear)
   331               end else ProcessAction(BestActions, Gear)
   332         else if ((GameTicks - StartTicks) > cMaxAIThinkTime)
   332         else if ((GameTicks - StartTicks) > cMaxAIThinkTime)
   333                 or (TurnTimeLeft <= cStopThinkTime) then StopThinking:= true
   333                 or (TurnTimeLeft <= cStopThinkTime) then StopThinking:= true