hedgewars/uAIActions.pas
changeset 194 88652abdce9a
parent 193 56885ea29202
child 195 edae828322a0
equal deleted inserted replaced
193:56885ea29202 194:88652abdce9a
   113 end;
   113 end;
   114 
   114 
   115 procedure ProcessAction(var Actions: TActions; Me: PGear);
   115 procedure ProcessAction(var Actions: TActions; Me: PGear);
   116 var s: shortstring;
   116 var s: shortstring;
   117 begin
   117 begin
       
   118 repeat
   118 if Actions.Pos >= Actions.Count then exit;
   119 if Actions.Pos >= Actions.Count then exit;
   119 with Actions.actions[Actions.Pos] do
   120 with Actions.actions[Actions.Pos] do
   120      begin
   121      begin
   121      if Time > GameTicks then exit;
   122      if Time > GameTicks then exit;
   122      {$IFDEF TRACEAIACTIONS}
   123      {$IFDEF TRACEAIACTIONS}
   151                           end else ParseCommand('-right');
   152                           end else ParseCommand('-right');
   152         aia_AwareExpl: AwareOfExplosion(X, Y, Param);
   153         aia_AwareExpl: AwareOfExplosion(X, Y, Param);
   153             aia_HJump: ParseCommand('hjump');
   154             aia_HJump: ParseCommand('hjump');
   154             aia_LJump: ParseCommand('ljump');
   155             aia_LJump: ParseCommand('ljump');
   155              aia_Skip: ParseCommand('skip');
   156              aia_Skip: ParseCommand('skip');
   156              aia_Wait: if Param > GameTicks then exit
       
   157                           else with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do
       
   158                                     Gear.State:= Gear.State and not gstHHThinking
       
   159              end else
   157              end else
   160         begin
   158         begin
   161         s:= ActionIdToStr[Action];
   159         s:= ActionIdToStr[Action];
   162         if (Param and ai_specmask) <> 0 then
   160         if (Param and ai_specmask) <> 0 then
   163            case Param of
   161            case Param of
   168         ParseCommand(s)
   166         ParseCommand(s)
   169         end
   167         end
   170      end;
   168      end;
   171 inc(Actions.Pos);
   169 inc(Actions.Pos);
   172 if Actions.Pos <= Actions.Count then
   170 if Actions.Pos <= Actions.Count then
   173    inc(Actions.actions[Actions.Pos].Time, GameTicks)
   171    inc(Actions.actions[Actions.Pos].Time, GameTicks);
       
   172 until false
   174 end;
   173 end;
   175 
   174 
   176 end.
   175 end.