From 65bacd745e8fb2f93dfcccdf57f4b528e2941ebf Mon Sep 17 00:00:00 2001 From: Piotrek Date: Mon, 17 May 2021 15:12:15 +0200 Subject: [PATCH] not loading already loaded chunks --- src/game/world/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/game/world/mod.rs b/src/game/world/mod.rs index 5177e3c..ae0b251 100644 --- a/src/game/world/mod.rs +++ b/src/game/world/mod.rs @@ -57,8 +57,12 @@ impl World { * Sends chunk position to the ChunkLoader */ pub fn load_chunk(&mut self, pos: Vector3) { - self.loader.load(pos); - self.busy += 1; + if let Some(chunk) = self.chunks.get_mut(&pos) { + chunk.dirty = true; + } else { + self.loader.load(pos); + self.busy += 1; + } } /*