Hey folks,

right now I found some times to test my pathfinding based on this sample and source.

I just realized it is not doing what it should do.

I have my own blocktester:

Code:
function TForm1.blocktester(X, Y, Fx, Fy: integer): integer;
begin
  result:= -1; // if it isnt anything else - it is wall
  if (level[x,y]=255) then result:=round(((ABS(FX-X) + ABS(FY - Y)) * 3))
  else if (level[x,y]=0) or (level[x,y] in [51..55]) then result:= ((ABS(FX-X) + ABS(FY - Y)) * 3)*32;
end;
Level=0 means there is nothing, 255 means it is a road, 51..55 is grass.

For my villagers I call it like this:

Code:
            StartPoint := Point(round(x),round(z));
            EndPoint := Point(round(ntargetx),round(ntargetz));
            setlength(Astack, 0);
            patherror:=false;
            Astar.findpath(StartPoint, EndPoint, point(levelb-1,levelh-1),true, true, @blocktester);
            setlength(waypath,0);
            setlength(path,0);
            setlength(WayPath,length(path));
            nway:=0;
            if not patherror then begin
              boolstand:=false;
              for i:=0 to length(path)-1 do waypath[i]:=path[i];
            end else form1.exceptionmsg('Kein Path gefunden');
I tried to debug it and realized each time I get an patherror!
Levelb is the width and Levelh the height of my level (256x256).
It starts to step and no idea what causes the patherror, any idea?

PS: Merry XMas.

Thanks,
Firle *depressedonxmas*