1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Optimize ClientIface::getPlayerNames(): return const ref instead a copy of all names

This commit is contained in:
Loic Blot 2016-10-08 16:42:09 +02:00 committed by Ner'zhul
parent fd5a130b86
commit edba6e50d9
3 changed files with 4 additions and 10 deletions

View file

@ -1123,11 +1123,11 @@ PlayerSAO* Server::StageTwoClientInit(u16 peer_id)
Print out action
*/
{
std::vector<std::string> names = m_clients.getPlayerNames();
const std::vector<std::string> &names = m_clients.getPlayerNames();
actionstream<<player->getName() <<" joins game. List of players: ";
actionstream << player->getName() << " joins game. List of players: ";
for (std::vector<std::string>::iterator i = names.begin();
for (std::vector<std::string>::const_iterator i = names.begin();
i != names.end(); ++i) {
actionstream << *i << " ";
}