diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-03-10 19:36:55 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-03-10 19:36:55 +0100 |
commit | cc2d8052383d64ffe21e53a7ec401ed7ee345fcd (patch) | |
tree | 55571ea694182bf2c00f055a275be2df5ada703f /src/BlockInfo.cpp | |
parent | Shrapnel now configurable (diff) | |
parent | Fixed #778 - stack overflow.com (diff) | |
download | cuberite-cc2d8052383d64ffe21e53a7ec401ed7ee345fcd.tar cuberite-cc2d8052383d64ffe21e53a7ec401ed7ee345fcd.tar.gz cuberite-cc2d8052383d64ffe21e53a7ec401ed7ee345fcd.tar.bz2 cuberite-cc2d8052383d64ffe21e53a7ec401ed7ee345fcd.tar.lz cuberite-cc2d8052383d64ffe21e53a7ec401ed7ee345fcd.tar.xz cuberite-cc2d8052383d64ffe21e53a7ec401ed7ee345fcd.tar.zst cuberite-cc2d8052383d64ffe21e53a7ec401ed7ee345fcd.zip |
Diffstat (limited to 'src/BlockInfo.cpp')
-rw-r--r-- | src/BlockInfo.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp index c73ae18b6..d1ecfdf7e 100644 --- a/src/BlockInfo.cpp +++ b/src/BlockInfo.cpp @@ -2,6 +2,7 @@ #include "Globals.h" #include "BlockInfo.h" +#include "Blocks/BlockHandler.h" @@ -23,16 +24,24 @@ cBlockInfo::cBlockInfo() , m_RequiresSpecialTool(false) , m_IsSolid(true) , m_FullyOccupiesVoxel(false) + , m_Handler(NULL) {} -cBlockInfo & cBlockInfo::Get(BLOCKTYPE a_Type) +cBlockInfo::~cBlockInfo() { - ASSERT(a_Type < 256); + delete m_Handler; +} + + + + +cBlockInfo & cBlockInfo::Get(BLOCKTYPE a_Type) +{ return ms_Info[a_Type]; } @@ -42,6 +51,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; @@ -252,6 +269,11 @@ void cBlockInfo::Initialize(void) ms_Info[E_BLOCK_VINES ].m_IsSnowable = false; ms_Info[E_BLOCK_WALLSIGN ].m_IsSnowable = false; ms_Info[E_BLOCK_WATER ].m_IsSnowable = false; + ms_Info[E_BLOCK_RAIL ].m_IsSnowable = false; + ms_Info[E_BLOCK_ACTIVATOR_RAIL ].m_IsSnowable = false; + ms_Info[E_BLOCK_POWERED_RAIL ].m_IsSnowable = false; + ms_Info[E_BLOCK_DETECTOR_RAIL ].m_IsSnowable = false; + ms_Info[E_BLOCK_COBWEB ].m_IsSnowable = false; // Blocks that don't drop without a special tool: @@ -290,6 +312,10 @@ void cBlockInfo::Initialize(void) ms_Info[E_BLOCK_STONE_PRESSURE_PLATE].m_RequiresSpecialTool = true; ms_Info[E_BLOCK_STONE_SLAB ].m_RequiresSpecialTool = true; ms_Info[E_BLOCK_VINES ].m_RequiresSpecialTool = true; + ms_Info[E_BLOCK_FURNACE ].m_RequiresSpecialTool = true; + ms_Info[E_BLOCK_LIT_FURNACE ].m_RequiresSpecialTool = true; + ms_Info[E_BLOCK_ANVIL ].m_RequiresSpecialTool = true; + ms_Info[E_BLOCK_ENCHANTMENT_TABLE ].m_RequiresSpecialTool = true; // Nonsolid blocks: |