diff options
Diffstat (limited to '')
-rw-r--r-- | source/Simulator/FluidSimulator.cpp | 55 |
1 files changed, 48 insertions, 7 deletions
diff --git a/source/Simulator/FluidSimulator.cpp b/source/Simulator/FluidSimulator.cpp index 4c867aa79..f1930c91f 100644 --- a/source/Simulator/FluidSimulator.cpp +++ b/source/Simulator/FluidSimulator.cpp @@ -19,14 +19,9 @@ cFluidSimulator::cFluidSimulator(cWorld * a_World, BLOCKTYPE a_Fluid, BLOCKTYPE -bool cFluidSimulator::IsPassableForFluid(BLOCKTYPE a_BlockType) +bool cFluidSimulator::IsAllowedBlock(BLOCKTYPE a_BlockType) { - return ( - (a_BlockType == E_BLOCK_AIR) || - (a_BlockType == E_BLOCK_FIRE) || - IsAllowedBlock(a_BlockType) || - CanWashAway(a_BlockType) - ); + return ((a_BlockType == m_FluidBlock) || (a_BlockType == m_StationaryFluidBlock)); } @@ -65,6 +60,52 @@ bool cFluidSimulator::IsSolidBlock(BLOCKTYPE a_BlockType) +bool cFluidSimulator::IsPassableForFluid(BLOCKTYPE a_BlockType) +{ + return ( + (a_BlockType == E_BLOCK_AIR) || + (a_BlockType == E_BLOCK_FIRE) || + IsAllowedBlock(a_BlockType) || + CanWashAway(a_BlockType) + ); +} + + + + + +bool cFluidSimulator::IsHigherMeta(NIBBLETYPE a_Meta1, NIBBLETYPE a_Meta2) +{ + if (a_Meta1 == 0) + { + // Source block is higher than anything, even itself. + return true; + } + if ((a_Meta1 & 0x08) != 0) + { + // Falling fluid is higher than anything, including self + return true; + } + + if (a_Meta2 == 0) + { + // Second block is a source and first block isn't + return false; + } + if ((a_Meta2 & 0x08) != 0) + { + // Second block is falling and the first one is neither a source nor falling + return false; + } + + // All special cases have been handled, now it's just a raw comparison: + return (a_Meta1 < a_Meta2); +} + + + + + // TODO Not working very well yet :s Direction cFluidSimulator::GetFlowingDirection(int a_X, int a_Y, int a_Z, bool a_Over) { |