aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2013-03-24 20:19:29 -0400
committerkwolekr <kwolekr@minetest.net>2013-03-24 20:19:59 -0400
commit8d13967aa3a802df8fa8d97fcce32fea2b46f2bf (patch)
tree466a9aacdcda9932cdbf1c0900d70078c4851946
parent650d706d35d93f93e5c86f6045f026594ec71753 (diff)
downloadminetest-8d13967aa3a802df8fa8d97fcce32fea2b46f2bf.tar.gz
minetest-8d13967aa3a802df8fa8d97fcce32fea2b46f2bf.tar.bz2
minetest-8d13967aa3a802df8fa8d97fcce32fea2b46f2bf.zip
Ensure ore can fit in OreSheet::generate()
-rw-r--r--src/mapgen.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mapgen.cpp b/src/mapgen.cpp
index 53b5d6867..689ad63cb 100644
--- a/src/mapgen.cpp
+++ b/src/mapgen.cpp
@@ -141,8 +141,10 @@ void OreSheet::generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) {
PseudoRandom pr(blockseed + 4234);
int ymin = MYMAX(nmin.Y, height_min);
- int ymax = MYMIN(nmax.Y, height_max);
-
+ int ymax = MYMIN(nmax.Y, height_max);
+ if (clust_size >= ymax - ymin + 1)
+ return;
+
int x0 = nmin.X;
int z0 = nmin.Z;
@@ -150,7 +152,6 @@ void OreSheet::generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) {
int z1 = nmax.Z;
int max_height = clust_size;
-
int y_start = pr.range(ymin, ymax - max_height);
if (!noise) {