diff --git a/SQCSim-common/world.cpp b/SQCSim-common/world.cpp index a803e01..25c5a3b 100644 --- a/SQCSim-common/world.cpp +++ b/SQCSim-common/world.cpp @@ -39,14 +39,22 @@ void World::RemoveChunk(int nbReduit) for (int x = 0; x < WORLD_SIZE_X; ++x) for (int y = 0; y < WORLD_SIZE_Y; ++y) { + Chunk* chk = nullptr; if (x < nbReduit) - m_chunks.Remove(x,y); + chk = m_chunks.Remove(x, y); if (y < nbReduit) - m_chunks.Remove(x, y); + chk = m_chunks.Remove(x, y); if (y > WORLD_SIZE_Y - nbReduit) - m_chunks.Remove(x, y); + chk = m_chunks.Remove(x, y); if (x > WORLD_SIZE_X - nbReduit) - m_chunks.Remove(x, y); + chk = m_chunks.Remove(x, y); + + // TODO: MakeDirty() les voisins pour qu'ils se redessinent. + + if (!chk) + continue; + + m_tbDeleted.emplace_back(chk); }