hedgewars/uAI.pas
changeset 936 ba582673db7d
parent 883 07a568ba44e0
child 941 b5222ddafe1f
equal deleted inserted replaced
935:f13a67ce3811 936:ba582673db7d
   327         and (TurnTimeLeft < cHedgehogTurnTime - 50) then
   327         and (TurnTimeLeft < cHedgehogTurnTime - 50) then
   328         if ((Gear^.State and gstHHThinking) = 0) then
   328         if ((Gear^.State and gstHHThinking) = 0) then
   329            if (BestActions.Pos >= BestActions.Count)
   329            if (BestActions.Pos >= BestActions.Count)
   330               and (TurnTimeLeft > cStopThinkTime) then
   330               and (TurnTimeLeft > cStopThinkTime) then
   331               begin
   331               begin
   332               TryDo(Gear^.Message = 0, 'Engine bug: AI may break demos playing', true);
   332               if Gear^.Message <> 0 then
       
   333                  begin
       
   334                  StopMessages(Gear^.Message);
       
   335                  TryDo((Gear^.Message and gmAllStoppable) = 0, 'Engine bug: AI may break demos playing', true);
       
   336                  end;
       
   337               if Gear^.Message <> 0 then exit;
   333               StartThink(Gear);
   338               StartThink(Gear);
   334               StartTicks:= GameTicks
   339               StartTicks:= GameTicks
   335               end else ProcessAction(BestActions, Gear)
   340               end else ProcessAction(BestActions, Gear)
   336         else if ((GameTicks - StartTicks) > cMaxAIThinkTime)
   341         else if ((GameTicks - StartTicks) > cMaxAIThinkTime)
   337                 or (TurnTimeLeft <= cStopThinkTime) then StopThinking:= true
   342                 or (TurnTimeLeft <= cStopThinkTime) then StopThinking:= true