[Server] Fix MasterClient crashes

0.6.1
Koncord 8 years ago
parent a4e45de6ca
commit b677a0455d

@ -187,24 +187,34 @@ void MasterClient::Thread()
SetPlayers((int) players->size()); SetPlayers((int) players->size());
auto pIt = players->begin(); auto pIt = players->begin();
for (int i = 0; pIt != players->end(); i++, pIt++) if(queryData.players.size() != players->size())
{ {
if (queryData.players[i] != pIt->second->npc.mName) queryData.players.clear();
updated = true;
}
else
{
for (int i = 0; pIt != players->end(); i++, pIt++)
{ {
updated = true; if (queryData.players[i] != pIt->second->npc.mName)
break; {
queryData.players.clear();
updated = true;
break;
}
} }
} }
if (updated) if (updated)
{ {
updated = false;
if (pIt != players->end()) if (pIt != players->end())
{ {
queryData.players.clear(); for(auto player : *players)
transform(players->begin(), players->end(), back_inserter(queryData.players), [](auto pair)
{ {
return pair.second->npc.mName; if(!player.second->npc.mName.empty())
}); queryData.players.push_back(player.second->npc.mName);
}
} }
Send(PacketMasterAnnounce::FUNCTION_ANNOUNCE); Send(PacketMasterAnnounce::FUNCTION_ANNOUNCE);
} }

Loading…
Cancel
Save