1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-13 00:25:19 +02:00

Schematic: Properly deal with before/after node resolving and document (#11011)

This fixes an out-of-bounds index access when the node resolver was already applied to the schematic (i.e. biome decoration).
Also improves the handling of the two cases: prior node resolving (m_nodenames), and after node resolving (manual lookup)
This commit is contained in:
SmallJoker
2021-03-20 13:02:15 +01:00
committed by GitHub
parent a8cc3bdb08
commit 05719913ac
7 changed files with 154 additions and 87 deletions

View File

@@ -1675,8 +1675,7 @@ bool NodeDefManager::nodeboxConnects(MapNode from, MapNode to,
NodeResolver::NodeResolver()
{
m_nodenames.reserve(16);
m_nnlistsizes.reserve(4);
reset();
}
@@ -1779,3 +1778,16 @@ bool NodeResolver::getIdsFromNrBacklog(std::vector<content_t> *result_out,
return success;
}
void NodeResolver::reset(bool resolve_done)
{
m_nodenames.clear();
m_nodenames_idx = 0;
m_nnlistsizes.clear();
m_nnlistsizes_idx = 0;
m_resolve_done = resolve_done;
m_nodenames.reserve(16);
m_nnlistsizes.reserve(4);
}