Skip to content
Permalink
Browse files

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 "&".
  • Loading branch information
osjc authored and nerzhul committed Mar 7, 2019
1 parent 557afdc commit 007c8440d7da324af05631389f9a850e805fb3b3
Showing with 2 additions and 2 deletions.
  1. +1 −1 src/network/serverpackethandler.cpp
  2. +1 −1 src/server.h
@@ -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");
@@ -477,7 +477,7 @@ class Server : public con::PeerHandler, public MapEventReceiver,
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);

0 comments on commit 007c844

Please sign in to comment.