From e3badd7062d4bee62335cf100f3f91ef4c370aae Mon Sep 17 00:00:00 2001 From: kwolekr Date: Sat, 16 Mar 2013 19:37:27 -0400 Subject: Make saplings only grow on dirt or grass, make jungle tree trunks only replace air --- src/treegen.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'src/treegen.cpp') diff --git a/src/treegen.cpp b/src/treegen.cpp index 9df528a21..808cf916a 100644 --- a/src/treegen.cpp +++ b/src/treegen.cpp @@ -528,19 +528,27 @@ void make_jungletree(VoxelManipulator &vmanip, v3s16 p0, continue; v3s16 p1 = p0 + v3s16(x,0,z); v3s16 p2 = p0 + v3s16(x,-1,z); - if(vmanip.m_area.contains(p2) - && vmanip.m_data[vmanip.m_area.index(p2)] == CONTENT_AIR) - vmanip.m_data[vmanip.m_area.index(p2)] = treenode; - else if(vmanip.m_area.contains(p1)) - vmanip.m_data[vmanip.m_area.index(p1)] = treenode; + u32 vi1 = vmanip.m_area.index(p1); + u32 vi2 = vmanip.m_area.index(p2); + + if (vmanip.m_area.contains(p2) && + vmanip.m_data[vi2].getContent() == CONTENT_AIR) + vmanip.m_data[vi2] = treenode; + else if (vmanip.m_area.contains(p1) && + vmanip.m_data[vi1].getContent() == CONTENT_AIR) + vmanip.m_data[vi1] = treenode; } + vmanip.m_data[vmanip.m_area.index(p0)] = treenode; s16 trunk_h = pr.range(8, 12); v3s16 p1 = p0; - for(s16 ii=0; ii