1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

getBlockNodeIdMapping signature

This commit is contained in:
Lars 2025-05-20 13:48:35 -07:00
parent 46bec0a7ee
commit 43a86a0efe

View file

@ -297,12 +297,12 @@ void MapBlock::expireIsAirCache()
// Note that there's no technical reason why we *have to* renumber the IDs, // Note that there's no technical reason why we *have to* renumber the IDs,
// but we do it anyway as it also helps compressability. // but we do it anyway as it also helps compressability.
static void getBlockNodeIdMapping(NameIdMapping *nimap, MapNode *nodes, static void getBlockNodeIdMapping(NameIdMapping *nimap, MapNode *nodes,
const NodeDefManager *nodedef, bool is_mono_block) const NodeDefManager *nodedef, u32 nodecount)
{ {
IdIdMapping &mapping = IdIdMapping::giveClearedThreadLocalInstance(); IdIdMapping &mapping = IdIdMapping::giveClearedThreadLocalInstance();
content_t id_counter = 0; content_t id_counter = 0;
for (u32 i = 0; i < (is_mono_block ? 1 : MapBlock::nodecount); i++) { for (u32 i = 0; i < nodecount; i++) {
content_t global_id = nodes[i].getContent(); content_t global_id = nodes[i].getContent();
content_t id = CONTENT_IGNORE; content_t id = CONTENT_IGNORE;
@ -424,7 +424,7 @@ void MapBlock::serialize(std::ostream &os_compressed, u8 version, bool disk, int
tmp_nodes = new MapNode[nodecount]; tmp_nodes = new MapNode[nodecount];
memcpy(tmp_nodes, data, nodecount * sizeof(MapNode)); memcpy(tmp_nodes, data, nodecount * sizeof(MapNode));
} }
getBlockNodeIdMapping(&nimap, tmp_nodes, m_gamedef->ndef(), m_is_mono_block); getBlockNodeIdMapping(&nimap, tmp_nodes, m_gamedef->ndef(), m_is_mono_block ? 1 : nodecount);
buf = MapNode::serializeBulk(version, tmp_nodes, nodecount, buf = MapNode::serializeBulk(version, tmp_nodes, nodecount,
content_width, params_width, m_is_mono_block); content_width, params_width, m_is_mono_block);