forked from Mirrorlandia_minetest/minetest
Node resolver: Make error on fallback optional, disable for mapgen aliases
This commit is contained in:
parent
87ad4d8e7f
commit
0e554706ac
@ -317,16 +317,16 @@ Biome *BiomeGenOriginal::calcBiomeFromNoise(float heat, float humidity, v3s16 po
|
|||||||
|
|
||||||
void Biome::resolveNodeNames()
|
void Biome::resolveNodeNames()
|
||||||
{
|
{
|
||||||
getIdFromNrBacklog(&c_top, "mapgen_stone", CONTENT_AIR);
|
getIdFromNrBacklog(&c_top, "mapgen_stone", CONTENT_AIR, false);
|
||||||
getIdFromNrBacklog(&c_filler, "mapgen_stone", CONTENT_AIR);
|
getIdFromNrBacklog(&c_filler, "mapgen_stone", CONTENT_AIR, false);
|
||||||
getIdFromNrBacklog(&c_stone, "mapgen_stone", CONTENT_AIR);
|
getIdFromNrBacklog(&c_stone, "mapgen_stone", CONTENT_AIR, false);
|
||||||
getIdFromNrBacklog(&c_water_top, "mapgen_water_source", CONTENT_AIR);
|
getIdFromNrBacklog(&c_water_top, "mapgen_water_source", CONTENT_AIR, false);
|
||||||
getIdFromNrBacklog(&c_water, "mapgen_water_source", CONTENT_AIR);
|
getIdFromNrBacklog(&c_water, "mapgen_water_source", CONTENT_AIR, false);
|
||||||
getIdFromNrBacklog(&c_river_water, "mapgen_river_water_source", CONTENT_AIR);
|
getIdFromNrBacklog(&c_river_water, "mapgen_river_water_source", CONTENT_AIR, false);
|
||||||
getIdFromNrBacklog(&c_riverbed, "mapgen_stone", CONTENT_AIR);
|
getIdFromNrBacklog(&c_riverbed, "mapgen_stone", CONTENT_AIR, false);
|
||||||
getIdFromNrBacklog(&c_dust, "ignore", CONTENT_IGNORE);
|
getIdFromNrBacklog(&c_dust, "ignore", CONTENT_IGNORE, false);
|
||||||
getIdFromNrBacklog(&c_cave_liquid, "ignore", CONTENT_IGNORE);
|
getIdFromNrBacklog(&c_cave_liquid, "ignore", CONTENT_IGNORE, false);
|
||||||
getIdFromNrBacklog(&c_dungeon, "ignore", CONTENT_IGNORE);
|
getIdFromNrBacklog(&c_dungeon, "ignore", CONTENT_IGNORE, false);
|
||||||
getIdFromNrBacklog(&c_dungeon_alt, "ignore", CONTENT_IGNORE);
|
getIdFromNrBacklog(&c_dungeon_alt, "ignore", CONTENT_IGNORE, false);
|
||||||
getIdFromNrBacklog(&c_dungeon_stair, "ignore", CONTENT_IGNORE);
|
getIdFromNrBacklog(&c_dungeon_stair, "ignore", CONTENT_IGNORE, false);
|
||||||
}
|
}
|
||||||
|
@ -1621,7 +1621,7 @@ void NodeResolver::nodeResolveInternal()
|
|||||||
|
|
||||||
|
|
||||||
bool NodeResolver::getIdFromNrBacklog(content_t *result_out,
|
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()) {
|
if (m_nodenames_idx == m_nodenames.size()) {
|
||||||
*result_out = c_fallback;
|
*result_out = c_fallback;
|
||||||
@ -1639,6 +1639,7 @@ bool NodeResolver::getIdFromNrBacklog(content_t *result_out,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
if (error_on_fallback)
|
||||||
errorstream << "NodeResolver: failed to resolve node name '" << name
|
errorstream << "NodeResolver: failed to resolve node name '" << name
|
||||||
<< "'." << std::endl;
|
<< "'." << std::endl;
|
||||||
c = c_fallback;
|
c = c_fallback;
|
||||||
|
@ -733,9 +733,10 @@ public:
|
|||||||
virtual void resolveNodeNames() = 0;
|
virtual void resolveNodeNames() = 0;
|
||||||
|
|
||||||
bool getIdFromNrBacklog(content_t *result_out,
|
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 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();
|
void nodeResolveInternal();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user