MCPcopy Create free account
hub / github.com/cuberite/cuberite / SetSize

Method SetSize

src/BlockArea.cpp:1709–1753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1707
1708
1709bool cBlockArea::SetSize(int a_SizeX, int a_SizeY, int a_SizeZ, int a_DataTypes)
1710{
1711 ASSERT(m_BlockTypes == NULL); // Has been cleared
1712
1713 if (a_DataTypes & baTypes)
1714 {
1715 m_BlockTypes = new BLOCKTYPE[a_SizeX * a_SizeY * a_SizeZ];
1716 if (m_BlockTypes == NULL)
1717 {
1718 return false;
1719 }
1720 }
1721 if (a_DataTypes & baMetas)
1722 {
1723 m_BlockMetas = new NIBBLETYPE[a_SizeX * a_SizeY * a_SizeZ];
1724 if (m_BlockMetas == NULL)
1725 {
1726 delete[] m_BlockTypes;
1727 return false;
1728 }
1729 }
1730 if (a_DataTypes & baLight)
1731 {
1732 m_BlockLight = new NIBBLETYPE[a_SizeX * a_SizeY * a_SizeZ];
1733 if (m_BlockLight == NULL)
1734 {
1735 delete[] m_BlockMetas;
1736 delete[] m_BlockTypes;
1737 return false;
1738 }
1739 }
1740 if (a_DataTypes & baSkyLight)
1741 {
1742 m_BlockSkyLight = new NIBBLETYPE[a_SizeX * a_SizeY * a_SizeZ];
1743 if (m_BlockSkyLight == NULL)
1744 {
1745 delete[] m_BlockLight;
1746 delete[] m_BlockMetas;
1747 delete[] m_BlockTypes;
1748 return false;
1749 }
1750 }
1751 m_Size.Set(a_SizeX, a_SizeY, a_SizeZ);
1752 return true;
1753}
1754
1755
1756

Callers 3

CopyToMethod · 0.45
ReadBlockAreaMethod · 0.45
LoadFromSchematicNBTMethod · 0.45

Calls 1

SetMethod · 0.45

Tested by

no test coverage detected