- Remove debug
authorunc0rr
Sun, 20 Jan 2008 22:53:46 +0000
changeset 744 7a9663194767
parent 743 6b314e907f6d
child 745 43b344488804
- Remove debug - Fix sqrt computation
hedgewars/uAIAmmoTests.pas
hedgewars/uFloat.pas
--- a/hedgewars/uAIAmmoTests.pas	Sun Jan 20 22:17:03 2008 +0000
+++ b/hedgewars/uAIAmmoTests.pas	Sun Jan 20 22:53:46 2008 +0000
@@ -123,7 +123,6 @@
         begin
         ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random((Level - 1) * 9));
         ap.Power:= hwRound(r * cMaxPower) - random((Level - 1) * 17 + 1);
-AddFilelog('r = '+floattostr(r)+' power = '+ inttostr(hwRound(r * cMaxPower))+' ==> '+inttostr(ap.Power));
         ap.ExplR:= 100;
         ap.ExplX:= EX;
         ap.ExplY:= EY;
--- a/hedgewars/uFloat.pas	Sun Jan 20 22:17:03 2008 +0000
+++ b/hedgewars/uFloat.pas	Sun Jan 20 22:53:46 2008 +0000
@@ -130,7 +130,7 @@
 {$ENDIF}
 
 implementation
-uses uConsts;
+uses uConsts, uMisc;
 
 {$IFDEF FPC}
 
@@ -286,12 +286,22 @@
     c: hwFloat;
 begin
 hwSqrt.isNegative:= false;
-l:= 0;
-r:= t.QWordValue div 2 + 1;
+
+if t.Round = 0 then
+   begin
+   l:= t.QWordValue;
+   r:= $100000000
+   end else
+   begin
+   l:= $100000000;
+   r:= t.QWordValue
+   end;
+
 repeat
   c.QWordValue:= (l + r) div 2;
   if hwSqr(c).QWordValue > t.QWordValue then r:= c.QWordValue else l:= c.QWordValue
 until r - l <= 1;
+
 hwSqrt.QWordValue:= l
 end;