hedgewars/uAI.pas
branchhedgeroid
changeset 5495 272ed78e59a7
parent 5399 cdef954f8aec
parent 5396 4a0a8f32b7e3
child 5504 96d735b83d43
equal deleted inserted replaced
5479:b9aed3de7c27 5495:272ed78e59a7
    72     if (Targets.ar[i].Score >= 0) and (not StopThinking) then
    72     if (Targets.ar[i].Score >= 0) and (not StopThinking) then
    73        begin
    73        begin
    74        with CurrentHedgehog^ do
    74        with CurrentHedgehog^ do
    75             a:= CurAmmoType;
    75             a:= CurAmmoType;
    76        aa:= a;
    76        aa:= a;
       
    77        
       
    78        ThreadSwitch();
       
    79        
    77        repeat
    80        repeat
    78         if (CanUseAmmo[a]) and
    81         if (CanUseAmmo[a]) and
    79            ((not isMoved) or ((AmmoTests[a].flags and amtest_OnTurn) = 0)) then
    82            ((not isMoved) or ((AmmoTests[a].flags and amtest_OnTurn) = 0)) then
    80            begin
    83            begin
    81 {$HINTS OFF}
    84 {$HINTS OFF}
   277 if (PGear(Me)^.State and gstAttacked) = 0 then
   280 if (PGear(Me)^.State and gstAttacked) = 0 then
   278    if Targets.Count > 0 then
   281    if Targets.Count > 0 then
   279       begin
   282       begin
   280       WalkMe:= BackMe;
   283       WalkMe:= BackMe;
   281       Walk(@WalkMe);
   284       Walk(@WalkMe);
   282       if (StartTicks > GameTicks - 1500) and not StopThinking then SDL_Delay(2000);
   285       if (StartTicks > GameTicks - 1500) and not StopThinking then SDL_Delay(1000);
   283       if BestActions.Score < -1023 then
   286       if BestActions.Score < -1023 then
   284          begin
   287          begin
   285          addfilelog('AI: best score ' + inttostr(bestactions.score));
       
   286          BestActions.Count:= 0;
   288          BestActions.Count:= 0;
   287          AddAction(BestActions, aia_Skip, 0, 250, 0, 0);
   289          AddAction(BestActions, aia_Skip, 0, 250, 0, 0);
   288          end;
   290          end;
   289       end else
   291       end else
   290 else begin
   292 else begin