code: void connectIntLinks(MeshTile tile) {
          if (tile == null) {
              return;
          }
  
          long base = getPolyRefBase(tile);
  
          for (int i = 0; i < tile.data.header.polyCount; ++i) {
              Poly poly = tile.data.polys[i];
              poly.firstLink = DT_NULL_LINK;
  
              if (poly.getType() == Poly.DT_POLYTYPE_OFFMESH_CONNECTION) {
                  continue;
              }
  
              // Build edge links backwards so that the links will be
              // in the linked list from lowest index to highest.
              for (int j = poly.vertCount - 1; j >= 0; --j) {
                  // Skip hard and non-internal edges.
                  if (poly.neis[j] == 0 || (poly.neis[j] & DT_EXT_LINK) != 0) {
                      continue;
                  }
  
                  int idx = allocLink(tile);
                  Link link = tile.links.get(idx);
                  link.ref = base | (poly.neis[j] - 1);
                  link.edge = j;
                  link.side = 0xff;
                  link.bmin = link.bmax = 0;
                  // Add to linked list.
                  link.next = poly.firstLink;
                  poly.firstLink = idx;
              }
          }
      }
docs: / Builds internal polygons links for a tile.