diff --git a/src/chunkmanager.cpp b/src/chunkmanager.cpp index eecfa22..917e476 100644 --- a/src/chunkmanager.cpp +++ b/src/chunkmanager.cpp @@ -34,6 +34,7 @@ namespace chunkmanager // Queue of chunks to be meshed ChunkPriorityQueue chunks_to_mesh_queue; + int block_to_place{2}; // Init chunkmanager. Chunk indices and start threads int chunks_volume_real; @@ -86,6 +87,8 @@ namespace chunkmanager update_thread = std::thread(update); gen_thread = std::thread(generate); mesh_thread = std::thread(mesh); + + debug::window::set_parameter("block_type_return", &block_to_place); } // Method for world generation thread(s) @@ -254,7 +257,7 @@ namespace chunkmanager if(!chunks.find(a1, calculateIndex(px1, py1, pz1))) return; Chunk::Chunk* c1 = a1->second; // place the new block (only stone for now) - c1->setBlock( Block::STONE, bx1, by1, bz1); + c1->setBlock((Block)block_to_place, bx1, by1, bz1); // mark the mesh of the chunk the be updated chunks_to_mesh_queue.push(std::make_pair(c1, MESHING_PRIORITY_PLAYER_EDIT)); diff --git a/src/debugwindow.cpp b/src/debugwindow.cpp index b82a5c9..e44f5c8 100644 --- a/src/debugwindow.cpp +++ b/src/debugwindow.cpp @@ -59,7 +59,6 @@ namespace debug{ parameters[key] = value; } - int block_type{0}; void show_debug_window(){ ImGui::Begin("Debug Window"); @@ -92,7 +91,7 @@ namespace debug{ ImGui::SliderInt("Crosshair type", std::any_cast(parameters.at("crosshair_type_return")), 0, 1); ImGui::SliderInt("Block to place", - block_type, 2, 6); + std::any_cast(parameters.at("block_type_return")), 2, 6); } if(ImGui::CollapsingHeader("Mesh")){