aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJozef Behran <jozuejozef@gmail.com>2019-03-07 02:19:13 -0500
committerLoïc Blot <nerzhul@users.noreply.github.com>2019-03-07 08:19:13 +0100
commit007c8440d7da324af05631389f9a850e805fb3b3 (patch)
tree066cb97985c1dbcdbfa6bd730c66f1483192ea48 /src
parent557afdc42979916c54d9e1240845dcce3726721e (diff)
downloadminetest-007c8440d7da324af05631389f9a850e805fb3b3.tar.gz
minetest-007c8440d7da324af05631389f9a850e805fb3b3.tar.bz2
minetest-007c8440d7da324af05631389f9a850e805fb3b3.zip
Optimize interaction distance checker (#8193)
The "what" parameter is being passed by value, most likely by accident as the type is "const std::string". Convert it to a reference by adding the missing "&".
Diffstat (limited to 'src')
-rw-r--r--src/network/serverpackethandler.cpp2
-rw-r--r--src/server.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index 6f17d666a..7e9495d16 100644
--- a/src/network/serverpackethandler.cpp
+++ b/src/network/serverpackethandler.cpp
@@ -952,7 +952,7 @@ void Server::handleCommand_Respawn(NetworkPacket* pkt)
// the previous addition has been successfully removed
}
-bool Server::checkInteractDistance(RemotePlayer *player, const f32 d, const std::string what)
+bool Server::checkInteractDistance(RemotePlayer *player, const f32 d, const std::string &what)
{
PlayerSAO *playersao = player->getPlayerSAO();
const InventoryList *hlist = playersao->getInventory()->getList("hand");
diff --git a/src/server.h b/src/server.h
index 0a3e48072..5949d9bf1 100644
--- a/src/server.h
+++ b/src/server.h
@@ -477,7 +477,7 @@ private:
void RespawnPlayer(session_t peer_id);
void DeleteClient(session_t peer_id, ClientDeletionReason reason);
void UpdateCrafting(RemotePlayer *player);
- bool checkInteractDistance(RemotePlayer *player, const f32 d, const std::string what);
+ bool checkInteractDistance(RemotePlayer *player, const f32 d, const std::string &what);
void handleChatInterfaceEvent(ChatEvent *evt);