From 269d76a208fcfc58c3c79d6e6a887b823d4f8f00 Mon Sep 17 00:00:00 2001 From: Lukas Pioch Date: Sun, 2 Nov 2014 21:38:17 +0100 Subject: Simplified FindAndDoWithUUID, formatted line --- src/Root.h | 2 +- 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; } -- cgit v1.2.3