diff options
author | Lukas Pioch <lukas@zgow.de> | 2014-11-02 21:38:17 +0100 |
---|---|---|
committer | Lukas Pioch <lukas@zgow.de> | 2014-11-02 21:38:17 +0100 |
commit | 269d76a208fcfc58c3c79d6e6a887b823d4f8f00 (patch) | |
tree | 9a89285753fbf89a726e35d4c1857af4b4c3b9d8 /src | |
parent | Added FindAndDoWithUUID (diff) | |
download | cuberite-269d76a208fcfc58c3c79d6e6a887b823d4f8f00.tar cuberite-269d76a208fcfc58c3c79d6e6a887b823d4f8f00.tar.gz cuberite-269d76a208fcfc58c3c79d6e6a887b823d4f8f00.tar.bz2 cuberite-269d76a208fcfc58c3c79d6e6a887b823d4f8f00.tar.lz cuberite-269d76a208fcfc58c3c79d6e6a887b823d4f8f00.tar.xz cuberite-269d76a208fcfc58c3c79d6e6a887b823d4f8f00.tar.zst cuberite-269d76a208fcfc58c3c79d6e6a887b823d4f8f00.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Root.h | 2 | ||||
-rw-r--r-- | src/World.cpp | 8 |
2 files changed, 2 insertions, 8 deletions
diff --git a/src/Root.h b/src/Root.h index 456217140..f0cdf14d1 100644 --- a/src/Root.h +++ b/src/Root.h @@ -126,7 +126,7 @@ public: /// Finds a player from a partial or complete player name and calls the callback - case-insensitive bool FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS << - /// Finds a player with the same uuid and call the callback */ + /// Finds a player with the same uuid and call the callback bool FindAndDoWithUUID(const AString & a_PlayerUUID, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS << // tolua_begin diff --git a/src/World.cpp b/src/World.cpp index 212566194..1b4f4f171 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2731,19 +2731,13 @@ bool cWorld::FindAndDoWithPlayer(const AString & a_PlayerNameHint, cPlayerListCa bool cWorld::FindAndDoWithUUID(const AString & a_PlayerUUID, cPlayerListCallback & a_Callback) { - cPlayer * FoundPlayer = nullptr; cCSLock Lock(m_CSPlayers); for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { if ((*itr)->GetUUID() == a_PlayerUUID) { // Match found and exit - FoundPlayer = *itr; - break; + return a_Callback.Item (*itr); } } - if (FoundPlayer != nullptr) - { - return a_Callback.Item (FoundPlayer); - } return false; } |