mapgen: drop mapgen id from child mapgens.
[oweals/minetest.git] / src / mapgen / cavegen.cpp
index e7b98e84f5da7e04a30bbb4d6fa2e9a4b998a661..e54d76e08e1d74879651b18089d6496051256321 100644 (file)
@@ -507,7 +507,16 @@ void CavesRandomWalk::carveRoute(v3f vec, float f, bool randomize_xz)
        MapNode liquidnode = CONTENT_IGNORE;
 
        if (bmgn) {
-               Biome *biome = (Biome *)bmgn->calcBiomeAtPoint(cpabs);
+               Biome *biome = nullptr;
+               if (cpabs.X < node_min.X || cpabs.X > node_max.X ||
+                               cpabs.Z < node_min.Z || cpabs.Z > node_max.Z)
+                       // Point is outside heat and humidity noise maps so use point noise
+                       // calculations.
+                       biome = (Biome *)bmgn->calcBiomeAtPoint(cpabs);
+               else
+                       // Point is inside heat and humidity noise maps so use them
+                       biome = (Biome *)bmgn->getBiomeAtPoint(cpabs);
+
                if (biome->c_cave_liquid != CONTENT_IGNORE)
                        liquidnode = biome->c_cave_liquid;
        }
@@ -569,9 +578,6 @@ void CavesRandomWalk::carveRoute(v3f vec, float f, bool randomize_xz)
                                        else
                                                vm->m_data[i] = airnode;
                                } else {
-                                       if (c == CONTENT_IGNORE)
-                                               continue;
-
                                        vm->m_data[i] = airnode;
                                        vm->m_flags[i] |= VMANIP_FLAG_CAVE;
                                }
@@ -874,7 +880,7 @@ void CavesV6::carveRoute(v3f vec, float f, bool randomize_xz,
                                                vm->m_data[i] = airnode;
                                        }
                                } else {
-                                       if (c == CONTENT_IGNORE || c == CONTENT_AIR)
+                                       if (c == CONTENT_AIR)
                                                continue;
 
                                        vm->m_data[i] = airnode;