diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-10-13 11:53:28 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-10-13 11:53:28 +0200 |
commit | f7da7c2536b438db92bc28b88c4139d9af15e44f (patch) | |
tree | 4710e9e41ebcf2317ebacade2801732ba9184b41 /source/SandSimulator.cpp | |
parent | ProtoProxy: Fixed parsing of the PACKET_PLAYER_ABILITIES packet. (diff) | |
download | cuberite-f7da7c2536b438db92bc28b88c4139d9af15e44f.tar cuberite-f7da7c2536b438db92bc28b88c4139d9af15e44f.tar.gz cuberite-f7da7c2536b438db92bc28b88c4139d9af15e44f.tar.bz2 cuberite-f7da7c2536b438db92bc28b88c4139d9af15e44f.tar.lz cuberite-f7da7c2536b438db92bc28b88c4139d9af15e44f.tar.xz cuberite-f7da7c2536b438db92bc28b88c4139d9af15e44f.tar.zst cuberite-f7da7c2536b438db92bc28b88c4139d9af15e44f.zip |
Diffstat (limited to 'source/SandSimulator.cpp')
-rw-r--r-- | source/SandSimulator.cpp | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/source/SandSimulator.cpp b/source/SandSimulator.cpp deleted file mode 100644 index a2e1dc4cb..000000000 --- a/source/SandSimulator.cpp +++ /dev/null @@ -1,102 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "SandSimulator.h" -#include "World.h" -#include "Vector3i.h" -#include "BlockID.h" -#include "Defines.h" -#include "FallingBlock.h" - - - - -cSandSimulator::cSandSimulator( cWorld* a_World ) - : cSimulator(a_World) - , m_Blocks(new BlockList) - , m_Buffer(new BlockList) -{ - -} - - - - - -cSandSimulator::~cSandSimulator() -{ - delete m_Buffer; - delete m_Blocks; -} - - - - - -void cSandSimulator::Simulate( float a_Dt ) -{ - m_Buffer->clear(); - std::swap( m_Blocks, m_Buffer ); - - for( BlockList::iterator itr = m_Buffer->begin(); itr != m_Buffer->end(); ++itr ) - { - Vector3i Pos = *itr; - BLOCKTYPE BlockID = m_World->GetBlock(Pos.x, Pos.y, Pos.z); - if(!IsAllowedBlock(BlockID)) - continue; - - BLOCKTYPE BottomBlock = m_World->GetBlock( Pos.x, Pos.y - 1, Pos.z ); - - if( IsPassable(BottomBlock) ) - { - cFallingBlock * FallingBlock = new cFallingBlock( Pos, BlockID ); - FallingBlock->Initialize( m_World ); - m_World->SetBlock( Pos.x, Pos.y, Pos.z, E_BLOCK_AIR, 0 ); - } - } - -} - - - - - -bool cSandSimulator::IsAllowedBlock( BLOCKTYPE a_BlockType ) -{ - return a_BlockType == E_BLOCK_SAND - || a_BlockType == E_BLOCK_GRAVEL; -} - - - - - -void cSandSimulator::AddBlock(int a_X, int a_Y, int a_Z) -{ - if(!IsAllowedBlock(m_World->GetBlock(a_X, a_Y, a_Z))) - return; - - Vector3i Block(a_X, a_Y, a_Z); - - //check for duplicates - for( BlockList::iterator itr = m_Blocks->begin(); itr != m_Blocks->end(); ++itr ) - { - Vector3i Pos = *itr; - if( Pos.x == a_X && Pos.y == a_Y && Pos.z == a_Z ) - return; - } - - m_Blocks->push_back(Block); -} - - - - - -bool cSandSimulator::IsPassable( BLOCKTYPE a_BlockType ) -{ - return a_BlockType == E_BLOCK_AIR - || IsBlockWater(a_BlockType) - || IsBlockLava(a_BlockType) - || a_BlockType == E_BLOCK_FIRE; -} |