anchor.diff:  end;
   
   
  -procedure TPathFinding.ReturnRoute(out NodeList:TKMPointList);
  -var i,k:integer; NodesCount:integer;
  -begin
  -  NodeList.Clearup;
  -
  -  if not fRouteSuccessfullyBuilt then
  -  begin
  -    NodeList.Clearup; //Something went wrong
  -    exit;
  -  end;
  -
  -  //Calculate NodeCount
  -  k:=MinCost.ID; NodesCount:=0;
  -  repeat
  -    inc(NodesCount);
  -    k:=OList[k].Parent;
  -  until(k=0);
  -
  -  {if NodeCount > length(Nodes) then begin
  -    NodeCount:=0; //Something went wrong
  -    Nodes[0]:=LocA;
  -    exit;
  -  end;}
  -
  -  //Assemble the route reversing the list, since path is LocB>LocA in fact
  -  k:=MinCost.ID;
  -  for i:=1 to NodesCount do begin
  -    NodeList.AddEntry(OList[k].Pos);
  -    //Nodes[NodeCount-i]:=OList[k].Pos;
  -    k:=OList[k].Parent;
  -  end;
  -
  -  NodeList.Inverse;
  -    //Nodes[0]:=LocA;
  -
  -
  -  //Should ajoin straight pieces to reduce mem usage
  -  //Important rule:
  -  // - First node is LocA,
  -  // - next to last node is neighbour of LocB (important for delivery to workers),
  -  // - last node is LocB
  -
  -  {if NodeCount>3 then begin
  -  k:=2;
  -  for i:=3 to NodeCount-1 do begin //simplify within LocA+1 .. LocB-2 range
  -  // i/k are always -1 since array is [0..Count-1] range
  -    if (sign(Nodes[k-1].X-Nodes[k-2].X) = sign(Nodes[i-1].X-Nodes[i-2].X))and //Direction matches
  -       (sign(Nodes[k-1].Y-Nodes[k-2].Y) = sign(Nodes[i-1].Y-Nodes[i-2].Y)) then begin
  -      Nodes[k-1]:=Nodes[i-1];
  -    end else begin
  -      inc(k);
  -      Nodes[k-1]:=Nodes[i-1];
  -    end;
  -  end;
  -  inc(k);
  -  Nodes[k-1]:=Nodes[NodeCount-1];
  -  NodeCount:=k;
  -  end;}
  -end;
  -
  -
  -
   function TPathFinding.CheckRouteCanExist():boolean;
   begin
     //Don't try to make a route if it's obviously impossible
  
positive.code: procedure TPathFinding.InitRoute();
  begin
    FillChar(ORef,SizeOf(ORef),#0);
    FillChar(OList,SizeOf(OList),#0);
    OCount:=1;
    ORef[LocA.Y,LocA.X]:=OCount;
    OList[OCount].Pos:=LocA;
    OList[OCount].CostTo:=0;
    OList[OCount].Estim:=(abs(LocB.X-LocA.X) + abs(LocB.Y-LocA.Y))*10;
  
negative.code:         if ORef[y,x]=0 then begin //Cell is new
  
            inc(OCount);
            if (length(OList)-1)<OCount then setlength(OList, OCount+128); //Allocate slightly more space
            OList[OCount].Pos:=KMPoint(x,y);
  
            if (Pass in fTerrain.Land[y,x].Passability) then //If cell meets Passability then estimate it
  