Compare commits

..

2 Commits

10 changed files with 14 additions and 10 deletions

View File

@@ -9,10 +9,10 @@ public:
virtual ChunkGenerator& get_chunk_generator() = 0; virtual ChunkGenerator& get_chunk_generator() = 0;
virtual void build_biome() = 0; virtual void build_biome() = 0;
virtual void build_vegetation() = 0; virtual void build_vegetation() = 0;
void ocean_water_build();
protected: protected:
void build_bottom(); void build_bottom();
void place_grass(); void place_grass();
void ocean_water_build();
}; };
} // namespace Cubed } // namespace Cubed

View File

@@ -45,6 +45,7 @@ public:
Chunk& chunk(); Chunk& chunk();
Random& random(); Random& random();
const std::array<BiomeType, 8>& neighbor_biome() const; const std::array<BiomeType, 8>& neighbor_biome() const;
void ocean_build();
void generate_cave(); void generate_cave();
void generate_river(); void generate_river();

View File

@@ -27,7 +27,6 @@ void DesertBuilder::build_blocks() {
} }
} }
} }
ocean_water_build();
} }
void DesertBuilder::build_vegetation() {} void DesertBuilder::build_vegetation() {}

View File

@@ -32,7 +32,6 @@ void ForestBuilder::build_blocks() {
m_blocks[Chunk::index(x, height, z)] = 1; m_blocks[Chunk::index(x, height, z)] = 1;
} }
} }
ocean_water_build();
} }
void ForestBuilder::build_vegetation() { void ForestBuilder::build_vegetation() {

View File

@@ -23,7 +23,6 @@ void MountainBuilder::build_blocks() {
} }
} }
} }
ocean_water_build();
} }
void MountainBuilder::build_vegetation() {} void MountainBuilder::build_vegetation() {}

View File

@@ -23,7 +23,6 @@ void OceanBuilder::build_blocks() {
} }
} }
} }
ocean_water_build();
} }
void OceanBuilder::build_vegetation() {} void OceanBuilder::build_vegetation() {}

View File

@@ -27,7 +27,6 @@ void PlainBuilder::build_blocks() {
m_blocks[Chunk::index(x, height, z)] = 1; m_blocks[Chunk::index(x, height, z)] = 1;
} }
} }
ocean_water_build();
} }
void PlainBuilder::build_vegetation() { place_grass(); } void PlainBuilder::build_vegetation() { place_grass(); }

View File

@@ -27,7 +27,6 @@ void SnowyPlainBuilder::build_blocks() {
m_blocks[Chunk::index(x, height, z)] = 8; m_blocks[Chunk::index(x, height, z)] = 8;
} }
} }
ocean_water_build();
} }
void SnowyPlainBuilder::build_vegetation() {} void SnowyPlainBuilder::build_vegetation() {}

View File

@@ -199,9 +199,8 @@ void Chunk::gen_phase_six(
Logger::error("ChunkGenerator is Nullptr"); Logger::error("ChunkGenerator is Nullptr");
return; return;
} }
// m_generator->blend_surface_blocks_borders(neighbor_block); // This must be fully completed before any other operations can proceed!
m_generator->generate_cave(); m_generator->blend_surface_blocks_borders(neighbor_block);
m_generator->generate_river();
} }
void Chunk::gen_phase_seven() { void Chunk::gen_phase_seven() {
@@ -209,6 +208,10 @@ void Chunk::gen_phase_seven() {
Logger::error("ChunkGenerator is Nullptr"); Logger::error("ChunkGenerator is Nullptr");
return; return;
} }
m_generator->ocean_build();
m_generator->generate_river();
m_generator->generate_cave();
m_generator->generate_vegetation(); m_generator->generate_vegetation();
mark_dirty(); mark_dirty();
m_generator = nullptr; m_generator = nullptr;

View File

@@ -635,6 +635,8 @@ void ChunkGenerator::make_biome_builder() {
} }
} }
void ChunkGenerator::ocean_build() { m_biome_builder->ocean_water_build(); }
void ChunkGenerator::generate_cave() { void ChunkGenerator::generate_cave() {
auto& cave_carver = m_chunk.world().cave_carcer(); auto& cave_carver = m_chunk.world().cave_carcer();
auto& paths = cave_carver.paths(); auto& paths = cave_carver.paths();
@@ -688,6 +690,10 @@ void ChunkGenerator::generate_cave() {
if (blocks[Chunk::index(x, y, z)] == 7) { if (blocks[Chunk::index(x, y, z)] == 7) {
continue; continue;
} }
if (y < WORLD_SIZE_Y - 1 &&
blocks[Chunk::index(x, y + 1, z)] == 7) {
continue;
}
blocks[Chunk::index(x, y, z)] = 0; blocks[Chunk::index(x, y, z)] = 0;
} }
} }