diff options
author | andrew <xdotftw@gmail.com> | 2014-03-02 20:25:05 +0100 |
---|---|---|
committer | andrew <xdotftw@gmail.com> | 2014-03-02 20:25:05 +0100 |
commit | 070d483236279e69c736e740fa8459d3ac627790 (patch) | |
tree | d4431ca58c236556056e041b3d888ea61e7ac144 /src/Blocks/BlockHandler.cpp | |
parent | Fixed MSVC warnings in DeprecatedBindings. (diff) | |
download | cuberite-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 '')
-rw-r--r-- | src/Blocks/BlockHandler.cpp | 45 |
1 files changed, 2 insertions, 43 deletions
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index 834727c9a..052f88f7a 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -77,33 +77,6 @@ -bool cBlockHandler::m_HandlerInitialized = false; -cBlockHandler * cBlockHandler::m_BlockHandler[256]; - - - - - -cBlockHandler * cBlockHandler::GetBlockHandler(BLOCKTYPE a_BlockType) -{ - if (!m_HandlerInitialized) - { - // We have to initialize - memset(m_BlockHandler, 0, sizeof(m_BlockHandler)); - m_HandlerInitialized = true; - } - if (m_BlockHandler[a_BlockType] != NULL) - { - return m_BlockHandler[a_BlockType]; - } - - return m_BlockHandler[a_BlockType] = CreateBlockHandler(a_BlockType); -} - - - - - cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) { switch(a_BlockType) @@ -192,7 +165,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_REDSTONE_REPEATER_ON: return new cBlockRedstoneRepeaterHandler(a_BlockType); case E_BLOCK_REDSTONE_TORCH_OFF: return new cBlockRedstoneTorchHandler (a_BlockType); case E_BLOCK_REDSTONE_TORCH_ON: return new cBlockRedstoneTorchHandler (a_BlockType); - case E_BLOCK_REDSTONE_WIRE: return new cBlockRedstoneHandler (a_BlockType); + case E_BLOCK_REDSTONE_WIRE: return new cBlockRedstoneHandler (a_BlockType); case E_BLOCK_RED_MUSHROOM: return new cBlockMushroomHandler (a_BlockType); case E_BLOCK_RED_ROSE: return new cBlockFlowerHandler (a_BlockType); case E_BLOCK_SAND: return new cBlockSandHandler (a_BlockType); @@ -231,20 +204,6 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) -void cBlockHandler::Deinit() -{ - for (int i = 0; i < 256; i++) - { - delete m_BlockHandler[i]; - } - memset(m_BlockHandler, 0, sizeof(m_BlockHandler)); // Don't leave any dangling pointers around, just in case - m_HandlerInitialized = false; -} - - - - - cBlockHandler::cBlockHandler(BLOCKTYPE a_BlockType) { m_BlockType = a_BlockType; @@ -329,7 +288,7 @@ void cBlockHandler::NeighborChanged(cChunkInterface & a_ChunkInterface, int a_Bl { if ((a_BlockY >= 0) && (a_BlockY < cChunkDef::Height)) { - GetBlockHandler(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ))->OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ); + cBlockInfo::GetHandler(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ))->OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ); } } |