diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2017-06-25 23:08:31 +0200 |
---|---|---|
committer | Loic Blot <loic.blot@unix-experience.fr> | 2017-06-25 23:08:31 +0200 |
commit | 1237206d4bdf840ae89018d14a0510035d54d0d3 (patch) | |
tree | 6c6860d720d4cc4da89c1fc139cf2ca3697f96c2 /src/mg_ore.cpp | |
parent | c08cc0533fbf344be5243485f39a471268855149 (diff) | |
download | minetest-1237206d4bdf840ae89018d14a0510035d54d0d3.tar.gz minetest-1237206d4bdf840ae89018d14a0510035d54d0d3.tar.bz2 minetest-1237206d4bdf840ae89018d14a0510035d54d0d3.zip |
Revert "Ores: Make 'absheight' flag non-functional"
This reverts commit 90ed6fc732ca667ca970b7c38d39c809e5c3553e.
Diffstat (limited to 'src/mg_ore.cpp')
-rw-r--r-- | src/mg_ore.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/mg_ore.cpp b/src/mg_ore.cpp index 73af2e2e6..f959ca9e6 100644 --- a/src/mg_ore.cpp +++ b/src/mg_ore.cpp @@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc., FlagDesc flagdesc_ore[] = { - {"absheight", OREFLAG_ABSHEIGHT}, // Non-functional + {"absheight", OREFLAG_ABSHEIGHT}, {"puff_cliffs", OREFLAG_PUFF_CLIFFS}, {"puff_additive_composition", OREFLAG_PUFF_ADDITIVE}, {NULL, 0} @@ -87,11 +87,22 @@ void Ore::resolveNodeNames() size_t Ore::placeOre(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) { - if (!(nmin.Y <= y_max && nmax.Y >= y_min)) + int in_range = 0; + + in_range |= (nmin.Y <= y_max && nmax.Y >= y_min); + if (flags & OREFLAG_ABSHEIGHT) + in_range |= (nmin.Y >= -y_max && nmax.Y <= -y_min) << 1; + if (!in_range) return 0; - int actual_ymin = MYMAX(nmin.Y, y_min); - int actual_ymax = MYMIN(nmax.Y, y_max); + int actual_ymin, actual_ymax; + if (in_range & ORE_RANGE_MIRROR) { + actual_ymin = MYMAX(nmin.Y, -y_max); + actual_ymax = MYMIN(nmax.Y, -y_min); + } else { + actual_ymin = MYMAX(nmin.Y, y_min); + actual_ymax = MYMIN(nmax.Y, y_max); + } if (clust_size >= actual_ymax - actual_ymin + 1) return 0; |