Add drowning to grenade too, try some little optimisations
authornemo
Sun, 11 Mar 2012 18:28:32 -0400
changeset 6769 44ad49a3a126
parent 6768 a142cf8dbbd3
child 6770 7d2c6cdb816a
Add drowning to grenade too, try some little optimisations
hedgewars/uAIAmmoTests.pas
hedgewars/uAIMisc.pas
hedgewars/uGears.pas
hedgewars/uGearsUtils.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;
 
--- 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;
--- 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;
 
--- 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;