anchor.diff:        case Land^[Y,X].BaseLayer.Terrain of
           142,
           143:  begin
  +                // 142 and 143 are stone-water tiles (triangles)
                   terRot := (Land[Y,X].BaseLayer.Terrain + Land^[Y,X].BaseLayer.Rotation) mod 4;
                   case terRot of
                     0,1:  Exit;
  
positive.code:     UpdatePassability(KMPoint(X,Y));
      AddToVisited(X,Y);
  
      //Floodfill through around tiles
      UpdateTransition(X,  Y-1, aStep + 1); //  x x x
      UpdateTransition(X+1,Y,   aStep + 1); //  x   x
      UpdateTransition(X,  Y+1, aStep + 1); //  x x x
  
negative.code:       or not TileHasOnlyTerrainKinds(X, Y, [tkStone, tkGrass, tkCoastSand, tkDirt, tkSnow, tkSnowOnDirt]) then //Do not update transitions with other terrains (mountains f.e.)
        Exit;
  
      // 1. Get tile transition type (with grass / sand etc)
      transition := GetStoneTransitionType(X,Y);
  
      // 2. Check what tiles around has stone
  
      // We 'encode' in bits variable if surrounding tiles are stone tiles
      // Then we found proper tile to replace
      // Starting with dirN and going clockwise
      // f.e. 11 = 1011 = stone is to the left, top and right of the tile
      bits := GetBits(X  , Y-1, transition, dirS)*1 +
              GetBits(X+1, Y  , transition, dirW)*2 +
              GetBits(X  , Y+1, transition, dirN)*4 +
              GetBits(X-1, Y  , transition, dirE)*8;
  
      // 3. Replace tile with other tile according to the tiles around
      if bits = 0 then
      begin
        // If there are no stone around in the straight directions then check diagonals
        bitsDiag := GetBits(X-1, Y-1, transition, dirSE)*1 +
                    GetBits(X+1, Y-1, transition, dirSW)*2 +
                    GetBits(X+1, Y+1, transition, dirNW)*4 +
  