hedgewars/uAI.pas
changeset 15632 25132742a948
parent 15603 ac44dae6425e
child 15636 34c32a11203e
equal deleted inserted replaced
15631:b2ed495a7fb1 15632:25132742a948
   504                 else
   504                 else
   505                     AddAction(BestActions, aia_Skip, 0, 250, 0, 0);
   505                     AddAction(BestActions, aia_Skip, 0, 250, 0, 0);
   506             Me^.AIHints := ME^.AIHints and (not aihAmmosChanged);
   506             Me^.AIHints := ME^.AIHints and (not aihAmmosChanged);
   507             end;
   507             end;
   508 
   508 
   509         end else SDL_Delay(100)
   509         end
       
   510     else
       
   511         begin
       
   512         // No target found, skip turn
       
   513         BestActions.Count:= 0;
       
   514         AddAction(BestActions, aia_Skip, 0, 250, 0, 0);
       
   515         Me^.AIHints := ME^.AIHints and (not aihAmmosChanged);
       
   516         end
   510 else
   517 else
   511     begin
   518     begin
   512     BackMe:= Me^;
   519     BackMe:= Me^;
   513     i:= 4;
   520     i:= 4;
   514     while (not StopThinking) and (BestActions.Count = 0) and (i > 0) do
   521     while (not StopThinking) and (BestActions.Count = 0) and (i > 0) do
   557 
   564 
   558 StopThinking:= false;
   565 StopThinking:= false;
   559 ThinkingHH:= Me;
   566 ThinkingHH:= Me;
   560 
   567 
   561 FillTargets;
   568 FillTargets;
   562 if Targets.Count = 0 then
       
   563     begin
       
   564     OutError('AI: no targets!?', false);
       
   565     exit
       
   566     end;
       
   567 
   569 
   568 FillBonuses(((Me^.State and gstAttacked) <> 0) and (not isInMultiShoot) and ((GameFlags and gfInfAttack) = 0));
   570 FillBonuses(((Me^.State and gstAttacked) <> 0) and (not isInMultiShoot) and ((GameFlags and gfInfAttack) = 0));
   569 
   571 
   570 ThinkThread:= SDL_CreateThread(@Think, PChar('think'), Me);
   572 ThinkThread:= SDL_CreateThread(@Think, PChar('think'), Me);
   571 SDL_DetachThread(ThinkThread);
   573 SDL_DetachThread(ThinkThread);