mirror of
https://github.com/moparisthebest/minetest
synced 2024-12-22 23:58:48 -05:00
Mgv7, mgflat, mgfractal: Tunnel generation code optimisation
This commit is contained in:
parent
e661d8b32c
commit
4fdf66bbf4
@ -591,17 +591,18 @@ void MapgenFlat::generateCaves(s16 max_stone_y)
|
|||||||
// Ground
|
// Ground
|
||||||
float d1 = contour(noise_cave1->result[index3d]);
|
float d1 = contour(noise_cave1->result[index3d]);
|
||||||
float d2 = contour(noise_cave2->result[index3d]);
|
float d2 = contour(noise_cave2->result[index3d]);
|
||||||
|
|
||||||
if (d1 * d2 > 0.3f && ndef->get(c).is_ground_content) {
|
if (d1 * d2 > 0.3f && ndef->get(c).is_ground_content) {
|
||||||
// In tunnel and ground content, excavate
|
// In tunnel and ground content, excavate
|
||||||
vm->m_data[vi] = MapNode(CONTENT_AIR);
|
vm->m_data[vi] = MapNode(CONTENT_AIR);
|
||||||
is_tunnel = true;
|
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 {
|
} 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;
|
column_is_open = false;
|
||||||
is_tunnel = false;
|
is_tunnel = false;
|
||||||
}
|
}
|
||||||
|
@ -719,17 +719,18 @@ void MapgenFractal::generateCaves(s16 max_stone_y)
|
|||||||
// Ground
|
// Ground
|
||||||
float d1 = contour(noise_cave1->result[index3d]);
|
float d1 = contour(noise_cave1->result[index3d]);
|
||||||
float d2 = contour(noise_cave2->result[index3d]);
|
float d2 = contour(noise_cave2->result[index3d]);
|
||||||
|
|
||||||
if (d1 * d2 > 0.3f && ndef->get(c).is_ground_content) {
|
if (d1 * d2 > 0.3f && ndef->get(c).is_ground_content) {
|
||||||
// In tunnel and ground content, excavate
|
// In tunnel and ground content, excavate
|
||||||
vm->m_data[vi] = MapNode(CONTENT_AIR);
|
vm->m_data[vi] = MapNode(CONTENT_AIR);
|
||||||
is_tunnel = true;
|
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 {
|
} 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;
|
column_is_open = false;
|
||||||
is_tunnel = false;
|
is_tunnel = false;
|
||||||
}
|
}
|
||||||
|
@ -772,17 +772,18 @@ void MapgenV7::generateCaves(s16 max_stone_y)
|
|||||||
// Ground
|
// Ground
|
||||||
float d1 = contour(noise_cave1->result[index3d]);
|
float d1 = contour(noise_cave1->result[index3d]);
|
||||||
float d2 = contour(noise_cave2->result[index3d]);
|
float d2 = contour(noise_cave2->result[index3d]);
|
||||||
|
|
||||||
if (d1 * d2 > 0.3f && ndef->get(c).is_ground_content) {
|
if (d1 * d2 > 0.3f && ndef->get(c).is_ground_content) {
|
||||||
// In tunnel and ground content, excavate
|
// In tunnel and ground content, excavate
|
||||||
vm->m_data[vi] = MapNode(CONTENT_AIR);
|
vm->m_data[vi] = MapNode(CONTENT_AIR);
|
||||||
is_tunnel = true;
|
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 {
|
} 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;
|
column_is_open = false;
|
||||||
is_tunnel = false;
|
is_tunnel = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user