Timer
2009-06-23 05:03:51
Result := Path[i]; should be Result := Path[index];
{*******************************************************************************
function FurthestTile(Path: TPointArray; MaxDist: integer): TPoint;
By: lordsaturn
Description: Gets the furthest tile in the array.
*******************************************************************************}
function FurthestTile(Path: TPointArray; MaxDist: integer): TPoint;
var
i, Hi, dist, mx, index: integer;
begin
Hi := High(Path);
if Hi < 0 then Exit;
index := -1;
for i := 0 to Hi do
begin
dist := DistanceFrom(Path[i]);
if (dist > mx) and (dist <= MaxDist) then
begin
mx := dist;
index := i;
end;
end;
if index > -1 then
Result := Path[index];
end;