|
@@ -89,6 +89,7 @@ void FluidBlock::doFlow()
|
|
|
}
|
|
|
bool changed = false;
|
|
|
int minNeighborDistance = maxFlowDistance;
|
|
|
+ char nextFlowOptions = 0;
|
|
|
for (int i = 0; i < 6; i++)
|
|
|
{
|
|
|
Direction dir = getDirectionFromIndex(i);
|
|
@@ -99,9 +100,7 @@ void FluidBlock::doFlow()
|
|
|
FluidBlock* neighbour
|
|
|
= dynamic_cast<FluidBlock*>(zNeighbours[i]);
|
|
|
minNeighborDistance = 0;
|
|
|
- distanceToSource = neighbour->distanceToSource + 1;
|
|
|
- flowOptions = (char)getOppositeDirection(dir);
|
|
|
- changed = true;
|
|
|
+ nextFlowOptions = (char)getOppositeDirection(dir);
|
|
|
}
|
|
|
continue;
|
|
|
}
|
|
@@ -144,21 +143,14 @@ void FluidBlock::doFlow()
|
|
|
FluidBlock* neighbour = dynamic_cast<FluidBlock*>(zNeighbours[i]);
|
|
|
if (neighbour)
|
|
|
{
|
|
|
- if (distanceToSource > neighbour->distanceToSource + 1)
|
|
|
- {
|
|
|
- distanceToSource = neighbour->distanceToSource + 1;
|
|
|
- flowOptions = (char)getOppositeDirection(dir);
|
|
|
- changed = true;
|
|
|
- }
|
|
|
- else if (distanceToSource == neighbour->distanceToSource + 1)
|
|
|
- {
|
|
|
- char tmp = flowOptions;
|
|
|
- flowOptions |= (char)getOppositeDirection(dir);
|
|
|
- changed |= tmp != flowOptions;
|
|
|
- }
|
|
|
if (neighbour->distanceToSource < minNeighborDistance)
|
|
|
{
|
|
|
minNeighborDistance = neighbour->distanceToSource;
|
|
|
+ nextFlowOptions = (char)getOppositeDirection(dir);
|
|
|
+ }
|
|
|
+ else if (neighbour->distanceToSource == minNeighborDistance)
|
|
|
+ {
|
|
|
+ nextFlowOptions = (char)getOppositeDirection(dir);
|
|
|
}
|
|
|
}
|
|
|
}
|