Skip to content


Browse files Browse the repository at this point in the history
Node resolver: Make error on fallback optional, disable for mapgen al…
  • Loading branch information
paramat committed Apr 20, 2018
1 parent 87ad4d8 commit 0e55470
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
24 changes: 12 additions & 12 deletions src/mapgen/mg_biome.cpp
Expand Up @@ -317,16 +317,16 @@ Biome *BiomeGenOriginal::calcBiomeFromNoise(float heat, float humidity, v3s16 po

void Biome::resolveNodeNames()
getIdFromNrBacklog(&c_top, "mapgen_stone", CONTENT_AIR);
getIdFromNrBacklog(&c_filler, "mapgen_stone", CONTENT_AIR);
getIdFromNrBacklog(&c_stone, "mapgen_stone", CONTENT_AIR);
getIdFromNrBacklog(&c_water_top, "mapgen_water_source", CONTENT_AIR);
getIdFromNrBacklog(&c_water, "mapgen_water_source", CONTENT_AIR);
getIdFromNrBacklog(&c_river_water, "mapgen_river_water_source", CONTENT_AIR);
getIdFromNrBacklog(&c_riverbed, "mapgen_stone", CONTENT_AIR);
getIdFromNrBacklog(&c_dust, "ignore", CONTENT_IGNORE);
getIdFromNrBacklog(&c_cave_liquid, "ignore", CONTENT_IGNORE);
getIdFromNrBacklog(&c_dungeon, "ignore", CONTENT_IGNORE);
getIdFromNrBacklog(&c_dungeon_alt, "ignore", CONTENT_IGNORE);
getIdFromNrBacklog(&c_dungeon_stair, "ignore", CONTENT_IGNORE);
getIdFromNrBacklog(&c_top, "mapgen_stone", CONTENT_AIR, false);
getIdFromNrBacklog(&c_filler, "mapgen_stone", CONTENT_AIR, false);
getIdFromNrBacklog(&c_stone, "mapgen_stone", CONTENT_AIR, false);
getIdFromNrBacklog(&c_water_top, "mapgen_water_source", CONTENT_AIR, false);
getIdFromNrBacklog(&c_water, "mapgen_water_source", CONTENT_AIR, false);
getIdFromNrBacklog(&c_river_water, "mapgen_river_water_source", CONTENT_AIR, false);
getIdFromNrBacklog(&c_riverbed, "mapgen_stone", CONTENT_AIR, false);
getIdFromNrBacklog(&c_dust, "ignore", CONTENT_IGNORE, false);
getIdFromNrBacklog(&c_cave_liquid, "ignore", CONTENT_IGNORE, false);
getIdFromNrBacklog(&c_dungeon, "ignore", CONTENT_IGNORE, false);
getIdFromNrBacklog(&c_dungeon_alt, "ignore", CONTENT_IGNORE, false);
getIdFromNrBacklog(&c_dungeon_stair, "ignore", CONTENT_IGNORE, false);
7 changes: 4 additions & 3 deletions src/nodedef.cpp
Expand Up @@ -1621,7 +1621,7 @@ void NodeResolver::nodeResolveInternal()

bool NodeResolver::getIdFromNrBacklog(content_t *result_out,
const std::string &node_alt, content_t c_fallback)
const std::string &node_alt, content_t c_fallback, bool error_on_fallback)
if (m_nodenames_idx == m_nodenames.size()) {
*result_out = c_fallback;
Expand All @@ -1639,8 +1639,9 @@ bool NodeResolver::getIdFromNrBacklog(content_t *result_out,

if (!success) {
errorstream << "NodeResolver: failed to resolve node name '" << name
<< "'." << std::endl;
if (error_on_fallback)
errorstream << "NodeResolver: failed to resolve node name '" << name
<< "'." << std::endl;
c = c_fallback;

Expand Down
5 changes: 3 additions & 2 deletions src/nodedef.h
Expand Up @@ -733,9 +733,10 @@ class NodeResolver {
virtual void resolveNodeNames() = 0;

bool getIdFromNrBacklog(content_t *result_out,
const std::string &node_alt, content_t c_fallback);
const std::string &node_alt, content_t c_fallback,
bool error_on_fallback = true);
bool getIdsFromNrBacklog(std::vector<content_t> *result_out,
bool all_required=false, content_t c_fallback=CONTENT_IGNORE);
bool all_required = false, content_t c_fallback = CONTENT_IGNORE);

void nodeResolveInternal();

Expand Down

0 comments on commit 0e55470

Please sign in to comment.