if (cur_dist != UINT_MAX && cur_dist > max_range) continue; if (next_dist != UINT_MAX && next_dist > max_range) continue;