AI can't use cWindSpeedf since it now does a smooth transition
authornemo
Sun, 13 May 2012 18:50:04 -0400
changeset 7078 a3408d9ba5ad
parent 7077 74b0265d79e8
child 7079 939f53515489
AI can't use cWindSpeedf since it now does a smooth transition
hedgewars/uAI.pas
hedgewars/uAIAmmoTests.pas
--- a/hedgewars/uAI.pas	Sun May 13 18:31:05 2012 -0400
+++ b/hedgewars/uAI.pas	Sun May 13 18:50:04 2012 -0400
@@ -115,6 +115,7 @@
     a, aa: TAmmoType;
 begin
 BotLevel:= Me^.Hedgehog^.BotLevel;
+windSpeed:= hwFloat2Float(cWindSpeed);
 
 for i:= 0 to Pred(Targets.Count) do
     if (Targets.ar[i].Score >= 0) and (not StopThinking) then
--- a/hedgewars/uAIAmmoTests.pas	Sun May 13 18:31:05 2012 -0400
+++ b/hedgewars/uAIAmmoTests.pas	Sun May 13 18:50:04 2012 -0400
@@ -23,6 +23,8 @@
 uses SDLh, uConsts, uFloat, uTypes;
 const amtest_OnTurn = $00000001;
 
+var windSpeed: real;
+
 type TAttackParams = record
         Time: Longword;
         Angle, Power: LongInt;
@@ -106,7 +108,7 @@
             (proc: @TestHammer;      flags: 0), // amHammer
             (proc: nil;              flags: 0), // amResurrector
             (proc: nil;              flags: 0), // amDrillStrike
-            (proc: @TestSnowball;    flags: 0), // amSnowball
+            (proc: nil;              flags: 0), // amSnowball
             (proc: nil;              flags: 0), // amTardis
             (proc: nil;              flags: 0), // amStructure
             (proc: nil;              flags: 0), // amLandGun
@@ -140,7 +142,7 @@
 valueResult:= BadTurn;
 repeat
     rTime:= rTime + 300 + Level * 50 + random(300);
-    Vx:= - cWindSpeedf * rTime * 0.5 + (Targ.X + AIrndSign(2) - mX) / rTime;
+    Vx:= - windSpeed * rTime * 0.5 + (Targ.X + AIrndSign(2) - mX) / rTime;
     Vy:= cGravityf * rTime * 0.5 - (Targ.Y - mY) / rTime;
     r:= sqr(Vx) + sqr(Vy);
     if not (r > 1) then
@@ -153,7 +155,7 @@
         repeat
             x:= x + dX;
             y:= y + dY;
-            dX:= dX + cWindSpeedf;
+            dX:= dX + windSpeed;
             dY:= dY + cGravityf;
             dec(t)
         until TestCollExcludingMe(Me, trunc(x), trunc(y), 5) or (t <= 0);
@@ -198,7 +200,7 @@
 valueResult:= BadTurn;
 repeat
     rTime:= rTime + 300 + Level * 50 + random(1000);
-    Vx:= - cWindSpeedf * rTime * 0.5 + ((Targ.X + AIrndSign(2)) - meX) / rTime;
+    Vx:= - windSpeed * rTime * 0.5 + ((Targ.X + AIrndSign(2)) - meX) / rTime;
     Vy:= cGravityf * rTime * 0.5 - (Targ.Y - meY) / rTime;
     r:= sqr(Vx) + sqr(Vy);
     if not (r > 1) then
@@ -211,7 +213,7 @@
         repeat
             x:= x + dX;
             y:= y + dY;
-            dX:= dX + cWindSpeedf;
+            dX:= dX + windSpeed;
             dY:= dY + cGravityf;
             dec(t)
         until TestCollExcludingMe(Me, trunc(x), trunc(y), 5) or (t <= 0);