hedgewars/uAIActions.pas
changeset 7442 9bb6abdb5675
parent 7433 c7fff3e61d49
child 7671 43f38923bc6e
--- a/hedgewars/uAIActions.pas	Fri Jul 13 16:39:20 2012 +0400
+++ b/hedgewars/uAIActions.pas	Thu Jul 26 21:56:47 2012 +0400
@@ -44,6 +44,7 @@
     aia_Wait       = $8009;
     aia_Put        = $800A;
     aia_waitAngle  = $800B;
+    aia_waitAmmoXY = $800C;
     
     aim_push       = $8000;
     aim_release    = $8001;
@@ -115,19 +116,19 @@
 
 procedure AddAction(var Actions: TActions; Action: Longword; Param: LongInt; TimeDelta: Longword; X, Y: LongInt);
 begin
-with Actions do
-    begin
-    actions[Count].Action:= Action;
-    actions[Count].Param:= Param;
-    actions[Count].X:= X;
-    actions[Count].Y:= Y;
-    if Count > 0 then
-        actions[Count].Time:= TimeDelta
-    else
-        actions[Count].Time:= GameTicks + TimeDelta;
-    inc(Count);
-    TryDo(Count < MAXACTIONS, 'AI: actions overflow', true);
-    end
+if Actions.Count < MAXACTIONS then
+    with Actions do
+        begin
+        actions[Count].Action:= Action;
+        actions[Count].Param:= Param;
+        actions[Count].X:= X;
+        actions[Count].Y:= Y;
+        if Count > 0 then
+            actions[Count].Time:= TimeDelta
+        else
+            actions[Count].Time:= GameTicks + TimeDelta;
+        inc(Count);
+        end
 end;
 
 procedure CheckHang(Me: PGear);
@@ -234,6 +235,10 @@
                 
             aia_waitAngle:
                 if Me^.Angle <> Abs(Param) then exit;
+
+            aia_waitAmmoXY:
+                if (CurAmmoGear <> nil) and ((hwRound(CurAmmoGear^.X) <> X) or (hwRound(CurAmmoGear^.Y) <> Y)) then exit;
+
             end
         else
             begin