summaryrefslogtreecommitdiffstats
path: root/source/Simulator/FluidSimulator.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-14 19:06:21 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-14 19:06:21 +0200
commit5b7de82a79e3f18affcffd686484a681d187942a (patch)
tree3a0b766fd827de634456bee9ea9ce225f40bfb60 /source/Simulator/FluidSimulator.cpp
parentBiomal CompoGen now generates sea with STATIONARY_WATER instead of regular WATER. (diff)
downloadcuberite-5b7de82a79e3f18affcffd686484a681d187942a.tar
cuberite-5b7de82a79e3f18affcffd686484a681d187942a.tar.gz
cuberite-5b7de82a79e3f18affcffd686484a681d187942a.tar.bz2
cuberite-5b7de82a79e3f18affcffd686484a681d187942a.tar.lz
cuberite-5b7de82a79e3f18affcffd686484a681d187942a.tar.xz
cuberite-5b7de82a79e3f18affcffd686484a681d187942a.tar.zst
cuberite-5b7de82a79e3f18affcffd686484a681d187942a.zip
Diffstat (limited to 'source/Simulator/FluidSimulator.cpp')
-rw-r--r--source/Simulator/FluidSimulator.cpp55
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)
{