aboutsummaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-10-04 02:53:52 -0400
committerkwolekr <kwolekr@minetest.net>2015-10-04 04:06:26 -0400
commit7b01b94c6bde1989e48208befff8595c141183e6 (patch)
treea865c461dcd8df12b0bc4ee8945202d98cf0c007 /src/network
parentf0cd5da687ca216b4bdd9abe7bc8038a679d3763 (diff)
downloadminetest-7b01b94c6bde1989e48208befff8595c141183e6.tar.gz
minetest-7b01b94c6bde1989e48208befff8595c141183e6.tar.bz2
minetest-7b01b94c6bde1989e48208befff8595c141183e6.zip
Remove redundant code in player interact handler
Diffstat (limited to 'src/network')
-rw-r--r--src/network/serverpackethandler.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index d89e30c8d..3ee2dd931 100644
--- a/src/network/serverpackethandler.cpp
+++ b/src/network/serverpackethandler.cpp
@@ -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 */