mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
slight improvement
This commit is contained in:
parent
01df186d0e
commit
b9deee2147
1 changed files with 4 additions and 11 deletions
|
@ -429,17 +429,10 @@ void MapBlock::serialize(std::ostream &os_compressed, u8 version, bool disk, int
|
||||||
const u8 params_width = 2;
|
const u8 params_width = 2;
|
||||||
if(disk)
|
if(disk)
|
||||||
{
|
{
|
||||||
MapNode *tmp_nodes;
|
const int size = m_is_mono_block ? 1 : nodecount;
|
||||||
if (m_is_mono_block) {
|
MapNode *tmp_nodes = new MapNode[size];
|
||||||
tmp_nodes = new MapNode[1];
|
memcpy(tmp_nodes, data, size * sizeof(MapNode));
|
||||||
tmp_nodes[0] = data[0];
|
getBlockNodeIdMapping(&nimap, tmp_nodes, m_gamedef->ndef(), size);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tmp_nodes = new MapNode[nodecount];
|
|
||||||
memcpy(tmp_nodes, data, nodecount * sizeof(MapNode));
|
|
||||||
}
|
|
||||||
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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue