summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-28 03:38:00 +0100
committerlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-28 03:38:00 +0100
commite3be6b1a47d07c1c86c51e75329bc850ede8809c (patch)
tree89a1b92041746462fc800f020b885587d65c51bc
parent- Implemented Drops from Burning animals (diff)
downloadcuberite-e3be6b1a47d07c1c86c51e75329bc850ede8809c.tar
cuberite-e3be6b1a47d07c1c86c51e75329bc850ede8809c.tar.gz
cuberite-e3be6b1a47d07c1c86c51e75329bc850ede8809c.tar.bz2
cuberite-e3be6b1a47d07c1c86c51e75329bc850ede8809c.tar.lz
cuberite-e3be6b1a47d07c1c86c51e75329bc850ede8809c.tar.xz
cuberite-e3be6b1a47d07c1c86c51e75329bc850ede8809c.tar.zst
cuberite-e3be6b1a47d07c1c86c51e75329bc850ede8809c.zip
-rw-r--r--source/cFluidSimulator.cpp6
-rw-r--r--source/cSandSimulator.cpp3
2 files changed, 8 insertions, 1 deletions
diff --git a/source/cFluidSimulator.cpp b/source/cFluidSimulator.cpp
index bc9bc8aae..9c2b02e76 100644
--- a/source/cFluidSimulator.cpp
+++ b/source/cFluidSimulator.cpp
@@ -85,6 +85,9 @@ cFluidSimulator::~cFluidSimulator()
void cFluidSimulator::AddBlock( int a_X, int a_Y, int a_Z )
{
+ if(!IsAllowedBlock(m_World->GetBlock(a_X, a_Y, a_Z))) //This should save very much time because it doesn´t have to iterate through all blocks
+ return;
+
// Check for duplicates
std::vector< Vector3i > & ActiveFluid = *m_Data->m_ActiveFluid;
for( std::vector< Vector3i >::iterator itr = ActiveFluid.begin(); itr != ActiveFluid.end(); ++itr )
@@ -100,7 +103,7 @@ void cFluidSimulator::AddBlock( int a_X, int a_Y, int a_Z )
char cFluidSimulator::GetHighestLevelAround( int a_X, int a_Y, int a_Z )
{
char Max = m_MaxHeight + 1;
- //TODO Remove define function
+
#define __HIGHLEVEL_CHECK__( x, y, z ) \
if( IsAllowedBlock( m_World->GetBlock( x, y, z ) ) ) \
{ \
@@ -131,6 +134,7 @@ void cFluidSimulator::Simulate( float a_Dt )
std::vector< Vector3i > & FluidBlocks = *m_Data->m_Buffer;
for( std::vector< Vector3i >::iterator itr = FluidBlocks.begin(); itr != FluidBlocks.end(); ++itr )
{
+
Vector3i & pos = *itr;
char BlockID = m_World->GetBlock( pos.x, pos.y, pos.z );
if( IsAllowedBlock( BlockID ) ) // only care about own fluid
diff --git a/source/cSandSimulator.cpp b/source/cSandSimulator.cpp
index b25b498c5..77f206b52 100644
--- a/source/cSandSimulator.cpp
+++ b/source/cSandSimulator.cpp
@@ -51,6 +51,9 @@ bool cSandSimulator::IsAllowedBlock( char a_BlockID )
void cSandSimulator::AddBlock(int a_X, int a_Y, int a_Z)
{
+ if(!IsAllowedBlock(m_World->GetBlock(a_X, a_Y, a_Z))) //This should save very much time because it doesn´t have to iterate through all blocks
+ return;
+
Vector3i *Block = new Vector3i(a_X, a_Y, a_Z);
//check for duplicates