anchor.diff:      DX := Abs(aSPoint.X - aEPoint.X);
       DY := Abs(aSPoint.Y - aEPoint.Y);
       if (DX > DY) then
  -      Output := (DX shl 3) + (DY shl 2)
  +      Output := (DX * 10) + (DY * 4)
       else
  -      Output := (DY shl 3) + (DX shl 2);
  -  end;
  -  // Output := KMDistanceAbs(SPoint, EPoint); // in test map it throws +1 cycle (109 vs 110 interactions
  +      Output := (DY * 10) + (DX * 4);
  +    end;
  +  case fMode of
  +    pm_ShortestWay: begin end;
  +    pm_AvoidTraffic: Output := Output + AvoidTraffic();
  +    pm_AvoidSpecEnemy: Output := Output + AvoidSpecEnemy();
  +  end;
     Result := Output;
   end;
   
  
positive.code: end;
  
  
  procedure TNavMeshPathFinding.ReturnRoute(out aRouteArray: TKMWordArray; out aRoutePointArray: TKMPointArray);
  const
    USED_PENALIZATION = 40;
  var
    Count: Word;
    N: TNavMeshNode;
    Output: TKMWordArray;
  begin
    N := fMinN;
    Count := 0;
    while (N <> nil) do
    begin
      N := N.Parent;
      Inc(Count,1);
    end;
  
    SetLength(aRoutePointArray, Count+1);
    aRoutePointArray[0] := gAIFields.NavMesh.Polygons[fMinN.Idx].CenterPoint;
  
    SetLength(Output, Count);
    N := fMinN;
    Count := 0;
    while (N <> nil) do
    begin
      aRoutePointArray[Count+1] := N.Point;
      Output[Count] := N.Idx;
      N := N.Parent;
      Inc(Count,1);
    end;
    aRoutePointArray[Count] := gAIFields.NavMesh.Polygons[ Output[Count-1] ].CenterPoint;
  end;
  
  
  function TNavMeshPathFinding.Route_Make(aStart, aEnd: TKMPoint; out aRouteArray: TKMWordArray; out aRoutePointArray: TKMPointArray): Boolean;
  var Output: Boolean;
  begin
    Result := False;
    fStart := gAIFields.NavMesh.FindClosestPolygon(aStart);
    fEnd := gAIFields.NavMesh.FindClosestPolygon(aEnd);
    if (fStart = High(Word)) OR (fEnd = High(Word)) then  // Non-Existing polygon
      Exit;
    Output := MakeRoute();
    if Output then
    begin
      ReturnRoute(aRouteArray, aRoutePointArray);
      aRoutePointArray[0] := aEnd;
    end;
    Result := Output;
  end;
  
  
  end.
  
negative.code:   DX := Abs(SPoint.X - EPoint.X);
    DY := Abs(SPoint.Y - EPoint.Y);
    if (DX > DY) then
      Output := (DX * 10) + (DY * 4)
    else
      Output := (DY * 10) + (DX * 4);
    Result := Output;
  end;
  
  