From 6acb1a2e9f28a3de5064cc1e410c685bf6a1f515 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 16 Jul 2023 21:56:05 -0500 Subject: [PATCH] Fix missing low detail LODs if the file didn't exist --- .../file/fullDatafile/FullDataFileHandler.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/FullDataFileHandler.java b/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/FullDataFileHandler.java index 010314c36..286e1ead4 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/FullDataFileHandler.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/FullDataFileHandler.java @@ -288,7 +288,8 @@ public class FullDataFileHandler implements IFullDataSourceProvider continue; } - if (this.fileBySectionPos.containsKey(subPos)) + // check if a file for this pos exists, either loaded and unloaded + if (this.fileBySectionPos.containsKey(subPos) || this.unloadedFiles.containsKey(subPos)) { allEmpty = false; break outerLoop; @@ -317,6 +318,13 @@ public class FullDataFileHandler implements IFullDataSourceProvider DhSectionPos childPos = pos.getChildByIndex(childIndex); if (CompleteFullDataSource.firstDataPosCanAffectSecond(basePos, childPos)) { + // load the file if it isn't already + if (this.unloadedFiles.containsKey(childPos)) + { + this.getLoadOrMakeFile(childPos, true); + } + + FullDataMetaFile metaFile = this.fileBySectionPos.get(childPos); if (metaFile != null) { @@ -386,12 +394,6 @@ public class FullDataFileHandler implements IFullDataSourceProvider private void writeChunkDataToMetaFile(DhSectionPos sectionPos, ChunkSizedFullDataAccessor chunkData) { FullDataMetaFile metaFile = this.fileBySectionPos.get(sectionPos); -// if (metaFile == null && sectionPos.sectionDetailLevel <= this.topDetailLevel.get()) -// { -// // create a new file if one doesn't exist, -// // this is done so we don't end up with holes where LODs should have been generated -// metaFile = this.getLoadOrMakeFile(sectionPos, true); -// } if (metaFile != null) { // there is a file for this position