EntityList::GetRandomClient converted to xyz_location

This commit is contained in:
Arthur Ice
2014-11-30 22:28:17 -08:00
parent 8b7a09dbc1
commit 54f3f7f343
4 changed files with 8 additions and 10 deletions
+4 -6
View File
@@ -1561,16 +1561,14 @@ Client *EntityList::GetClientByWID(uint32 iWID)
return nullptr;
}
Client *EntityList::GetRandomClient(float x, float y, float z, float Distance, Client *ExcludeClient)
Client *EntityList::GetRandomClient(const xyz_location& location, float Distance, Client *ExcludeClient)
{
std::vector<Client *> ClientsInRange;
auto it = client_list.begin();
while (it != client_list.end()) {
if ((it->second != ExcludeClient) && (it->second->DistNoRoot(x, y, z) <= Distance))
for (auto it = client_list.begin();it != client_list.end(); ++it)
if ((it->second != ExcludeClient) && (it->second->DistNoRoot(location.m_X, location.m_Y, location.m_Z) <= Distance))
ClientsInRange.push_back(it->second);
++it;
}
if (ClientsInRange.empty())
return nullptr;