anchor.diff:          T2 := KMPerpendecular(Outline2[K].A, Outline2[K].B);
           gRenderAux.LineOnTerrain(T1.X, T1.Y, T2.X, T2.Y, $A000FF00);
         end;
  -    end;
  +    end;//}
   end;
   
   
   end.
  +
  +{
  +// The following code was removed and replaced by NavMesh alternative
  +TNode = record
  +    Loc: TKMPoint;
  +    Nearby: array of Word; //Indexes of connected nodes
  +    Owner: array [0..MAX_HANDS-1] of Byte;
  +  end;
  +//Copy ownership values from influence map
  +//  for now those values are more accurate
  +procedure TKMNavMesh.UpdateOwnership;
  +var
  +  I, K: Integer;
  +begin
  +  if not AI_GEN_NAVMESH then Exit;
  +
  +  for I := 0 to fNodeCount - 1 do
  +    for K := 0 to gHands.Count - 1 do
  +      fNodes[I].Owner[K] := Min(255, Max(
  +        Max(fInfluences.Ownership[K, Max(fNodes[I].Loc.Y, 1), Max(fNodes[I].Loc.X, 1)],
  +            fInfluences.Ownership[K, Max(fNodes[I].Loc.Y, 1), Min(fNodes[I].Loc.X+1, gTerrain.MapX - 1)]),
  +        Max(fInfluences.Ownership[K, Min(fNodes[I].Loc.Y+1, gTerrain.MapY - 1), Max(fNodes[I].Loc.X, 1)],
  +            fInfluences.Ownership[K, Min(fNodes[I].Loc.Y+1, gTerrain.MapY - 1), Min(fNodes[I].Loc.X+1, gTerrain.MapX - 1)])
  +            ));
  +end;
  +//}
  
positive.code: 
  
  // Find closest NavMesh in case that we get walkable point which is not part of Point2PolygonArr
  // (stonemason may mine stone and create walkable tiles which are not part of NavMesh [NavMesh is not updated durring game])
  function TKMNavMesh.FindClosestPolygon(aP: TKMPoint): Word;
  const
    MAX_SCAN_DIST = 10;
  
negative.code:     //Working data
      fNodeCount: Integer;
      fPolyCount: Integer;
      fNodes: TNodeArray;               // Nodes
      fPolygons: TPolygonArray;         // Polygons
      fPoint2PolygonArr: TKMWord2Array; // KMPoint -> Polygon index
  
      //Defences class
      fDefences: TNavMeshDefences;
  
      //Building the navmesh from terrain
      //Process involves many steps executed in a functional way
  