From 4fdf66bbf4d90846844ee3f6d41acb31ce06ca8b Mon Sep 17 00:00:00 2001 From: paramat Date: Tue, 12 Apr 2016 04:43:22 +0100 Subject: Mgv7, mgflat, mgfractal: Tunnel generation code optimisation --- src/mapgen_fractal.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/mapgen_fractal.cpp') diff --git a/src/mapgen_fractal.cpp b/src/mapgen_fractal.cpp index 810645abb..d75d1149e 100644 --- a/src/mapgen_fractal.cpp +++ b/src/mapgen_fractal.cpp @@ -719,17 +719,18 @@ void MapgenFractal::generateCaves(s16 max_stone_y) // Ground float d1 = contour(noise_cave1->result[index3d]); float d2 = contour(noise_cave2->result[index3d]); + if (d1 * d2 > 0.3f && ndef->get(c).is_ground_content) { // In tunnel and ground content, excavate vm->m_data[vi] = MapNode(CONTENT_AIR); is_tunnel = true; - } else if (is_tunnel && column_is_open && - (c == biome->c_filler || c == biome->c_stone)) { - // Tunnel entrance floor - vm->m_data[vi] = MapNode(biome->c_top); - column_is_open = false; - is_tunnel = false; } else { + // Not in tunnel or not ground content + if (is_tunnel && column_is_open && + (c == biome->c_filler || c == biome->c_stone)) + // Tunnel entrance floor + vm->m_data[vi] = MapNode(biome->c_top); + column_is_open = false; is_tunnel = false; } -- cgit v1.2.3