aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparamat <mat.gregory@virginmedia.com>2015-06-25 23:55:01 +0100
committerparamat <mat.gregory@virginmedia.com>2015-06-27 03:36:40 +0100
commit36163d96533313f8fd336c04911383569582acc1 (patch)
tree8d66942fade4fe550472b46f92eeb30c8f42fcc8
parentffd16e3feca90c356c55898de2b9f3f5c6bc5c98 (diff)
downloadminetest-36163d96533313f8fd336c04911383569582acc1.tar.gz
minetest-36163d96533313f8fd336c04911383569582acc1.tar.bz2
minetest-36163d96533313f8fd336c04911383569582acc1.zip
Mgv5/mgv7 caves: Remove sand found in underground tunnels
Add missing check for max_stone_y to mgv5 cavegen Tunnels now carve through sand below water_level
-rw-r--r--src/mapgen_v5.cpp18
-rw-r--r--src/mapgen_v7.cpp37
2 files changed, 19 insertions, 36 deletions
diff --git a/src/mapgen_v5.cpp b/src/mapgen_v5.cpp
index 4d1c0df1d..00a1b915d 100644
--- a/src/mapgen_v5.cpp
+++ b/src/mapgen_v5.cpp
@@ -506,30 +506,24 @@ MgStoneType MapgenV5::generateBiomes(float *heat_map, float *humidity_map)
void MapgenV5::generateCaves(int max_stone_y)
{
- u32 index = 0;
- u32 index2d = 0;
+ if (max_stone_y >= node_min.Y) {
+ u32 index = 0;
- for (s16 z=node_min.Z; z<=node_max.Z; z++) {
- for (s16 y=node_min.Y - 1; y<=node_max.Y + 1; y++) {
+ for (s16 z = node_min.Z; z <= node_max.Z; z++)
+ for (s16 y = node_min.Y - 1; y <= node_max.Y + 1; y++) {
u32 i = vm->m_area.index(node_min.X, y, z);
- for (s16 x=node_min.X; x<=node_max.X; x++, i++, index++, index2d++) {
+ for (s16 x = node_min.X; x <= node_max.X; x++, i++, index++) {
float d1 = contour(noise_cave1->result[index]);
float d2 = contour(noise_cave2->result[index]);
if (d1*d2 > 0.125) {
- Biome *biome = (Biome *)bmgr->getRaw(biomemap[index2d]);
content_t c = vm->m_data[i].getContent();
- if (!ndef->get(c).is_ground_content || c == CONTENT_AIR ||
- (y <= water_level &&
- c != biome->c_stone &&
- c != c_stone))
+ if (!ndef->get(c).is_ground_content || c == CONTENT_AIR)
continue;
vm->m_data[i] = MapNode(CONTENT_AIR);
}
}
- index2d -= ystride;
}
- index2d += ystride;
}
if (node_max.Y > LARGE_CAVE_DEPTH)
diff --git a/src/mapgen_v7.cpp b/src/mapgen_v7.cpp
index b5d1463db..7fe5a3848 100644
--- a/src/mapgen_v7.cpp
+++ b/src/mapgen_v7.cpp
@@ -852,32 +852,21 @@ void MapgenV7::generateCaves(int max_stone_y)
{
if (max_stone_y >= node_min.Y) {
u32 index = 0;
- u32 index2d = 0;
-
- for (s16 z = node_min.Z; z <= node_max.Z; z++) {
- for (s16 y = node_min.Y - 1; y <= node_max.Y + 1; y++) {
- u32 i = vm->m_area.index(node_min.X, y, z);
- for (s16 x = node_min.X; x <= node_max.X;
- x++, i++, index++, index2d++) {
- float d1 = contour(noise_cave1->result[index]);
- float d2 = contour(noise_cave2->result[index]);
- if (d1 * d2 > 0.3) {
- Biome *biome = (Biome *)bmgr->
- getRaw(biomemap[index2d]);
- content_t c = vm->m_data[i].getContent();
- if (!ndef->get(c).is_ground_content ||
- c == CONTENT_AIR ||
- (y <= water_level &&
- c != biome->c_stone &&
- c != c_stone))
- continue;
-
- vm->m_data[i] = MapNode(CONTENT_AIR);
- }
+
+ for (s16 z = node_min.Z; z <= node_max.Z; z++)
+ for (s16 y = node_min.Y - 1; y <= node_max.Y + 1; y++) {
+ u32 i = vm->m_area.index(node_min.X, y, z);
+ for (s16 x = node_min.X; x <= node_max.X; x++, i++, index++) {
+ float d1 = contour(noise_cave1->result[index]);
+ float d2 = contour(noise_cave2->result[index]);
+ if (d1 * d2 > 0.3) {
+ content_t c = vm->m_data[i].getContent();
+ if (!ndef->get(c).is_ground_content || c == CONTENT_AIR)
+ continue;
+
+ vm->m_data[i] = MapNode(CONTENT_AIR);
}
- index2d -= ystride;
}
- index2d += ystride;
}
}