summaryrefslogtreecommitdiffstats
path: root/src/Simulator/FloodyFluidSimulator.cpp
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-03-05 14:54:38 +0100
committerandrew <xdotftw@gmail.com>2014-03-05 14:54:38 +0100
commit1ea17c0a75b84d5f4070c57ad2a7d6cbb4e8b79b (patch)
tree4a59ab434a79832b28ce930faef83f9edd46e651 /src/Simulator/FloodyFluidSimulator.cpp
parentMerge pull request #748 from xdot/master (diff)
downloadcuberite-1ea17c0a75b84d5f4070c57ad2a7d6cbb4e8b79b.tar
cuberite-1ea17c0a75b84d5f4070c57ad2a7d6cbb4e8b79b.tar.gz
cuberite-1ea17c0a75b84d5f4070c57ad2a7d6cbb4e8b79b.tar.bz2
cuberite-1ea17c0a75b84d5f4070c57ad2a7d6cbb4e8b79b.tar.lz
cuberite-1ea17c0a75b84d5f4070c57ad2a7d6cbb4e8b79b.tar.xz
cuberite-1ea17c0a75b84d5f4070c57ad2a7d6cbb4e8b79b.tar.zst
cuberite-1ea17c0a75b84d5f4070c57ad2a7d6cbb4e8b79b.zip
Diffstat (limited to '')
-rw-r--r--src/Simulator/FloodyFluidSimulator.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/Simulator/FloodyFluidSimulator.cpp b/src/Simulator/FloodyFluidSimulator.cpp
index 95182345c..b1ac734d7 100644
--- a/src/Simulator/FloodyFluidSimulator.cpp
+++ b/src/Simulator/FloodyFluidSimulator.cpp
@@ -86,7 +86,12 @@ void cFloodyFluidSimulator::SimulateBlock(cChunk * a_Chunk, int a_RelX, int a_Re
{
// Spread only down, possibly washing away what's there or turning lava to stone / cobble / obsidian:
SpreadToNeighbor(a_Chunk, a_RelX, a_RelY - 1, a_RelZ, 8);
- SpreadFurther = false;
+
+ // Source blocks spread both downwards and sideways
+ if (MyMeta != 0)
+ {
+ SpreadFurther = false;
+ }
}
// If source creation is on, check for it here:
else if (
@@ -105,10 +110,7 @@ void cFloodyFluidSimulator::SimulateBlock(cChunk * a_Chunk, int a_RelX, int a_Re
if (SpreadFurther && (NewMeta < 8))
{
// Spread to the neighbors:
- SpreadToNeighbor(a_Chunk, a_RelX - 1, a_RelY, a_RelZ, NewMeta);
- SpreadToNeighbor(a_Chunk, a_RelX + 1, a_RelY, a_RelZ, NewMeta);
- SpreadToNeighbor(a_Chunk, a_RelX, a_RelY, a_RelZ - 1, NewMeta);
- SpreadToNeighbor(a_Chunk, a_RelX, a_RelY, a_RelZ + 1, NewMeta);
+ Spread(a_Chunk, a_RelX, a_RelY, a_RelZ, NewMeta);
}
// Mark as processed:
@@ -119,6 +121,17 @@ void cFloodyFluidSimulator::SimulateBlock(cChunk * a_Chunk, int a_RelX, int a_Re
+void cFloodyFluidSimulator::Spread(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_NewMeta)
+{
+ SpreadToNeighbor(a_Chunk, a_RelX - 1, a_RelY, a_RelZ, a_NewMeta);
+ SpreadToNeighbor(a_Chunk, a_RelX + 1, a_RelY, a_RelZ, a_NewMeta);
+ SpreadToNeighbor(a_Chunk, a_RelX, a_RelY, a_RelZ - 1, a_NewMeta);
+ SpreadToNeighbor(a_Chunk, a_RelX, a_RelY, a_RelZ + 1, a_NewMeta);
+}
+
+
+
+
bool cFloodyFluidSimulator::CheckTributaries(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_MyMeta)
{
// If we have a section above, check if there's fluid above this block that would feed it: