anchor.diff:  end;
   
   
  +procedure TKMNavMesh.GenerateTileOutline(out aTileOutlines: TKMShapesArray);
  +var
  +  I, K: Integer;
  +  Tmp: TKMByte2Array;
  +begin
  +  SetLength(Tmp, gTerrain.MapY-1, gTerrain.MapX-1);
  +
  +  //Copy map to temp array as 0/1 (generator uses other byte values for its needs)
  +  //0 - no obstacle
  +  //1 - obstacle
  +  for I := 0 to gTerrain.MapY - 2 do
  +  for K := 0 to gTerrain.MapX - 2 do
  +    Tmp[I,K] := 1 - Byte(tpOwn in gTerrain.Land[I+1,K+1].Passability);
  +
  +  GenerateOutline(Tmp, 12, aTileOutlines);
  +
  +  //GenerateOutline is 0 based for versatility purposes, but Terrain in 1 based
  +  //because of legacy reasons. Do the conversion
  +  for I := 0 to aTileOutlines.Count - 1 do
  +  for K := 0 to aTileOutlines.Shape[I].Count - 1 do
  +  begin
  +    aTileOutlines.Shape[I].Nodes[K].X := aTileOutlines.Shape[I].Nodes[K].X + 1;
  +    aTileOutlines.Shape[I].Nodes[K].Y := aTileOutlines.Shape[I].Nodes[K].Y + 1;
  +  end;
  +end;
  +
  +
   procedure TKMNavMesh.TriangulateOutlines;
   var
     fDelaunay: TDelaunay;
  
positive.code: 
    //Mapp all map tiles to its polygons
    TieUpTilesWithPolygons();
  end;
  
  
  procedure TKMNavMesh.GenerateTileOutline(out aTileOutlines: TKMShapesArray);
  var
    I, K: Integer;
    Tmp: TKMByte2Array;
  begin
    SetLength(Tmp, gTerrain.MapY-1, gTerrain.MapX-1);
  
    //Copy map to temp array as 0/1 (generator uses other byte values for its needs)
    //0 - no obstacle
    //1 - obstacle
    for I := 0 to gTerrain.MapY - 2 do
    for K := 0 to gTerrain.MapX - 2 do
      Tmp[I,K] := 1 - Byte(tpOwn in gTerrain.Land[I+1,K+1].Passability);
  
    GenerateOutline(Tmp, 12, aTileOutlines);
  
    //GenerateOutline is 0 based for versatility purposes, but Terrain in 1 based
    //because of legacy reasons. Do the conversion
    for I := 0 to aTileOutlines.Count - 1 do
    for K := 0 to aTileOutlines.Shape[I].Count - 1 do
    begin
      aTileOutlines.Shape[I].Nodes[K].X := aTileOutlines.Shape[I].Nodes[K].X + 1;
      aTileOutlines.Shape[I].Nodes[K].Y := aTileOutlines.Shape[I].Nodes[K].Y + 1;
    end;
  end;
  
  
  
negative.code:     //Add more points along edges to get even density
      SizeX := gTerrain.MapX-1;
      SizeY := gTerrain.MapY-1;
      MeshDensityX := SizeX div NAVMESH_DENSITY;
      MeshDensityY := SizeY div NAVMESH_DENSITY;
      for I := 0 to MeshDensityY do
      for K := 0 to MeshDensityX do
      if (I = 0) or (I = MeshDensityY) or (K = 0) or (K = MeshDensityX) then
  