summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorVitaliy <numzer0@yandex.ru>2020-05-21 00:52:10 +0300
committerGitHub <noreply@github.com>2020-05-20 22:52:10 +0100
commit82e41378937378667cdbdda3ea9e8c1acb5822ea (patch)
tree07a5e04b6979b42e763640b8dccec6e7c8855854 /src/map.cpp
parent42fcfb75e85523a2fa5d99a453c2fabc2c04c0f6 (diff)
downloadminetest-82e41378937378667cdbdda3ea9e8c1acb5822ea.tar.gz
minetest-82e41378937378667cdbdda3ea9e8c1acb5822ea.tar.bz2
minetest-82e41378937378667cdbdda3ea9e8c1acb5822ea.zip
Cache liquid alternative IDs (#8053)
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 5f1b984a4..677cbc869 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -568,7 +568,7 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> &modified_blocks,
switch (liquid_type) {
case LIQUID_SOURCE:
liquid_level = LIQUID_LEVEL_SOURCE;
- liquid_kind = m_nodedef->getId(cf.liquid_alternative_flowing);
+ liquid_kind = cf.liquid_alternative_flowing_id;
break;
case LIQUID_FLOWING:
liquid_level = (n0.param2 & LIQUID_LEVEL_MASK);
@@ -641,8 +641,8 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> &modified_blocks,
case LIQUID_SOURCE:
// if this node is not (yet) of a liquid type, choose the first liquid type we encounter
if (liquid_kind == CONTENT_AIR)
- liquid_kind = m_nodedef->getId(cfnb.liquid_alternative_flowing);
- if (m_nodedef->getId(cfnb.liquid_alternative_flowing) != liquid_kind) {
+ liquid_kind = cfnb.liquid_alternative_flowing_id;
+ if (cfnb.liquid_alternative_flowing_id != liquid_kind) {
neutrals[num_neutrals++] = nb;
} else {
// Do not count bottom source, it will screw things up
@@ -653,8 +653,8 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> &modified_blocks,
case LIQUID_FLOWING:
// if this node is not (yet) of a liquid type, choose the first liquid type we encounter
if (liquid_kind == CONTENT_AIR)
- liquid_kind = m_nodedef->getId(cfnb.liquid_alternative_flowing);
- if (m_nodedef->getId(cfnb.liquid_alternative_flowing) != liquid_kind) {
+ liquid_kind = cfnb.liquid_alternative_flowing_id;
+ if (cfnb.liquid_alternative_flowing_id != liquid_kind) {
neutrals[num_neutrals++] = nb;
} else {
flows[num_flows++] = nb;
@@ -680,7 +680,7 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> &modified_blocks,
// 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
// it's perfectly safe to use liquid_kind here to determine the new node content.
- new_node_content = m_nodedef->getId(m_nodedef->get(liquid_kind).liquid_alternative_source);
+ new_node_content = m_nodedef->get(liquid_kind).liquid_alternative_source_id;
} else if (num_sources >= 1 && sources[0].t != NEIGHBOR_LOWER) {
// liquid_kind is set properly, see above
max_node_level = new_node_level = LIQUID_LEVEL_MAX;