hedgewars/uCollisions.pas
changeset 3609 bc63ed514b70
parent 3608 c509bbc779e7
child 3697 d5b30d6373fc
--- a/hedgewars/uCollisions.pas	Thu Jul 01 23:41:10 2010 -0400
+++ b/hedgewars/uCollisions.pas	Fri Jul 02 21:19:22 2010 -0400
@@ -94,7 +94,7 @@
 end;
 
 function CheckGearsCollision(Gear: PGear): PGearArray;
-var mx, my: LongInt;
+var mx, my, tr: LongInt;
     i: Longword;
 begin
 CheckGearsCollision:= @ga;
@@ -103,10 +103,12 @@
 mx:= hwRound(Gear^.X);
 my:= hwRound(Gear^.Y);
 
+tr:= Gear^.Radius + 2;
+
 for i:= 0 to Pred(Count) do
     with cinfos[i] do
         if (Gear <> cGear) and
-            (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius + 2)) then
+            (sqr(mx - x) + sqr(my - y) <= sqr(Radius + tr)) then
                 begin
                 ga.ar[ga.Count]:= cinfos[i].cGear;
                 inc(ga.Count)