1
0
Fork 0

Print error if invalid mapgen alias was detected (#9579)

mutilcraft-mt53
Wuzzy 2020-04-10 20:36:16 +02:00 committed by GitHub
parent 35e778ee9f
commit aa3cf400e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 0 deletions

View File

@ -629,6 +629,13 @@ MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emer
// Lava falls back to water as both are suitable as cave liquids. // Lava falls back to water as both are suitable as cave liquids.
if (c_lava_source == CONTENT_IGNORE) if (c_lava_source == CONTENT_IGNORE)
c_lava_source = c_water_source; 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;
} }

View File

@ -132,6 +132,21 @@ MapgenV6::MapgenV6(MapgenV6Params *params, EmergeManager *emerge)
c_stair_cobble = c_cobble; c_stair_cobble = c_cobble;
if (c_stair_desert_stone == CONTENT_IGNORE) if (c_stair_desert_stone == CONTENT_IGNORE)
c_stair_desert_stone = c_desert_stone; 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;
} }

View File

@ -44,6 +44,12 @@ void make_tree(MMVManip &vmanip, v3s16 p0, bool is_apple_tree,
MapNode treenode(ndef->getId("mapgen_tree")); MapNode treenode(ndef->getId("mapgen_tree"));
MapNode leavesnode(ndef->getId("mapgen_leaves")); MapNode leavesnode(ndef->getId("mapgen_leaves"));
MapNode applenode(ndef->getId("mapgen_apple")); 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); PseudoRandom pr(seed);
s16 trunk_h = pr.range(4, 5); 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) const NodeDefManager *ndef, TreeDef tree_definition)
{ {
MapNode dirtnode(ndef->getId("mapgen_dirt")); MapNode dirtnode(ndef->getId("mapgen_dirt"));
if (dirtnode == CONTENT_IGNORE)
errorstream << "Treegen (make_ltree): Mapgen alias 'mapgen_dirt' is invalid!" << std::endl;
s32 seed; s32 seed;
if (tree_definition.explicit_seed) if (tree_definition.explicit_seed)
seed = tree_definition.seed + 14002; 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"); c_tree = ndef->getId("mapgen_tree");
if (c_leaves == CONTENT_IGNORE) if (c_leaves == CONTENT_IGNORE)
c_leaves = ndef->getId("mapgen_leaves"); 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 treenode(c_tree);
MapNode leavesnode(c_leaves); 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"); c_leaves = ndef->getId("mapgen_leaves");
if (c_snow == CONTENT_IGNORE) if (c_snow == CONTENT_IGNORE)
c_snow = CONTENT_AIR; 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 treenode(c_tree);
MapNode leavesnode(c_leaves); MapNode leavesnode(c_leaves);