Use std::array for find_connected_distance depth array

Zero the entire array, rather than adjusting the loop to account for the
count of segments in the level.  The array may not need to be zeroed at
all, but this is cheap and guarantees consistent results.
This commit is contained in:
Kp 2022-04-24 20:42:01 +00:00
parent 8de9facac1
commit 34793b5477

View file

@ -836,7 +836,6 @@ vm_distance find_connected_distance(const vms_vector &p0, const vcsegptridx_t se
segnum_t cur_seg;
int qtail = 0, qhead = 0;
seg_seg seg_queue[MAX_SEGMENTS];
short depth[MAX_SEGMENTS];
int cur_depth;
int num_points;
struct point_seg
@ -888,8 +887,8 @@ vm_distance find_connected_distance(const vms_vector &p0, const vcsegptridx_t se
num_points = 0;
std::array<uint16_t, MAX_SEGMENTS> depth{};
visited_segment_bitarray_t visited;
memset(depth, 0, sizeof(depth[0]) * (Highest_segment_index+1));
cur_seg = seg0;
visited[cur_seg] = true;