Remove redundant code in player interact handler
authorkwolekr <kwolekr@minetest.net>
Sun, 4 Oct 2015 06:53:52 +0000 (02:53 -0400)
committerkwolekr <kwolekr@minetest.net>
Sun, 4 Oct 2015 08:06:26 +0000 (04:06 -0400)
src/network/serverpackethandler.cpp

index d89e30c8d9ea1b02f0824b110cb97e10859751ab..3ee2dd9312c48efbfe6514d481a8b17a49ce01c7 100644 (file)
@@ -1467,21 +1467,22 @@ void Server::handleCommand_Interact(NetworkPacket* pkt)
                                NOTE: This can be used in the future to check if
                                somebody is cheating, by checking the timing.
                        */
+
                        MapNode n(CONTENT_IGNORE);
                        bool pos_ok;
-                       n = m_env->getMap().getNodeNoEx(p_under, &pos_ok);
-                       if (pos_ok)
-                               n = m_env->getMap().getNodeNoEx(p_under, &pos_ok);
 
+                       n = m_env->getMap().getNodeNoEx(p_under, &pos_ok);
                        if (!pos_ok) {
                                infostream << "Server: Not punching: Node not found."
                                                << " Adding block to emerge queue."
                                                << std::endl;
-                               m_emerge->enqueueBlockEmerge(pkt->getPeerId(), getNodeBlockPos(p_above), false);
+                               m_emerge->enqueueBlockEmerge(pkt->getPeerId(),
+                                       getNodeBlockPos(p_above), false);
                        }
 
                        if (n.getContent() != CONTENT_IGNORE)
                                m_script->node_on_punch(p_under, n, playersao, pointed);
+
                        // Cheat prevention
                        playersao->noCheatDigStart(p_under);
                }
@@ -1538,9 +1539,10 @@ void Server::handleCommand_Interact(NetworkPacket* pkt)
                        MapNode n = m_env->getMap().getNodeNoEx(p_under, &pos_ok);
                        if (!pos_ok) {
                                infostream << "Server: Not finishing digging: Node not found."
-                                                  << " Adding block to emerge queue."
-                                                  << std::endl;
-                               m_emerge->enqueueBlockEmerge(pkt->getPeerId(), getNodeBlockPos(p_above), false);
+                                               << " Adding block to emerge queue."
+                                               << std::endl;
+                               m_emerge->enqueueBlockEmerge(pkt->getPeerId(),
+                                       getNodeBlockPos(p_above), false);
                        }
 
                        /* Cheat prevention */