hedgewars/uAI.pas
changeset 6748 9d8763deee42
parent 6700 e04da46ee43c
child 6770 7d2c6cdb816a
equal deleted inserted replaced
6747:3f85b103f29f 6748:9d8763deee42
   116 BotLevel:= Me^.Hedgehog^.BotLevel;
   116 BotLevel:= Me^.Hedgehog^.BotLevel;
   117 
   117 
   118 for i:= 0 to Pred(Targets.Count) do
   118 for i:= 0 to Pred(Targets.Count) do
   119     if (Targets.ar[i].Score >= 0) and (not StopThinking) then
   119     if (Targets.ar[i].Score >= 0) and (not StopThinking) then
   120         begin
   120         begin
   121         with CurrentHedgehog^ do
   121         with Me^.Hedgehog^ do
   122             a:= CurAmmoType;
   122             a:= CurAmmoType;
   123         aa:= a;
   123         aa:= a;
   124 {$IFDEF USE_SDLTHREADS}
   124 {$IFDEF USE_SDLTHREADS}
   125         SDL_delay(0);    //ThreadSwitch was only a hint
   125         SDL_delay(0);    //ThreadSwitch was only a hint
   126 {$ELSE}
   126 {$ELSE}
   332             // find another hog in team
   332             // find another hog in team
   333             repeat
   333             repeat
   334                 itHedgehog:= Succ(itHedgehog) mod CurrentTeam^.HedgehogsNumber;
   334                 itHedgehog:= Succ(itHedgehog) mod CurrentTeam^.HedgehogsNumber;
   335             until (itHedgehog = currHedgehogIndex) or (CurrentTeam^.Hedgehogs[itHedgehog].Gear <> nil);
   335             until (itHedgehog = currHedgehogIndex) or (CurrentTeam^.Hedgehogs[itHedgehog].Gear <> nil);
   336 
   336 
       
   337 
   337             inc(switchesNum);
   338             inc(switchesNum);
   338         until (not (switchImmediatelyAvailable or switchAvailable))
   339         until (not (switchImmediatelyAvailable or switchAvailable))
   339             or StopThinking 
   340             or StopThinking 
   340             or (itHedgehog = currHedgehogIndex)
   341             or (itHedgehog = currHedgehogIndex)
   341             or BestActions.isWalkingToABetterPlace;
   342             or BestActions.isWalkingToABetterPlace;