Added FindAndDoWithUUID
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user