From ae6d83a41ed958b65ec7f6584d7b042ae6a6e51f Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Wed, 21 Sep 2011 23:31:55 +0300 Subject: Better apple tree generation --- src/mapgen.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 026248ad4..a07f4cac8 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); } -- cgit v1.2.3