diff options
author | Jozef Behran <jozuejozef@gmail.com> | 2019-08-10 19:45:44 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2019-08-10 19:45:44 +0200 |
commit | 86d7f84b899a507e979f1845f2057cce6f84e743 (patch) | |
tree | ec2d965d61bd639fe879f971b98e30bccab63b52 /src/map.cpp | |
parent | 291e7730cf24ba5081f10b5ddbf2494951333827 (diff) | |
download | minetest-86d7f84b899a507e979f1845f2057cce6f84e743.tar.gz minetest-86d7f84b899a507e979f1845f2057cce6f84e743.tar.bz2 minetest-86d7f84b899a507e979f1845f2057cce6f84e743.zip |
Merge pull request #8776 from osjc/FixGetNode
Finish getNode cleanup
Diffstat (limited to 'src/map.cpp')
-rw-r--r-- | src/map.cpp | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/src/map.cpp b/src/map.cpp index 3d1e74790..590c3f2f5 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -170,7 +170,7 @@ bool Map::isValidPosition(v3s16 p) } // Returns a CONTENT_IGNORE node if not found -MapNode Map::getNodeNoEx(v3s16 p, bool *is_valid_position) +MapNode Map::getNode(v3s16 p, bool *is_valid_position) { v3s16 blockpos = getNodeBlockPos(p); MapBlock *block = getBlockNoCreateNoEx(blockpos); @@ -188,25 +188,6 @@ MapNode Map::getNodeNoEx(v3s16 p, bool *is_valid_position) return node; } -#if 0 -// Deprecated -// throws InvalidPositionException if not found -// TODO: Now this is deprecated, getNodeNoEx should be renamed -MapNode Map::getNode(v3s16 p) -{ - v3s16 blockpos = getNodeBlockPos(p); - MapBlock *block = getBlockNoCreateNoEx(blockpos); - if (block == NULL) - throw InvalidPositionException(); - v3s16 relpos = p - blockpos*MAP_BLOCKSIZE; - bool is_valid_position; - MapNode node = block->getNodeNoCheck(relpos, &is_valid_position); - if (!is_valid_position) - throw InvalidPositionException(); - return node; -} -#endif - // throws InvalidPositionException if not found void Map::setNode(v3s16 p, MapNode & n) { @@ -233,7 +214,7 @@ void Map::addNodeAndUpdate(v3s16 p, MapNode n, RollbackNode rollback_oldnode(this, p, m_gamedef); // This is needed for updating the lighting - MapNode oldnode = getNodeNoEx(p); + MapNode oldnode = getNode(p); // Remove node metadata if (remove_metadata) { @@ -273,7 +254,7 @@ void Map::addNodeAndUpdate(v3s16 p, MapNode n, v3s16 p2 = p + dir; bool is_valid_position; - MapNode n2 = getNodeNoEx(p2, &is_valid_position); + MapNode n2 = getNode(p2, &is_valid_position); if(is_valid_position && (m_nodedef->get(n2).isLiquid() || n2.getContent() == CONTENT_AIR)) @@ -585,7 +566,7 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> &modified_blocks, v3s16 p0 = m_transforming_liquid.front(); m_transforming_liquid.pop_front(); - MapNode n0 = getNodeNoEx(p0); + MapNode n0 = getNode(p0); /* Collect information about current node @@ -645,7 +626,7 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> &modified_blocks, break; } v3s16 npos = p0 + dirs[i]; - NodeNeighbor nb(getNodeNoEx(npos), nt, npos); + NodeNeighbor nb(getNode(npos), nt, npos); const ContentFeatures &cfnb = m_nodedef->get(nb.n); switch (m_nodedef->get(nb.n.getContent()).liquid_type) { case LIQUID_NONE: @@ -1078,7 +1059,7 @@ bool Map::isOccluded(v3s16 p0, v3s16 p1, float step, float stepfac, for(float s=start_off; s<d0+end_off; s+=step){ v3f pf = p0f + uf * s; v3s16 p = floatToInt(pf, BS); - MapNode n = getNodeNoEx(p); + MapNode n = getNode(p); const ContentFeatures &f = m_nodedef->get(n); if(f.drawtype == NDT_NORMAL){ // not transparent, see ContentFeature::updateTextures @@ -1660,7 +1641,7 @@ void ServerMap::updateVManip(v3s16 pos) return; s32 idx = vm->m_area.index(pos); - vm->m_data[idx] = getNodeNoEx(pos); + vm->m_data[idx] = getNode(pos); vm->m_flags[idx] &= ~VOXELFLAG_NO_DATA; vm->m_is_dirty = true; |