Teleport AI:
authormbait
Thu, 06 May 2010 20:59:15 +0000
changeset 3439 a98984e4f458
parent 3438 670324167e42
child 3440 dee31c5149e0
Teleport AI: * fix indentation and remove tabs
hedgewars/uAIAmmoTests.pas
--- a/hedgewars/uAIAmmoTests.pas	Thu May 06 20:49:26 2010 +0000
+++ b/hedgewars/uAIAmmoTests.pas	Thu May 06 20:59:15 2010 +0000
@@ -644,36 +644,36 @@
 
 function TestTeleport(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
 var
-  i, failNum: longword;
-  maxTop: longword;
+    i, failNum: longword;
+    maxTop: longword;
 begin
-  TestTeleport := BadTurn;
-  Level:= Level; // avoid compiler hint
-  FillBonuses(true, [gtCase]);
-  if bonuses.Count = 0 then begin
-    if Me^.Health <= 100  then begin
-	  maxTop := Targ.Y - cHHRadius * 2; 
-	  while(not TestColl(Targ.X, maxTop, cHHRadius) and (maxTop > topY + cHHRadius * 2 + 1)) do
-	  	dec(maxTop, cHHRadius*2);
-	  if(not TestColl(Targ.X, maxTop + cHHRadius, cHHRadius)) then begin
-        ap.AttackPutX := Targ.X;
-        ap.AttackPutY := maxTop + cHHRadius;
-        TestTeleport := Targ.Y - maxTop;
-	  end;
+    TestTeleport := BadTurn;
+    Level:= Level; // avoid compiler hint
+    FillBonuses(true, [gtCase]);
+    if bonuses.Count = 0 then begin
+        if Me^.Health <= 100  then begin
+            maxTop := Targ.Y - cHHRadius * 2; 
+            while not TestColl(Targ.X, maxTop, cHHRadius) and (maxTop > topY + cHHRadius * 2 + 1) do
+            dec(maxTop, cHHRadius*2);
+            if not TestColl(Targ.X, maxTop + cHHRadius, cHHRadius) then begin
+                ap.AttackPutX := Targ.X;
+                ap.AttackPutY := maxTop + cHHRadius;
+                TestTeleport := Targ.Y - maxTop;
+            end;
+        end;
     end
-  end
-  else begin
-	failNum := 0;
-    repeat 
-		i := random(bonuses.Count);
-		inc(failNum);
-	until(not TestColl(bonuses.ar[i].X, bonuses.ar[i].Y - cHHRadius - bonuses.ar[i].Radius, cHHRadius) or (failNum = bonuses.Count*2));
-	if failNum < bonuses.Count*2 then begin
-	  ap.AttackPutX := bonuses.ar[i].X;
-	  ap.AttackPutY := bonuses.ar[i].Y - cHHRadius - bonuses.ar[i].Radius;
-	  TestTeleport := 0;
-	end
-  end;
+    else begin
+        failNum := 0;
+        repeat 
+            i := random(bonuses.Count);
+            inc(failNum);
+        until not TestColl(bonuses.ar[i].X, bonuses.ar[i].Y - cHHRadius - bonuses.ar[i].Radius, cHHRadius) or (failNum = bonuses.Count*2);
+        if failNum < bonuses.Count*2 then begin
+            ap.AttackPutX := bonuses.ar[i].X;
+            ap.AttackPutY := bonuses.ar[i].Y - cHHRadius - bonuses.ar[i].Radius;
+            TestTeleport := 0;
+        end;
+    end;
 end;
 
 end.