summaryrefslogtreecommitdiff
path: root/src/mapgen.cpp
diff options
context:
space:
mode:
authorproller <proller@github.com>2013-06-30 01:29:21 +0400
committerproller <proller@github.com>2013-06-30 01:29:21 +0400
commit848c3fe51a842950b14547491c74aaf580dc83ec (patch)
treeaa4995a07d3db8d08f0e08453b88ff0af50b2fae /src/mapgen.cpp
parent21a4adcd27de83a814f2ff296d867b9876dc35c1 (diff)
downloadminetest-848c3fe51a842950b14547491c74aaf580dc83ec.tar.gz
minetest-848c3fe51a842950b14547491c74aaf580dc83ec.tar.bz2
minetest-848c3fe51a842950b14547491c74aaf580dc83ec.zip
Optimize liquid queue on generate map for liquid_finite
Diffstat (limited to 'src/mapgen.cpp')
-rw-r--r--src/mapgen.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mapgen.cpp b/src/mapgen.cpp
index 7343d10fd..23af1f398 100644
--- a/src/mapgen.cpp
+++ b/src/mapgen.cpp
@@ -836,8 +836,10 @@ void Mapgen::updateHeightmap(v3s16 nmin, v3s16 nmax) {
void Mapgen::updateLiquid(UniqueQueue<v3s16> *trans_liquid, v3s16 nmin, v3s16 nmax) {
- bool isliquid, wasliquid;
+ bool isliquid, wasliquid, rare;
v3s16 em = vm->m_area.getExtent();
+ rare = g_settings->getBool("liquid_finite");
+ int rarecnt = 0;
for (s16 z = nmin.Z; z <= nmax.Z; z++) {
for (s16 x = nmin.X; x <= nmax.X; x++) {
@@ -847,8 +849,8 @@ void Mapgen::updateLiquid(UniqueQueue<v3s16> *trans_liquid, v3s16 nmin, v3s16 nm
for (s16 y = nmax.Y; y >= nmin.Y; y--) {
isliquid = ndef->get(vm->m_data[i]).isLiquid();
- // there was a change between liquid and nonliquid, add to queue
- if (isliquid != wasliquid)
+ // there was a change between liquid and nonliquid, add to queue. no need to add every with liquid_finite
+ if (isliquid != wasliquid && (!rare || !(rarecnt++ % 36)))
trans_liquid->push_back(v3s16(x, y, z));
wasliquid = isliquid;