summaryrefslogtreecommitdiffstats
path: root/src/BlockInfo.cpp
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-03-02 20:25:05 +0100
committerandrew <xdotftw@gmail.com>2014-03-02 20:25:05 +0100
commit070d483236279e69c736e740fa8459d3ac627790 (patch)
treed4431ca58c236556056e041b3d888ea61e7ac144 /src/BlockInfo.cpp
parentFixed MSVC warnings in DeprecatedBindings. (diff)
downloadcuberite-070d483236279e69c736e740fa8459d3ac627790.tar
cuberite-070d483236279e69c736e740fa8459d3ac627790.tar.gz
cuberite-070d483236279e69c736e740fa8459d3ac627790.tar.bz2
cuberite-070d483236279e69c736e740fa8459d3ac627790.tar.lz
cuberite-070d483236279e69c736e740fa8459d3ac627790.tar.xz
cuberite-070d483236279e69c736e740fa8459d3ac627790.tar.zst
cuberite-070d483236279e69c736e740fa8459d3ac627790.zip
Diffstat (limited to 'src/BlockInfo.cpp')
-rw-r--r--src/BlockInfo.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp
index c73ae18b6..195af49c7 100644
--- a/src/BlockInfo.cpp
+++ b/src/BlockInfo.cpp
@@ -2,6 +2,7 @@
#include "Globals.h"
#include "BlockInfo.h"
+#include "Blocks/BlockHandler.h"
@@ -23,12 +24,25 @@ cBlockInfo::cBlockInfo()
, m_RequiresSpecialTool(false)
, m_IsSolid(true)
, m_FullyOccupiesVoxel(false)
+ , m_Handler(NULL)
{}
+cBlockInfo::~cBlockInfo()
+{
+ if (m_Handler != NULL)
+ {
+ delete m_Handler;
+ }
+}
+
+
+
+
+
cBlockInfo & cBlockInfo::Get(BLOCKTYPE a_Type)
{
ASSERT(a_Type < 256);
@@ -42,6 +56,14 @@ cBlockInfo & cBlockInfo::Get(BLOCKTYPE a_Type)
void cBlockInfo::Initialize(void)
{
+ for (unsigned int i = 0; i < 256; ++i)
+ {
+ if (ms_Info[i].m_Handler == NULL)
+ {
+ ms_Info[i].m_Handler = cBlockHandler::CreateBlockHandler((BLOCKTYPE) i);
+ }
+ }
+
// Emissive blocks
ms_Info[E_BLOCK_FIRE ].m_LightValue = 15;
ms_Info[E_BLOCK_GLOWSTONE ].m_LightValue = 15;