forked from mirror/openmw-tes3mp
[Server] Send players list to master server
This commit is contained in:
parent
6e8750b9e4
commit
d0c3d190e1
1 changed files with 23 additions and 1 deletions
|
@ -178,11 +178,33 @@ void MasterClient::Thread()
|
|||
queryData.SetPassword((int) Networking::get().isPassworded());
|
||||
queryData.SetVersion(TES3MP_VERSION);
|
||||
|
||||
auto *players = Players::getPlayers();
|
||||
while (sRun)
|
||||
{
|
||||
SetPlayers((int) Players::getPlayers()->size());
|
||||
SetPlayers((int) players->size());
|
||||
|
||||
auto pIt = players->begin();
|
||||
for (int i = 0; pIt != players->end(); i++, pIt++)
|
||||
{
|
||||
if (queryData.players[i] != pIt->second->npc.mName)
|
||||
{
|
||||
updated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (updated)
|
||||
{
|
||||
if (pIt != players->end())
|
||||
{
|
||||
queryData.players.clear();
|
||||
transform(players->begin(), players->end(), back_inserter(queryData.players), [](auto pair)
|
||||
{
|
||||
return pair.second->npc.mName;
|
||||
});
|
||||
}
|
||||
Send(PacketMasterAnnounce::FUNCTION_ANNOUNCE);
|
||||
}
|
||||
else
|
||||
Send(PacketMasterAnnounce::FUNCTION_KEEP);
|
||||
RakSleep(timeout);
|
||||
|
|
Loading…
Reference in a new issue