hedgewars/uAIActions.pas
changeset 433 9f8f22094c0e
parent 393 db01cc79f278
child 543 465e2ec8f05f
equal deleted inserted replaced
432:b0f693024b50 433:9f8f22094c0e
    57 
    57 
    58 procedure AddAction(var Actions: TActions; Action: Longword; Param: LongInt; TimeDelta: Longword; X, Y: LongInt);
    58 procedure AddAction(var Actions: TActions; Action: Longword; Param: LongInt; TimeDelta: Longword; X, Y: LongInt);
    59 procedure ProcessAction(var Actions: TActions; Me: PGear);
    59 procedure ProcessAction(var Actions: TActions; Me: PGear);
    60 
    60 
    61 implementation
    61 implementation
    62 uses uMisc, uTeams, uConsts, uConsole, uAIMisc;
    62 uses uMisc, uTeams, uConsts, uConsole, uAIMisc, uAI;
    63 
    63 
    64 const ActionIdToStr: array[0..6] of string[16] = (
    64 const ActionIdToStr: array[0..6] of string[16] = (
    65 {aia_none}           '',
    65 {aia_none}           '',
    66 {aia_Left}           'left',
    66 {aia_Left}           'left',
    67 {aia_Right}          'right',
    67 {aia_Right}          'right',
   148            aia_Weapon: SetWeapon(TAmmoType(Param));
   148            aia_Weapon: SetWeapon(TAmmoType(Param));
   149            aia_WaitXL: if hwRound(Me^.X) = Param then Time:= GameTicks
   149            aia_WaitXL: if hwRound(Me^.X) = Param then Time:= GameTicks
   150                           else if hwRound(Me^.X) < Param then
   150                           else if hwRound(Me^.X) < Param then
   151                                begin
   151                                begin
   152                                OutError('AI: WaitXL assert', false);
   152                                OutError('AI: WaitXL assert', false);
   153                                Actions.Count:= 0
   153                                FreeActionsList;
       
   154                                exit
   154                                end
   155                                end
   155                           else begin CheckHang; exit end;
   156                           else begin CheckHang; exit end;
   156            aia_WaitXR: if hwRound(Me^.X) = Param then Time:= GameTicks
   157            aia_WaitXR: if hwRound(Me^.X) = Param then Time:= GameTicks
   157                           else if hwRound(Me^.X) > Param then
   158                           else if hwRound(Me^.X) > Param then
   158                                begin
   159                                begin
   159                                OutError('AI: WaitXR assert', false);
   160                                OutError('AI: WaitXR assert', false);
   160                                Actions.Count:= 0
   161                                FreeActionsList;
       
   162                                exit
   161                                end
   163                                end
   162                           else begin CheckHang; exit end;
   164                           else begin CheckHang; exit end;
   163          aia_LookLeft: if not Me^.dX.isNegative then
   165          aia_LookLeft: if not Me^.dX.isNegative then
   164                           begin
   166                           begin
   165                           ParseCommand('+left', true);
   167                           ParseCommand('+left', true);