anchor.diff:        //Check if terrainKind is same for all 4 corners
         if not TileTryGetTerKind(aFromX, aFromY, terKind) then
         begin
  -        CornersTerKinds := TileCornersTerKinds(aFromX, aFromY);
  +        GetTileCornersTerKinds(aFromX, aFromY, cornersTerKinds);
   
           if aDir = dirNA then // that should never happen usually
             terKind := tkGrass
  
positive.code: function TKMTerrain.TileCornersTerrains(aX, aY: Word): TKMWordArray;
  var
    K: Integer;
    TKinds: TKMTerrainKindsArray;
  begin
    SetLength(Result, 4);
    TKinds := TileCornersTerKinds(aX, aY);
    for K := 0 to 3 do
      Result[K] := BASE_TERRAIN[TKinds[K]];
  end;
  
  
  function TKMTerrain.TileCornerTerKind(aX, aY: Word; aCorner: Byte): TKMTerrainKind;
  var
    cornersTKinds: TKMTerrainKindsArray;
  begin
    Assert(InRange(aCorner, 0, 3));
    
    cornersTKinds := TileCornersTerKinds(aX, aY);
    Result := cornersTKinds[aCorner];
  end;
  
  
  //Get tile corners terrain kinds
  function TKMTerrain.TileCornersTerKinds(aX, aY: Word): TKMTerrainKindsArray;
  var
    K, L: Integer;
  begin
    SetLength(Result, 4);
    for K := 0 to 3 do
    begin
      Result[K] := tkCustom;
      with gTerrain.Land[aY,aX] do
      begin
        if BaseLayer.Corners[K] then
          Result[K] := TILE_CORNERS_TERRAIN_KINDS[BaseLayer.Terrain, (K + 4 - BaseLayer.Rotation) mod 4]
        else
          for L := 0 to LayersCnt - 1 do
            if Layer[L].Corners[K] then
            begin
              Result[K] := gRes.Sprites.GetGenTerrainInfo(Layer[L].Terrain).TerKind;
              Break;
            end;
      end;
  
negative.code: function TKMTerrain.TileHasOnlyTerrainKind(X, Y: Word; const aTerKind: TKMTerrainKind): Boolean;
  var
    I: Integer;
    cornersTerKinds: TKMTerrainKindCorners;
  begin
    Result := True;
    GetTileCornersTerKinds(X, Y, cornersTerKinds);
    for I := 0 to 3 do
      if cornersTerKinds[I] <> aTerKind then
        Exit(False);
  end;
  
  