# HG changeset patch
# User nemo
# Date 1331504912 14400
# Node ID 44ad49a3a126b6e8f7fb44c70cf43fc93d0277db
# Parent  a142cf8dbbd38a2b3cf6176f76c86484217ac55b
Add drowning to grenade too, try some little optimisations

diff -r a142cf8dbbd3 -r 44ad49a3a126 hedgewars/uAIAmmoTests.pas
--- a/hedgewars/uAIAmmoTests.pas	Sun Mar 11 23:31:32 2012 +0400
+++ b/hedgewars/uAIAmmoTests.pas	Sun Mar 11 18:28:32 2012 -0400
@@ -173,7 +173,7 @@
         valueResult:= value
         end;
     end
-until (rTime > 4250);
+until (value > 204800) or (rTime > 4250);
 TestBazooka:= valueResult
 end;
 
@@ -310,7 +310,9 @@
     EX:= hwRound(x);
     EY:= hwRound(y);
     if t < 50 then 
-        Score:= RateExplosion(Me, EX, EY, 101)
+        if Me^.Hedgehog^.BotLevel = 1 then
+            Score:= RateExplosion(Me, EX, EY, 101, 3)
+        else Score:= RateExplosion(Me, EX, EY, 101)
     else 
         Score:= BadTurn;
 
@@ -325,7 +327,7 @@
         valueResult:= Score
         end;
     end
-until (TestTime = 4000);
+until (Score > 204800) or (TestTime > 4000);
 TestGrenade:= valueResult
 end;
 
diff -r a142cf8dbbd3 -r 44ad49a3a126 hedgewars/uAIMisc.pas
--- a/hedgewars/uAIMisc.pas	Sun Mar 11 23:31:32 2012 +0400
+++ b/hedgewars/uAIMisc.pas	Sun Mar 11 18:28:32 2012 -0400
@@ -256,6 +256,7 @@
 var skipLandCheck: boolean;
     rCorner: real;
 begin
+    skipLandCheck:= true;
     if x - eX < 0 then dX*=-1;
     if y - eY < 0 then dY*=-1;
     // ok. attempt approximate search for an unbroken trajectory into water.  if it continues far enough, assume out of map
@@ -265,7 +266,7 @@
         x:= x + dX;
         y:= y + dY;
         dY:= dY + cGravityf;
-        skipLandCheck:= (r <> 0) and (abs(eX-x) + abs(eY-y) < r) and ((abs(eX-x) < rCorner) or (abs(eY-y) < rCorner));
+        skipLandCheck:= skipLandCheck and (r <> 0) and (abs(eX-x) + abs(eY-y) < r) and ((abs(eX-x) < rCorner) or (abs(eY-y) < rCorner));
         if not skipLandCheck and TestCollWithLand(trunc(x), trunc(y), cHHRadius) then exit(false);
         if (y > cWaterLine) or (x > 4096) or (x < 0) then exit(true);
         end;
diff -r a142cf8dbbd3 -r 44ad49a3a126 hedgewars/uGears.pas
--- a/hedgewars/uGears.pas	Sun Mar 11 23:31:32 2012 +0400
+++ b/hedgewars/uGears.pas	Sun Mar 11 18:28:32 2012 -0400
@@ -57,7 +57,7 @@
 
 implementation
 uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics,
-    uAIMisc, uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables,
+    uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables,
     uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture,
     uGearsHedgehog, uGearsUtils, uGearsList;
 
diff -r a142cf8dbbd3 -r 44ad49a3a126 hedgewars/uGearsUtils.pas
--- a/hedgewars/uGearsUtils.pas	Sun Mar 11 23:31:32 2012 +0400
+++ b/hedgewars/uGearsUtils.pas	Sun Mar 11 18:28:32 2012 -0400
@@ -46,7 +46,7 @@
 
 procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord);
 var Gear: PGear;
-    dmg, dmgRadius, dmgBase: LongInt;
+    dmg, dmgBase: LongInt;
     fX, fY, tdX, tdY: hwFloat;
     vg: PVisualGear;
     i, cnt: LongInt;