Node resolver: Make error on fallback optional, disable for mapgen aliases

This commit is contained in:
Paramat 2018-04-20 20:26:30 +01:00 committed by GitHub
parent 87ad4d8e7f
commit 0e554706ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 17 deletions

@ -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);
}

@ -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;
@ -1639,6 +1639,7 @@ bool NodeResolver::getIdFromNrBacklog(content_t *result_out,
}
if (!success) {
if (error_on_fallback)
errorstream << "NodeResolver: failed to resolve node name '" << name
<< "'." << std::endl;
c = c_fallback;

@ -733,7 +733,8 @@ public:
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);