diff options
author | proller <proller@github.com> | 2013-07-04 22:30:25 +0400 |
---|---|---|
committer | proller <proller@github.com> | 2013-07-05 00:11:11 +0400 |
commit | 92833a07d111c55f61b23f66fd8aaa95f3239c33 (patch) | |
tree | 0199c221d5358b06f76b09734ce42f92f4e36c8f /src | |
parent | a013f762c4c9b39a1d143ee1b68e6d8e86dcee22 (diff) | |
download | minetest-92833a07d111c55f61b23f66fd8aaa95f3239c33.tar.gz minetest-92833a07d111c55f61b23f66fd8aaa95f3239c33.tar.bz2 minetest-92833a07d111c55f61b23f66fd8aaa95f3239c33.zip |
Improve finite liquid distribution, fix small bug
Diffstat (limited to 'src')
-rw-r--r-- | src/map.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/map.cpp b/src/map.cpp index 272bc9322..f128aff6c 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1653,6 +1653,8 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks) u16 loop_max = g_settings->getU16("liquid_loop_max"); + //if (m_transforming_liquid.size() > 0) errorstream << "Liquid queue size="<<m_transforming_liquid.size()<<std::endl; + while (m_transforming_liquid.size() > 0) { // 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) } // prevent lakes in air above unloaded blocks - if (liquid_levels[D_TOP] == 0 && (p0.Y > water_level || !fast_flood) && neighbors[D_BOTTOM].n.getContent() == CONTENT_IGNORE) { + if (liquid_levels[D_TOP] == 0 && (p0.Y > water_level) && neighbors[D_BOTTOM].n.getContent() == CONTENT_IGNORE && !(loopcount % 3)) { --total_level; } @@ -1794,11 +1796,16 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks) if (!neighbors[ii].l) continue; liquid_levels_want[ii] = want_level; - if (liquid_levels_want[ii] < LIQUID_LEVEL_SOURCE && total_level > 0 - && liquid_levels[ii] > liquid_levels_want[ii] - ) { - ++liquid_levels_want[ii]; - --total_level; + if (liquid_levels_want[ii] < LIQUID_LEVEL_SOURCE && total_level > 0) { + if (loopcount % 3 || liquid_levels[ii] <= 0){ + if (liquid_levels[ii] > liquid_levels_want[ii]) { + ++liquid_levels_want[ii]; + --total_level; + } + } else if (neighbors[ii].l > 0){ + ++liquid_levels_want[ii]; + --total_level; + } } } |