boffysworld
01-13-2012, 06:22 PM
Really new to this so please bare with my lack of knowledge.
I have Dtm array of locations and im trying to find which is closest when i first login.
By checking each point , seeing which it finds and storing distance of those in an array.
Then sorting list closest first.
And im having no luck.
Procedure Find_player;
var
place,f:Integer;
Dist:TIntegerarray;
begin
SetDTM;
SetLength(Dist,High(Q));
For f:=0 to High(Q) do
If FindDTMRotated(Q[f], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
place:= Distance(x, y, MMCX, MMCY);
Dist[f]:=Place;
WriteLn(IntToStr(Dist[f])+(' location ')+InttoStr(f));
end;
FrDTM;
Quicksort(Dist);
WriteLn(IntToStr(Dist[0])+('You are at location ')+InttoStr(f));
End;
I have Dtm array of locations and im trying to find which is closest when i first login.
By checking each point , seeing which it finds and storing distance of those in an array.
Then sorting list closest first.
And im having no luck.
Procedure Find_player;
var
place,f:Integer;
Dist:TIntegerarray;
begin
SetDTM;
SetLength(Dist,High(Q));
For f:=0 to High(Q) do
If FindDTMRotated(Q[f], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
place:= Distance(x, y, MMCX, MMCY);
Dist[f]:=Place;
WriteLn(IntToStr(Dist[f])+(' location ')+InttoStr(f));
end;
FrDTM;
Quicksort(Dist);
WriteLn(IntToStr(Dist[0])+('You are at location ')+InttoStr(f));
End;