Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #429 from RachelBryk/netplay-pid
Make sure netplay player IDs are actually unique.
  • Loading branch information
shuffle2 committed May 29, 2014
2 parents fee6923 + 8c70ee7 commit d18bc31
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Source/Core/Core/NetPlayServer.cpp
Expand Up @@ -153,7 +153,16 @@ unsigned int NetPlayServer::OnConnect(sf::SocketTCP& socket)
rpac >> player.name;

// give new client first available id
player.pid = (PlayerId)(m_players.size() + 1);
PlayerId pid = 1;
for (auto i = m_players.begin(); i != m_players.end(); ++i)
{
if (i->second.pid == pid)
{
pid++;
i = m_players.begin();
}
}
player.pid = pid;

// try to automatically assign new user a pad
for (PadMapping& mapping : m_pad_map)
Expand Down

0 comments on commit d18bc31

Please sign in to comment.