L-system: Fix leaves cutting through stems
authorHybrid Dog <ovvv@web.de>
Mon, 5 Jun 2017 16:52:34 +0000 (18:52 +0200)
committerparamat <mat.gregory@virginmedia.com>
Mon, 14 Aug 2017 11:38:21 +0000 (12:38 +0100)
src/treegen.cpp

index 574cc034d2c5c9f1d7b2916b3cc5ec2669e529e0..25f614d273780936682cf53663ca1b45c3560d1d 100644 (file)
@@ -542,10 +542,13 @@ void tree_trunk_placement(MMVManip &vmanip, v3f p0, TreeDef &tree_definition)
        if (vmanip.m_area.contains(p1) == false)
                return;
        u32 vi = vmanip.m_area.index(p1);
-       if (vmanip.m_data[vi].getContent() != CONTENT_AIR
-                       && vmanip.m_data[vi].getContent() != CONTENT_IGNORE)
+       content_t current_node = vmanip.m_data[vi].getContent();
+       if (current_node != CONTENT_AIR && current_node != CONTENT_IGNORE
+                       && current_node != tree_definition.leavesnode.getContent()
+                       && current_node != tree_definition.leaves2node.getContent()
+                       && current_node != tree_definition.fruitnode.getContent())
                return;
-       vmanip.m_data[vmanip.m_area.index(p1)] = tree_definition.trunknode;
+       vmanip.m_data[vi] = tree_definition.trunknode;
 }