From 66ea356e688879e898dc81a435d76294ac2a1098 Mon Sep 17 00:00:00 2001 From: paramat Date: Mon, 13 Jul 2015 01:17:54 +0100 Subject: [PATCH] Mgv6/treegen: (Re)Add fallback nodes for compatibility with subgames --- src/mapgen_v6.cpp | 8 ++++++++ src/treegen.cpp | 27 ++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index 732ec095..86e2f89a 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -108,6 +108,14 @@ MapgenV6::MapgenV6(int mapgenid, MapgenParams *params, EmergeManager *emerge) c_mossycobble = c_cobble; if (c_stair_cobble == CONTENT_IGNORE) c_stair_cobble = c_cobble; + if (c_dirt_with_snow == CONTENT_IGNORE) + c_dirt_with_snow = c_dirt_with_grass; + if (c_snow == CONTENT_IGNORE) + c_snow = CONTENT_AIR; + if (c_snowblock == CONTENT_IGNORE) + c_snowblock = c_dirt_with_grass; + if (c_ice == CONTENT_IGNORE) + c_ice = c_water_source; } diff --git a/src/treegen.cpp b/src/treegen.cpp index a85d8881..39cb1ca0 100644 --- a/src/treegen.cpp +++ b/src/treegen.cpp @@ -656,8 +656,15 @@ void make_jungletree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef, int seed and in games that have saplings; both are deprecated but not replaced yet */ - MapNode treenode(ndef->getId("mapgen_jungletree")); - MapNode leavesnode(ndef->getId("mapgen_jungleleaves")); + content_t c_tree = ndef->getId("mapgen_jungletree"); + content_t c_leaves = ndef->getId("mapgen_jungleleaves"); + if (c_tree == CONTENT_IGNORE) + c_tree = ndef->getId("mapgen_tree"); + if (c_leaves == CONTENT_IGNORE) + c_leaves = ndef->getId("mapgen_leaves"); + + MapNode treenode(c_tree); + MapNode leavesnode(c_leaves); PseudoRandom pr(seed); for (s16 x= -1; x <= 1; x++) @@ -748,9 +755,19 @@ void make_pine_tree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef, int seed) and in games that have saplings; both are deprecated but not replaced yet */ - MapNode treenode(ndef->getId("mapgen_pinetree")); - MapNode leavesnode(ndef->getId("mapgen_pine_needles")); - MapNode snownode(ndef->getId("mapgen_snow")); + content_t c_tree = ndef->getId("mapgen_pinetree"); + content_t c_leaves = ndef->getId("mapgen_pine_needles"); + content_t c_snow = ndef->getId("mapgen_snow"); + if (c_tree == CONTENT_IGNORE) + c_tree = ndef->getId("mapgen_tree"); + if (c_leaves == CONTENT_IGNORE) + c_leaves = ndef->getId("mapgen_leaves"); + if (c_snow == CONTENT_IGNORE) + c_snow = CONTENT_AIR; + + MapNode treenode(c_tree); + MapNode leavesnode(c_leaves); + MapNode snownode(c_snow); PseudoRandom pr(seed); s16 trunk_h = pr.range(9, 13);