1
0

Added FindAndDoWithUUID

This commit is contained in:
Lukas Pioch
2014-11-02 21:01:23 +01:00
parent 325e94709e
commit 9f71a4e7ae
5 changed files with 46 additions and 0 deletions

View File

@@ -2729,6 +2729,28 @@ 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;
}
}
if (FoundPlayer != nullptr)
{
return a_Callback.Item (FoundPlayer);
}
return false;
}
// TODO: This interface is dangerous!
cPlayer * cWorld::FindClosestPlayer(const Vector3d & a_Pos, float a_SightLimit, bool a_CheckLineOfSight)
{