hedgewars/uAIActions.pas
changeset 4374 bcefeeabaa33
parent 4373 fe0e3903bb9e
child 4377 43945842da0c
equal deleted inserted replaced
4373:fe0e3903bb9e 4374:bcefeeabaa33
    60 
    60 
    61 procedure AddAction(var Actions: TActions; Action: Longword; Param: LongInt; TimeDelta: Longword; X, Y: LongInt);
    61 procedure AddAction(var Actions: TActions; Action: Longword; Param: LongInt; TimeDelta: Longword; X, Y: LongInt);
    62 procedure ProcessAction(var Actions: TActions; Me: PGear);
    62 procedure ProcessAction(var Actions: TActions; Me: PGear);
    63 
    63 
    64 implementation
    64 implementation
    65 uses uMisc, uAIMisc, uAI, uAmmos, uVariables, uCommands;
    65 uses uMisc, uAIMisc, uAI, uAmmos, uVariables, uCommands, uUtils;
    66 
    66 
    67 const ActionIdToStr: array[0..6] of string[16] = (
    67 const ActionIdToStr: array[0..6] of string[16] = (
    68 {aia_none}           '',
    68 {aia_none}           '',
    69 {aia_Left}           'left',
    69 {aia_Left}           'left',
    70 {aia_Right}          'right',
    70 {aia_Right}          'right',
    93 if (Action.Action and ai_specmask) = 0 then
    93 if (Action.Action and ai_specmask) = 0 then
    94    WriteLnToConsole('AI action: '+ActionIdToStr[Action.Action])
    94    WriteLnToConsole('AI action: '+ActionIdToStr[Action.Action])
    95 else begin
    95 else begin
    96    WriteLnToConsole('AI action: '+SpecActionIdToStr[Action.Action]);
    96    WriteLnToConsole('AI action: '+SpecActionIdToStr[Action.Action]);
    97    if (Action.Action = aia_WaitXL) or (Action.Action = aia_WaitXR) then
    97    if (Action.Action = aia_WaitXL) or (Action.Action = aia_WaitXR) then
    98       WriteLnToConsole('AI action Wait X = '+inttostr(Action.Param)+', current X = '+inttostr(hwRound(Me^.X)))
    98       WriteLnToConsole('AI action Wait X = '+IntToStr(Action.Param)+', current X = '+IntToStr(hwRound(Me^.X)))
    99    else if (Action.Action = aia_AwareExpl) then WriteLnToConsole('Aware X = ' + inttostr(Action.X) + ', Y = ' + inttostr(Action.Y));
    99    else if (Action.Action = aia_AwareExpl) then WriteLnToConsole('Aware X = ' + IntToStr(Action.X) + ', Y = ' + IntToStr(Action.Y));
   100    end
   100    end
   101 end;
   101 end;
   102 {$ENDIF}
   102 {$ENDIF}
   103 
   103 
   104 procedure AddAction(var Actions: TActions; Action: Longword; Param: LongInt; TimeDelta: Longword; X, Y: LongInt);
   104 procedure AddAction(var Actions: TActions; Action: Longword; Param: LongInt; TimeDelta: Longword; X, Y: LongInt);
   197         if (Param and ai_specmask) <> 0 then
   197         if (Param and ai_specmask) <> 0 then
   198            case Param of
   198            case Param of
   199              aim_push: s:= '+' + s;
   199              aim_push: s:= '+' + s;
   200           aim_release: s:= '-' + s;
   200           aim_release: s:= '-' + s;
   201              end
   201              end
   202           else if Param <> 0 then s:= s + ' ' + inttostr(Param);
   202           else if Param <> 0 then s:= s + ' ' + IntToStr(Param);
   203         ParseCommand(s, true)
   203         ParseCommand(s, true)
   204         end
   204         end
   205      end;
   205      end;
   206 inc(Actions.Pos);
   206 inc(Actions.Pos);
   207 if Actions.Pos <= Actions.Count then
   207 if Actions.Pos <= Actions.Count then