Skip to content

Commit b1ebd9f

Browse files
committedJun 20, 2013
Add a setting for max loop count per step in liquid update
1 parent c2cdace commit b1ebd9f

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed
 

‎minetest.conf.example

+7-1
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,17 @@
9393
#new_style_water = false
9494
# Constant volume liquids
9595
#liquid_finite = false
96+
# Max liquids processed per step
97+
#liquid_loop_max = 1000
9698
# Update liquids every .. recommend for finite: 0.2
9799
#liquid_update = 1.0
98-
# When finite liquid: relax flowing blocks to source if level near max and N nearby source blocks, more realistic, but not true constant. values: 0,1,2,3,4 : 0 - disable, 1 - most aggresive
100+
# Relax flowing blocks to source if level near max and N nearby
101+
# source blocks, more realistic, but not true constant.
102+
# values: 0,1,2,3,4 : 0 - disable, 1 - most aggresive
103+
# (for finite liquids)
99104
#liquid_relax = 2
100105
# Optimization: faster cave flood (and not true constant)
106+
# (for finite liquids)
101107
#liquid_fast_flood = 1
102108
# Underground water and lava springs, its infnity sources if liquid_finite enabled
103109
#underground_springs = 1

‎src/defaultsettings.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ void set_default_settings(Settings *settings)
209209

210210
//liquid stuff
211211
settings->setDefault("liquid_finite", "false");
212+
settings->setDefault("liquid_loop_max", "1000");
212213
settings->setDefault("liquid_update", "1.0");
213214
settings->setDefault("liquid_relax", "2");
214215
settings->setDefault("liquid_fast_flood", "1");

‎src/map.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -1651,10 +1651,12 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks)
16511651
// List of MapBlocks that will require a lighting update (due to lava)
16521652
std::map<v3s16, MapBlock*> lighting_modified_blocks;
16531653

1654+
u16 loop_max = g_settings->getU16("liquid_loop_max");
1655+
16541656
while (m_transforming_liquid.size() > 0)
16551657
{
16561658
// This should be done here so that it is done when continue is used
1657-
if (loopcount >= initial_size || loopcount >= 1000)
1659+
if (loopcount >= initial_size || loopcount >= loop_max)
16581660
break;
16591661
loopcount++;
16601662
/*
@@ -1993,10 +1995,12 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> & modified_blocks)
19931995
// List of MapBlocks that will require a lighting update (due to lava)
19941996
std::map<v3s16, MapBlock*> lighting_modified_blocks;
19951997

1998+
u16 loop_max = g_settings->getU16("liquid_loop_max");
1999+
19962000
while(m_transforming_liquid.size() != 0)
19972001
{
19982002
// This should be done here so that it is done when continue is used
1999-
if(loopcount >= initial_size || loopcount >= 10000)
2003+
if(loopcount >= initial_size || loopcount >= loop_max)
20002004
break;
20012005
loopcount++;
20022006

0 commit comments

Comments
 (0)
Please sign in to comment.