From: Wuzzy Date: Fri, 10 Apr 2020 18:36:16 +0000 (+0200) Subject: Print error if invalid mapgen alias was detected (#9579) X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=aa3cf400e2ca4096517e926dbae5b6337b2f1876;p=oweals%2Fminetest.git Print error if invalid mapgen alias was detected (#9579) --- diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp index 79c429ff6..6c426ba41 100644 --- a/src/mapgen/mapgen.cpp +++ b/src/mapgen/mapgen.cpp @@ -629,6 +629,13 @@ MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emer // Lava falls back to water as both are suitable as cave liquids. if (c_lava_source == CONTENT_IGNORE) c_lava_source = c_water_source; + + if (c_stone == CONTENT_IGNORE) + errorstream << "Mapgen: Mapgen alias 'mapgen_stone' is invalid!" << std::endl; + if (c_water_source == CONTENT_IGNORE) + errorstream << "Mapgen: Mapgen alias 'mapgen_water_source' is invalid!" << std::endl; + if (c_river_water_source == CONTENT_IGNORE) + warningstream << "Mapgen: Mapgen alias 'mapgen_river_water_source' is invalid!" << std::endl; } diff --git a/src/mapgen/mapgen_v6.cpp b/src/mapgen/mapgen_v6.cpp index 653adc8ec..8a863c044 100644 --- a/src/mapgen/mapgen_v6.cpp +++ b/src/mapgen/mapgen_v6.cpp @@ -132,6 +132,21 @@ MapgenV6::MapgenV6(MapgenV6Params *params, EmergeManager *emerge) c_stair_cobble = c_cobble; if (c_stair_desert_stone == CONTENT_IGNORE) c_stair_desert_stone = c_desert_stone; + + if (c_stone == CONTENT_IGNORE) + errorstream << "Mapgen v6: Mapgen alias 'mapgen_stone' is invalid!" << std::endl; + if (c_dirt == CONTENT_IGNORE) + errorstream << "Mapgen v6: Mapgen alias 'mapgen_dirt' is invalid!" << std::endl; + if (c_dirt_with_grass == CONTENT_IGNORE) + errorstream << "Mapgen v6: Mapgen alias 'mapgen_dirt_with_grass' is invalid!" << std::endl; + if (c_sand == CONTENT_IGNORE) + errorstream << "Mapgen v6: Mapgen alias 'mapgen_sand' is invalid!" << std::endl; + if (c_water_source == CONTENT_IGNORE) + errorstream << "Mapgen v6: Mapgen alias 'mapgen_water_source' is invalid!" << std::endl; + if (c_lava_source == CONTENT_IGNORE) + errorstream << "Mapgen v6: Mapgen alias 'mapgen_lava_source' is invalid!" << std::endl; + if (c_cobble == CONTENT_IGNORE) + errorstream << "Mapgen v6: Mapgen alias 'mapgen_cobble' is invalid!" << std::endl; } diff --git a/src/mapgen/treegen.cpp b/src/mapgen/treegen.cpp index 0d8af2851..89bdef73b 100644 --- a/src/mapgen/treegen.cpp +++ b/src/mapgen/treegen.cpp @@ -44,6 +44,12 @@ void make_tree(MMVManip &vmanip, v3s16 p0, bool is_apple_tree, MapNode treenode(ndef->getId("mapgen_tree")); MapNode leavesnode(ndef->getId("mapgen_leaves")); MapNode applenode(ndef->getId("mapgen_apple")); + if (treenode == CONTENT_IGNORE) + errorstream << "Treegen: Mapgen alias 'mapgen_tree' is invalid!" << std::endl; + if (leavesnode == CONTENT_IGNORE) + errorstream << "Treegen: Mapgen alias 'mapgen_leaves' is invalid!" << std::endl; + if (applenode == CONTENT_IGNORE) + errorstream << "Treegen: Mapgen alias 'mapgen_apple' is invalid!" << std::endl; PseudoRandom pr(seed); s16 trunk_h = pr.range(4, 5); @@ -145,6 +151,9 @@ treegen::error make_ltree(MMVManip &vmanip, v3s16 p0, const NodeDefManager *ndef, TreeDef tree_definition) { MapNode dirtnode(ndef->getId("mapgen_dirt")); + if (dirtnode == CONTENT_IGNORE) + errorstream << "Treegen (make_ltree): Mapgen alias 'mapgen_dirt' is invalid!" << std::endl; + s32 seed; if (tree_definition.explicit_seed) seed = tree_definition.seed + 14002; @@ -662,6 +671,10 @@ void make_jungletree(MMVManip &vmanip, v3s16 p0, const NodeDefManager *ndef, c_tree = ndef->getId("mapgen_tree"); if (c_leaves == CONTENT_IGNORE) c_leaves = ndef->getId("mapgen_leaves"); + if (c_tree == CONTENT_IGNORE) + errorstream << "Treegen: Mapgen alias 'mapgen_jungletree' is invalid!" << std::endl; + if (c_leaves == CONTENT_IGNORE) + errorstream << "Treegen: Mapgen alias 'mapgen_jungleleaves' is invalid!" << std::endl; MapNode treenode(c_tree); MapNode leavesnode(c_leaves); @@ -765,6 +778,10 @@ void make_pine_tree(MMVManip &vmanip, v3s16 p0, const NodeDefManager *ndef, c_leaves = ndef->getId("mapgen_leaves"); if (c_snow == CONTENT_IGNORE) c_snow = CONTENT_AIR; + if (c_tree == CONTENT_IGNORE) + errorstream << "Treegen: Mapgen alias 'mapgen_pine_tree' is invalid!" << std::endl; + if (c_leaves == CONTENT_IGNORE) + errorstream << "Treegen: Mapgen alias 'mapgen_pine_needles' is invalid!" << std::endl; MapNode treenode(c_tree); MapNode leavesnode(c_leaves);