//Determine if there are disconnected segments in this group, and if so rejoin them to the proper chunk private static void RejoinDisconnectedChunks(int chunk_segnum, int other_chunknum) { Segment chunk_seg = m_level.segment[chunk_segnum]; int chunknum = chunk_seg.m_chunk_num; //Find all segments attached to this segment FindConnectedSegments(chunk_seg); //Now move any non-connected segments back to the original chunk foreach (Segment seg in m_level.EnumerateAliveSegments()) { if ((seg.m_chunk_num == chunknum) && !m_connected[seg.num]) { seg.m_chunk_num = other_chunknum; m_chunk_size[chunknum]--; m_chunk_size[other_chunknum]++; } } }