From c98625a610ed107b713eb5f8bab68e4bda56bc0e Mon Sep 17 00:00:00 2001 From: MarcEricMartel Date: Mon, 13 Nov 2023 16:46:03 -0500 Subject: [PATCH] correction --- SQCSim-common/world.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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); }