Skip to content

Commit 92833a0

Browse files
committedJul 4, 2013
Improve finite liquid distribution, fix small bug
1 parent a013f76 commit 92833a0

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed
 

‎src/map.cpp

+13-6
Original file line numberDiff line numberDiff line change
@@ -1653,6 +1653,8 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks)
16531653

16541654
u16 loop_max = g_settings->getU16("liquid_loop_max");
16551655

1656+
//if (m_transforming_liquid.size() > 0) errorstream << "Liquid queue size="<<m_transforming_liquid.size()<<std::endl;
1657+
16561658
while (m_transforming_liquid.size() > 0)
16571659
{
16581660
// This should be done here so that it is done when continue is used
@@ -1771,7 +1773,7 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks)
17711773
}
17721774

17731775
// prevent lakes in air above unloaded blocks
1774-
if (liquid_levels[D_TOP] == 0 && (p0.Y > water_level || !fast_flood) && neighbors[D_BOTTOM].n.getContent() == CONTENT_IGNORE) {
1776+
if (liquid_levels[D_TOP] == 0 && (p0.Y > water_level) && neighbors[D_BOTTOM].n.getContent() == CONTENT_IGNORE && !(loopcount % 3)) {
17751777
--total_level;
17761778
}
17771779

@@ -1794,11 +1796,16 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks)
17941796
if (!neighbors[ii].l)
17951797
continue;
17961798
liquid_levels_want[ii] = want_level;
1797-
if (liquid_levels_want[ii] < LIQUID_LEVEL_SOURCE && total_level > 0
1798-
&& liquid_levels[ii] > liquid_levels_want[ii]
1799-
) {
1800-
++liquid_levels_want[ii];
1801-
--total_level;
1799+
if (liquid_levels_want[ii] < LIQUID_LEVEL_SOURCE && total_level > 0) {
1800+
if (loopcount % 3 || liquid_levels[ii] <= 0){
1801+
if (liquid_levels[ii] > liquid_levels_want[ii]) {
1802+
++liquid_levels_want[ii];
1803+
--total_level;
1804+
}
1805+
} else if (neighbors[ii].l > 0){
1806+
++liquid_levels_want[ii];
1807+
--total_level;
1808+
}
18021809
}
18031810
}
18041811

0 commit comments

Comments
 (0)
Please sign in to comment.