bug fixes

This commit is contained in:
Piotrek
2021-05-06 15:49:21 +02:00
parent 45362afbf4
commit c16ad4f4a0
3 changed files with 12 additions and 4 deletions
+8
View File
@@ -28,6 +28,14 @@ impl App {
let block = app.world.gen_block(pos);
content.write(pos, block);
let pos = &Point3{x:1,y:0,z:0};
let block = app.world.gen_block(pos);
content.write(pos, block);
let pos = &Point3{x:0,y:0,z:1};
let block = app.world.gen_block(pos);
content.write(pos, block);
println!("App initialized");
app
}
+2 -2
View File
@@ -49,8 +49,8 @@ impl WorldGen {
// Fill
for x in 0..block::SIZE {
for z in 0..block::SIZE {
//let h = map[x][z];
let h = 16; // testing
let h = map[x][z];
//let h = 16; // testing
for y in 0..h {
block.set(Point3{x, y, z}, 2);
}
+2 -2
View File
@@ -26,11 +26,11 @@ impl World {
let ch_pos = block_pos / chunk::SIZE;
let bl_pos = block_pos % chunk::SIZE;
// Create chunk if does not exist
if let None = self.chunks.get_mut(&ch_pos) {
if let None = self.chunks.get(&ch_pos) {
self.chunks.insert(block_pos.clone(), WorldChunk::new());
}
// Generate block for chunk
let chunk = self.chunks.get_mut(block_pos).unwrap();
let chunk = self.chunks.get_mut(&ch_pos).unwrap();
let block = chunk.get_block(&bl_pos);
WorldGen::generate(&bl_pos, block);
block