Fix saving
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Sijmen 2021-06-07 02:26:28 +02:00
parent 5d7101ae0b
commit c8e02c6f86
Signed by: vijfhoek
GPG key ID: 82D05C89B28B0DAE

View file

@ -123,15 +123,19 @@ impl Renderable for World {
if let Some(chunk) = self.chunks.get(&position) { if let Some(chunk) = self.chunks.get(&position) {
if let Err(err) = chunk.save(position, &self.chunk_database) { if let Err(err) = chunk.save(position, &self.chunk_database) {
eprintln!("Failed to save chunk {:?}: {:?}", position, err); eprintln!("Failed to save chunk {:?}: {:?}", position, err);
} else if unload { } else {
if unload {
self.chunks.remove(&position); self.chunks.remove(&position);
if DEBUG_IO { if DEBUG_IO {
println!("Saved and unloaded chunk {:?}", position); println!("Saved and unloaded chunk {:?}", position);
} }
} else if DEBUG_IO { } else {
if DEBUG_IO {
println!("Saved chunk {:?}", position); println!("Saved chunk {:?}", position);
} }
}
}
} else { } else {
eprintln!("Tried to save unloaded chunk {:?}", position); eprintln!("Tried to save unloaded chunk {:?}", position);
} }
@ -292,8 +296,7 @@ impl World {
chunk.blocks[by][bz][bx] = block; chunk.blocks[by][bz][bx] = block;
} }
self.chunk_save_queue self.enqueue_chunk_save(chunk_position, false);
.push_back((chunk_position / CHUNK_ISIZE, false));
} }
fn calc_scale(vector: Vector3<f32>, scalar: f32) -> f32 { fn calc_scale(vector: Vector3<f32>, scalar: f32) -> f32 {