From: Perttu Ahola Date: Wed, 21 Sep 2011 20:31:55 +0000 (+0300) Subject: Better apple tree generation X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=ae6d83a41ed958b65ec7f6584d7b042ae6a6e51f;p=zefram%2Fminetest%2Fminetest_engine.git Better apple tree generation --- diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 026248ad..a07f4cac 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -80,16 +80,12 @@ static s16 find_ground_level_clever(VoxelManipulator &vmanip, v2s16 p2d) } #endif -static void make_tree(VoxelManipulator &vmanip, v3s16 p0) +static void make_tree(VoxelManipulator &vmanip, v3s16 p0, bool is_apple_tree) { MapNode treenode(CONTENT_TREE); MapNode leavesnode(CONTENT_LEAVES); MapNode applenode(CONTENT_APPLE); - bool is_apple_tree = myrand_range(0,100) < 35?true:false; - s16 apple_count = 0; - - s16 trunk_h = myrand_range(4, 5); v3s16 p1 = p0; for(s16 ii=0; iiseed, v2s16(x, y)) < 0.5) if(is_jungle == false) - make_tree(vmanip, p); + { + bool is_apple_tree; + if(myrand_range(0,4) != 0) + is_apple_tree = false; + else + is_apple_tree = noise2d_perlin( + 0.5+(float)p.X/100, 0.5+(float)p.Z/100, + data->seed+342902, 3, 0.45) > 0.2; + make_tree(vmanip, p, is_apple_tree); + } else make_jungletree(vmanip, p); }