From 007c8440d7da324af05631389f9a850e805fb3b3 Mon Sep 17 00:00:00 2001 From: Jozef Behran Date: Thu, 7 Mar 2019 02:19:13 -0500 Subject: 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 "&". --- src/network/serverpackethandler.cpp | 2 +- src/server.h | 2 +- 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); -- cgit v1.2.3