diff options
author | Mattes D <github@xoft.cz> | 2014-03-02 22:03:44 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-03-02 22:03:44 +0100 |
commit | d25e4d4179c00f1692c4d348baece49561c49938 (patch) | |
tree | c180208ae9759403cc29c4784103569793e6cc63 /src/BlockInfo.cpp | |
parent | Fixed MSVC warnings in DeprecatedBindings. (diff) | |
parent | Removed if condition (diff) | |
download | cuberite-d25e4d4179c00f1692c4d348baece49561c49938.tar cuberite-d25e4d4179c00f1692c4d348baece49561c49938.tar.gz cuberite-d25e4d4179c00f1692c4d348baece49561c49938.tar.bz2 cuberite-d25e4d4179c00f1692c4d348baece49561c49938.tar.lz cuberite-d25e4d4179c00f1692c4d348baece49561c49938.tar.xz cuberite-d25e4d4179c00f1692c4d348baece49561c49938.tar.zst cuberite-d25e4d4179c00f1692c4d348baece49561c49938.zip |
Diffstat (limited to 'src/BlockInfo.cpp')
-rw-r--r-- | src/BlockInfo.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp index c73ae18b6..399efcd9b 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,22 @@ cBlockInfo::cBlockInfo() , m_RequiresSpecialTool(false) , m_IsSolid(true) , m_FullyOccupiesVoxel(false) + , m_Handler(NULL) {} +cBlockInfo::~cBlockInfo() +{ + delete m_Handler; +} + + + + + cBlockInfo & cBlockInfo::Get(BLOCKTYPE a_Type) { ASSERT(a_Type < 256); @@ -42,6 +53,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; |