summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorPilzAdam <pilzadam@minetest.net>2013-09-09 15:32:55 +0200
committerPilzAdam <pilzadam@minetest.net>2013-11-02 15:47:44 +0100
commit0d35350b698a9b82722c8568e2f2d987068cdbaf (patch)
treecdecc16eacade2dc9a1c89c6a0bd495423380d54 /src/map.cpp
parent2bf9abade2c758fcebc37a589b65e894c898fc6e (diff)
downloadminetest-0d35350b698a9b82722c8568e2f2d987068cdbaf.tar.gz
minetest-0d35350b698a9b82722c8568e2f2d987068cdbaf.tar.bz2
minetest-0d35350b698a9b82722c8568e2f2d987068cdbaf.zip
Fix liquid_range
* Prevent graphical glitches on old servers * Fix flowing of liquids with viscosity != 1 and range != 8 * Fix range = 0, no flowing nodes will appear
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/map.cpp b/src/map.cpp
index e8115d39b..968897c0c 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -2136,6 +2136,7 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> & modified_blocks)
content_t new_node_content;
s8 new_node_level = -1;
s8 max_node_level = -1;
+ u8 range = rangelim(nodemgr->get(liquid_kind).liquid_range, 0, LIQUID_LEVEL_MAX+1);
if ((num_sources >= 2 && nodemgr->get(liquid_kind).liquid_renewable) || liquid_type == LIQUID_SOURCE) {
// liquid_kind will be set to either the flowing alternative of the node (if it's a liquid)
// or the flowing alternative of the first of the surrounding sources (if it's air), so
@@ -2145,6 +2146,8 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> & modified_blocks)
// liquid_kind is set properly, see above
new_node_content = liquid_kind;
max_node_level = new_node_level = LIQUID_LEVEL_MAX;
+ if (new_node_level < (LIQUID_LEVEL_MAX+1-range))
+ new_node_content = CONTENT_AIR;
} else {
// no surrounding sources, so get the maximum level that can flow into this node
for (u16 i = 0; i < num_flows; i++) {
@@ -2185,8 +2188,7 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> & modified_blocks)
} else
new_node_level = max_node_level;
- u8 range = rangelim(nodemgr->get(liquid_kind).liquid_range, 0, LIQUID_LEVEL_MAX+1);
- if (new_node_level >= (LIQUID_LEVEL_MAX+1-range))
+ if (max_node_level >= (LIQUID_LEVEL_MAX+1-range))
new_node_content = liquid_kind;
else
new_node_content = CONTENT_AIR;