From 7ab60df578e3415b60bf1c40bd3d30434ef69ef5 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 6 Mar 2023 21:25:54 -0600 Subject: [PATCH] Fix QuadTree ringList removal assertion --- .../java/com/seibel/lod/core/render/LodQuadTree.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/seibel/lod/core/render/LodQuadTree.java b/core/src/main/java/com/seibel/lod/core/render/LodQuadTree.java index f76205925..aaef7bcb8 100644 --- a/core/src/main/java/com/seibel/lod/core/render/LodQuadTree.java +++ b/core/src/main/java/com/seibel/lod/core/render/LodQuadTree.java @@ -413,11 +413,12 @@ public class LodQuadTree implements AutoCloseable if (section != null && targetDetailLevel > this.getLayerDataDetail(sectionDetailLevel)) { // this section is a higher detail level than we want, mark it for deletion + section.childCount = -1; + if (SUPER_VERBOSE_LOGGING) { LOGGER.info("sect "+sectPos+" in top detail level & target>current. Mark as free."); } - section.childCount = -1; } if (section == null && targetDetailLevel <= this.getLayerDataDetail(sectionDetailLevel)) @@ -581,7 +582,11 @@ public class LodQuadTree implements AutoCloseable if (section.pos.sectionDetailLevel < this.treeMaxDetailLevel) { - LodUtil.assertTrue(this.getParentSection(section.pos).childCount == 0); + int parentChildCount = this.getParentSection(section.pos).childCount; + if (parentChildCount != 0 && parentChildCount != -1) + { + LodUtil.assertNotReach("Incorrect section removal. Parent has ["+parentChildCount+"] children, expected [0] (empty parent) or [-1] (parent also marked for deletion)."); + } } ringList.remove(pos.x, pos.y);