Skip to content

Commit 801fb64

Browse files
committed
Chunk: Fix Reset not clearing active layers
1 parent 081adeb commit 801fb64

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

include/CommonLib/Chunk.inl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ namespace tsom
148148

149149
inline void Chunk::Reset()
150150
{
151+
m_activeLayers.clear();
151152
m_blocks.clear();
152153
m_blocks.resize(m_size.x * m_size.y * m_size.z, EmptyBlockIndex);
153154

@@ -168,13 +169,14 @@ namespace tsom
168169
// Chunks don't have any block until they are reset
169170
if (!HasContent())
170171
{
172+
m_activeLayers.clear();
173+
for (auto& layerOpt : m_layers)
174+
layerOpt.reset();
175+
171176
m_blocks.resize(m_size.x * m_size.y * m_size.z, EmptyBlockIndex);
172177
m_blockTypeCount.resize(EmptyBlockIndex + 1);
173178
m_blockTypeCount[EmptyBlockIndex] = m_blocks.size();
174179

175-
for (auto& layerOpt : m_layers)
176-
layerOpt.reset();
177-
178180
// Create first layer (empty block)
179181
RegisterLayer(0);
180182
m_layers[0]->blockCount = m_blocks.size();

0 commit comments

Comments
 (0)