From 86d7f84b899a507e979f1845f2057cce6f84e743 Mon Sep 17 00:00:00 2001 From: Jozef Behran Date: Sat, 10 Aug 2019 19:45:44 +0200 Subject: Merge pull request #8776 from osjc/FixGetNode Finish getNode cleanup --- src/map.cpp | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) (limited to 'src/map.cpp') 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 &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 &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; sget(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; -- cgit v1.2.3