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