summaryrefslogtreecommitdiff
path: root/src/clientiface.cpp
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2015-03-04 16:30:24 +0100
committerLoic Blot <loic.blot@unix-experience.fr>2015-03-04 16:30:24 +0100
commit2066655aae2022384fc12a10c04dccfd2996f0ac (patch)
treec4ef388c3f97a6e11ede458d89e55cfbcd0310e8 /src/clientiface.cpp
parent7e088fdfe3c77083606bce955624aef1da59bb32 (diff)
downloadminetest-2066655aae2022384fc12a10c04dccfd2996f0ac.tar.gz
minetest-2066655aae2022384fc12a10c04dccfd2996f0ac.tar.bz2
minetest-2066655aae2022384fc12a10c04dccfd2996f0ac.zip
ClientInterface::getClientIDs doesn't need a std::list. Use a std::vector for better perfs
Diffstat (limited to 'src/clientiface.cpp')
-rw-r--r--src/clientiface.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/clientiface.cpp b/src/clientiface.cpp
index 6180cf5da..126979897 100644
--- a/src/clientiface.cpp
+++ b/src/clientiface.cpp
@@ -560,9 +560,9 @@ ClientInterface::~ClientInterface()
}
}
-std::list<u16> ClientInterface::getClientIDs(ClientState min_state)
+std::vector<u16> ClientInterface::getClientIDs(ClientState min_state)
{
- std::list<u16> reply;
+ std::vector<u16> reply;
JMutexAutoLock clientslock(m_clients_mutex);
for(std::map<u16, RemoteClient*>::iterator
@@ -596,20 +596,22 @@ void ClientInterface::UpdatePlayerList()
{
if (m_env != NULL)
{
- std::list<u16> clients = getClientIDs();
+ std::vector<u16> clients = getClientIDs();
m_clients_names.clear();
if(!clients.empty())
infostream<<"Players:"<<std::endl;
- for(std::list<u16>::iterator
+
+ for(std::vector<u16>::iterator
i = clients.begin();
- i != clients.end(); ++i)
- {
+ i != clients.end(); ++i) {
Player *player = m_env->getPlayer(*i);
- if(player==NULL)
+
+ if (player == NULL)
continue;
- infostream<<"* "<<player->getName()<<"\t";
+
+ infostream << "* " << player->getName() << "\t";
{
JMutexAutoLock clientslock(m_clients_mutex);
@@ -617,6 +619,7 @@ void ClientInterface::UpdatePlayerList()
if(client != NULL)
client->PrintInfo(infostream);
}
+
m_clients_names.push_back(player->getName());
}
}