summaryrefslogtreecommitdiffstats
path: root/src/BlockInfo.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-09-17 15:51:42 +0200
committerGitHub <noreply@github.com>2020-09-17 15:51:42 +0200
commitc3d2956ba588a4559fabc36a0c1fc7dd28279314 (patch)
treeb8210f994441a20ab08499df442e15fb9afaaf30 /src/BlockInfo.cpp
parentAdd some const qualifiers to functions (#4874) (diff)
downloadcuberite-c3d2956ba588a4559fabc36a0c1fc7dd28279314.tar
cuberite-c3d2956ba588a4559fabc36a0c1fc7dd28279314.tar.gz
cuberite-c3d2956ba588a4559fabc36a0c1fc7dd28279314.tar.bz2
cuberite-c3d2956ba588a4559fabc36a0c1fc7dd28279314.tar.lz
cuberite-c3d2956ba588a4559fabc36a0c1fc7dd28279314.tar.xz
cuberite-c3d2956ba588a4559fabc36a0c1fc7dd28279314.tar.zst
cuberite-c3d2956ba588a4559fabc36a0c1fc7dd28279314.zip
Diffstat (limited to '')
-rw-r--r--src/BlockInfo.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp
index 78ae4c24c..41c8536a7 100644
--- a/src/BlockInfo.cpp
+++ b/src/BlockInfo.cpp
@@ -414,8 +414,7 @@ cBlockInfo::cBlockInfo():
m_FullyOccupiesVoxel(false),
m_CanBeTerraformed(false),
m_BlockHeight(1.0),
- m_Hardness(0.0f),
- m_Handler()
+ m_Hardness(0.0f)
{
}
@@ -423,13 +422,9 @@ cBlockInfo::cBlockInfo():
-bool cBlockInfo::IsSnowable(BLOCKTYPE a_BlockType)
+cBlockHandler * cBlockInfo::GetHandler(BLOCKTYPE a_Type)
{
- return (
- (a_BlockType == E_BLOCK_ICE) ||
- (a_BlockType == E_BLOCK_LEAVES) ||
- (!IsTransparent(a_BlockType) && (a_BlockType != E_BLOCK_PACKED_ICE))
- );
+ return &cBlockHandler::GetBlockHandler(a_Type);
}
@@ -557,9 +552,13 @@ float cBlockInfo::GetExplosionAbsorption(const BLOCKTYPE Block)
-void cBlockInfo::sHandlerDeleter::operator () (cBlockHandler * a_Handler)
+bool cBlockInfo::IsSnowable(BLOCKTYPE a_BlockType)
{
- delete a_Handler;
+ return (
+ (a_BlockType == E_BLOCK_ICE) ||
+ (a_BlockType == E_BLOCK_LEAVES) ||
+ (!IsTransparent(a_BlockType) && (a_BlockType != E_BLOCK_PACKED_ICE))
+ );
}
@@ -573,7 +572,6 @@ cBlockInfo::cBlockInfoArray::cBlockInfoArray()
for (size_t i = 0; i < Info.size(); ++i)
{
Info[i].m_BlockType = static_cast<BLOCKTYPE>(i);
- Info[i].m_Handler.reset(cBlockHandler::CreateBlockHandler(Info[i].m_BlockType));
}
// Emissive blocks