Bot could use firepunch if it doesn't find anything else useful, and it has land above his head
authorunc0rr
Sun, 28 Sep 2008 15:45:37 +0000
changeset 1292 a63a13eda583
parent 1291 1332d0a8f871
child 1293 5943efa67299
Bot could use firepunch if it doesn't find anything else useful, and it has land above his head
hedgewars/uAIAmmoTests.pas
hedgewars/uLand.pas
--- a/hedgewars/uAIAmmoTests.pas	Sun Sep 28 15:39:38 2008 +0000
+++ b/hedgewars/uAIAmmoTests.pas	Sun Sep 28 15:45:37 2008 +0000
@@ -361,14 +361,25 @@
 ap.Time:= 0;
 ap.Power:= 1;
 ap.Angle:= 0;
-if (Abs(hwRound(Me^.X) - Targ.X) > 25) or (Abs(hwRound(Me^.Y) - 50 - Targ.Y) > 50) then
-   exit(BadTurn);
+if (Abs(hwRound(Me^.X) - Targ.X) > 25)
+or (Abs(hwRound(Me^.Y) - 50 - Targ.Y) > 50) then
+	begin
+	if TestColl(hwRound(Me^.Y), hwRound(Me^.Y) - 16, 6) then
+		Result:= 1
+	else
+		Result:= BadTurn;
+	exit(Result)
+	end;
 
 Result:= 0;
 for i:= 0 to 4 do
-    Result:= Result + RateShove(Me, hwRound(Me^.X) + 10 * hwSign(int2hwFloat(Targ.X) - Me^.X),
+	Result:= Result + RateShove(Me, hwRound(Me^.X) + 10 * hwSign(int2hwFloat(Targ.X) - Me^.X),
                                     hwRound(Me^.Y) - 20 * i - 5, 10, 30);
-if Result <= 0 then Result:= BadTurn else inc(Result);
+if Result <= 0 then
+	Result:= BadTurn
+else
+	inc(Result);
+
 TestFirePunch:= Result
 end;
 
--- a/hedgewars/uLand.pas	Sun Sep 28 15:39:38 2008 +0000
+++ b/hedgewars/uLand.pas	Sun Sep 28 15:45:37 2008 +0000
@@ -565,9 +565,7 @@
 end;
 
 procedure LoadMap;
-var x, y: Longword;
-    p: PByteArray;
-    tmpsurf: PSDL_Surface;
+var tmpsurf: PSDL_Surface;
 begin
 WriteLnToConsole('Loading land from file...');
 AddProgress;