Skip to content

Commit 7b93408

Browse files
committedDec 23, 2014
Make limiting of the reflow liquids queue size optional
If liquid_queue_purge_time == 0 then disable the queue size limiting and make this the default setting Additionally, liquid_loop_max now defaults to 100000
1 parent 0c37d48 commit 7b93408

File tree

3 files changed

+21
-23
lines changed

3 files changed

+21
-23
lines changed
 

‎minetest.conf.example

+4-3
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,11 @@
9999
# Enable a bit lower water surface; disable for speed (not quite optimized)
100100
#new_style_water = false
101101
# Max liquids processed per step
102-
#liquid_loop_max = 10000
102+
#liquid_loop_max = 100000
103103
# The time (in seconds) that the liquids queue may grow beyond processing
104-
# capacity until an attempt is made to decrease its size by dumping old queue items
105-
#liquid_queue_purge_time = 30
104+
# capacity until an attempt is made to decrease its size by dumping old queue
105+
# items. A value of 0 disables the functionality.
106+
#liquid_queue_purge_time = 0
106107
# Update liquids every .. recommend for finite: 0.2
107108
#liquid_update = 1.0
108109
# Enable nice leaves; disable for speed

‎src/defaultsettings.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ void set_default_settings(Settings *settings)
276276
settings->setDefault("movement_gravity", "9.81");
277277

278278
//liquid stuff
279-
settings->setDefault("liquid_loop_max", "10000");
280-
settings->setDefault("liquid_queue_purge_time", "30");
279+
settings->setDefault("liquid_loop_max", "100000");
280+
settings->setDefault("liquid_queue_purge_time", "0");
281281
settings->setDefault("liquid_update", "1.0");
282282

283283
//mapgen stuff

‎src/map.cpp

+15-18
Original file line numberDiff line numberDiff line change
@@ -1624,8 +1624,6 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> & modified_blocks)
16241624
u32 loopcount = 0;
16251625
u32 initial_size = m_transforming_liquid.size();
16261626

1627-
u32 curr_time = getTime(PRECISION_MILLI);
1628-
16291627
/*if(initial_size != 0)
16301628
infostream<<"transformLiquids(): initial_size="<<initial_size<<std::endl;*/
16311629

@@ -1638,11 +1636,11 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> & modified_blocks)
16381636
u32 liquid_loop_max = g_settings->getS32("liquid_loop_max");
16391637
u32 loop_max = liquid_loop_max;
16401638

1641-
// std::cout << "transformLiquids(): loopmax initial="
1642-
// << loop_max * m_transforming_liquid_loop_count_multiplier;
1639+
#if 0
16431640

1644-
// If liquid_loop_max is not keeping up with the queue size increase
1645-
// loop_max up to a maximum of liquid_loop_max * dedicated_server_step.
1641+
/* If liquid_loop_max is not keeping up with the queue size increase
1642+
* loop_max up to a maximum of liquid_loop_max * dedicated_server_step.
1643+
*/
16461644
if (m_transforming_liquid.size() > loop_max * 2) {
16471645
// "Burst" mode
16481646
float server_step = g_settings->getFloat("dedicated_server_step");
@@ -1653,9 +1651,7 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> & modified_blocks)
16531651
}
16541652

16551653
loop_max *= m_transforming_liquid_loop_count_multiplier;
1656-
1657-
// std::cout << " queue sz=" << m_transforming_liquid.size()
1658-
// << " loop_max=" << loop_max;
1654+
#endif
16591655

16601656
while(m_transforming_liquid.size() != 0)
16611657
{
@@ -1913,9 +1909,17 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> & modified_blocks)
19131909
updateLighting(lighting_modified_blocks, modified_blocks);
19141910

19151911

1916-
/*
1917-
* Queue size limiting
1912+
/* ----------------------------------------------------------------------
1913+
* Manage the queue so that it does not grow indefinately
19181914
*/
1915+
u16 time_until_purge = g_settings->getU16("liquid_queue_purge_time");
1916+
1917+
if (time_until_purge == 0)
1918+
return; // Feature disabled
1919+
1920+
time_until_purge *= 1000; // seconds -> milliseconds
1921+
1922+
u32 curr_time = getTime(PRECISION_MILLI);
19191923
u32 prev_unprocessed = m_unprocessed_count;
19201924
m_unprocessed_count = m_transforming_liquid.size();
19211925

@@ -1928,13 +1932,6 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> & modified_blocks)
19281932
m_queue_size_timer_started = true;
19291933
}
19301934

1931-
u16 time_until_purge = g_settings->getU16("liquid_queue_purge_time");
1932-
time_until_purge *= 1000; // seconds -> milliseconds
1933-
1934-
// std::cout << " growing for: "
1935-
// << (m_queue_size_timer_started ? curr_time - m_inc_trend_up_start_time : 0)
1936-
// << "ms" << std::endl;
1937-
19381935
// Account for curr_time overflowing
19391936
if (m_queue_size_timer_started && m_inc_trending_up_start_time > curr_time)
19401937
m_queue_size_timer_started = false;

0 commit comments

Comments
 (0)
Please sign in to comment.