anchor.diff:      end;
     end;
   
  -  function GetTerKindsAround(aCell: TKMPoint): TKMTerrainKindsArray;
  +  procedure GetTerKindsAround(aCell: TKMPoint; out aCornersTerKinds: TKMTerrainKindCorners);
     var
       I: Integer;
       TerKind: TKMTerrainKind;
       TerKindFound: array[0..3] of Boolean;
     begin
  -    SetLength(Result, 4);
  -
       //get all 4 terkind for corners
       for I := 0 to 3 do
       begin
         TerKind := GetCornerTerKind(I, aCell, TerKindFound[I]);
         if TerKindFound[I] then
  -        Result[I] := TerKind;
  +        aCornersTerKinds[I] := TerKind;
       end;
   
       //For corner, where no terkind from around tiles were found - replace it with neighbour corner terkind (there can't be 2 missed terkinds in a row)
       for I := 0 to 3 do
         if not TerKindFound[I] then
  -        Result[I] := Result[(I+1) mod 4];
  -
  +        aCornersTerKinds[I] := aCornersTerKinds[(I+1) mod 4];
     end;
   
     function HasCollision(aTerKind1, aTerKind2: TKMTerrainKind): Boolean;
  
positive.code: 
  
  //Get tile corners terkinds (TKinds, based on TILE_CORNERS_TERRAIN_KINDS or generated mask)
  function TKMTerrainPainter.GetTileOwnCornersTKinds(const aCell: TKMPoint): TKMTerrainKindsArray;
  begin
    Result := GetTileCornersTKinds(aCell, True);
  end;
  
  
  function TKMTerrainPainter.GetTileLandNodeTKinds(const aCell: TKMPoint): TKMTerrainKindsArray;
  begin
    Result := GetTileCornersTKinds(aCell, False, True);
  end;
  
  
  function TKMTerrainPainter.GetVertexCornerTerKinds(X,Y: Word): TKMTerrainKindsArray;
  var
    I: Integer;
  
    procedure CheckTile(aX, aY: Word; aCorner: Byte);
    begin
      if gTerrain.TileInMapCoords(aX, aY) then
      begin
        Result[I] := GetTileOwnCornersTKinds(KMPoint(aX, aY))[aCorner];
        Inc(I);
      end;
    end;
  
  begin
    SetLength(Result, 4);
  
    I := 0;
  
    CheckTile(X-1, Y-1, 2);
    CheckTile(X  , Y-1, 3);
    CheckTile(X  , Y  , 0);
    CheckTile(X-1, Y  , 1);
  
    SetLength(Result, I);
  end;
  
  
  function TKMTerrainPainter.GetTileCornersTKinds(const aCell: TKMPoint;
                                                  aGetOnlyTileCornersTK: Boolean = False;
                                                  aGetOnlyLandNodeTK: Boolean = False): TKMTerrainKindsArray;
  var
    TerKindFound: array [0..3] of Boolean;
  
    procedure CheckTerKind(aX,aY,aI: Integer);
    var
  
negative.code:         for I := 0 to 3 do
            LayerOrder[I].SubType := mstMain;
  
          MaskType := GetMaskType(aroundTerKinds, LayerOrder);
  
          BaseLayer.Terrain := BASE_TERRAIN[LayerOrder[0].TerKind];
          BaseLayer.Rotation := 0;
  