1
0

Simplified FindAndDoWithUUID, formatted line

This commit is contained in:
Lukas Pioch 2014-11-02 21:38:17 +01:00
parent 9f71a4e7ae
commit 269d76a208
2 changed files with 2 additions and 8 deletions

View File

@ -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

View File

@ -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;
}