hedgewars/uAI.pas
changeset 506 0889d833d47e
parent 500 d9b140e9d2c2
child 507 38ee23c7c8c2
equal deleted inserted replaced
505:fcba7d7aea0d 506:0889d833d47e
    23 procedure ProcessBot;
    23 procedure ProcessBot;
    24 procedure FreeActionsList;
    24 procedure FreeActionsList;
    25 
    25 
    26 implementation
    26 implementation
    27 uses uTeams, uConsts, SDLh, uAIMisc, uGears, uAIAmmoTests, uAIActions, uMisc,
    27 uses uTeams, uConsts, SDLh, uAIMisc, uGears, uAIAmmoTests, uAIActions, uMisc,
    28      uAmmos, uConsole{$IFDEF UNIX}, cthreads{$ENDIF};
    28      uAmmos, uConsole, uCollisions{$IFDEF UNIX}, cthreads{$ENDIF};
    29 
    29 
    30 var BestActions: TActions;
    30 var BestActions: TActions;
    31     ThinkThread: THandle = 0;
    31     ThinkThread: THandle = 0;
    32     StopThinking: boolean;
    32     StopThinking: boolean;
    33     CanUseAmmo: array [TAmmoType] of boolean;
    33     CanUseAmmo: array [TAmmoType] of boolean;
   275 procedure StartThink(Me: PGear);
   275 procedure StartThink(Me: PGear);
   276 var a: TAmmoType;
   276 var a: TAmmoType;
   277 begin
   277 begin
   278 if ((Me^.State and (gstAttacking or gstHHJumping or gstFalling or gstMoving)) <> 0)
   278 if ((Me^.State and (gstAttacking or gstHHJumping or gstFalling or gstMoving)) <> 0)
   279    or isInMultiShoot then exit;
   279    or isInMultiShoot then exit;
       
   280 
       
   281 DeleteCI(Me); // don't let collision info in Land to confuse AI
   280 Me^.State:= Me^.State or gstHHThinking;
   282 Me^.State:= Me^.State or gstHHThinking;
   281 Me^.Message:= 0;
   283 Me^.Message:= 0;
   282 StopThinking:= false;
   284 StopThinking:= false;
   283 ThinkingHH:= Me;
   285 ThinkingHH:= Me;
   284 FillTargets;
   286 FillTargets;