diff -r 38e3d9347910 -r 5b8ca3955834 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Sat Aug 13 20:44:42 2011 +0400 +++ b/hedgewars/uGears.pas Sat Aug 13 21:26:59 2011 +0400 @@ -1511,19 +1511,20 @@ function GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): TPGearArray; var t: PGear; + l: Longword; begin r:= r*r; GearsNear := nil; t := GearsList; - while t <> nil do begin - if (t^.Kind = Kind) then begin - if (X - t^.X)*(X - t^.X) + (Y - t^.Y)*(Y-t^.Y) < - int2hwFloat(r) then + while t <> nil do + begin + if (t^.Kind = Kind) + and ((X - t^.X)*(X - t^.X) + (Y - t^.Y)*(Y-t^.Y) < int2hwFloat(r)) then begin - SetLength(GearsNear, Length(GearsNear)+1); - GearsNear[High(GearsNear)] := t; + l:= Length(GearsNear); + SetLength(GearsNear, l + 1); + GearsNear[l] := t; end; - end; t := t^.NextGear; end; end;