Skip to content

Commit

Permalink
Improve finite liquid distribution, fix small bug
Browse files Browse the repository at this point in the history
  • Loading branch information
proller committed Jul 4, 2013
1 parent a013f76 commit 92833a0
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/map.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}
}
}

Expand Down

0 comments on commit 92833a0

Please sign in to comment.