Fix more then one observer by allowing a game to have multiple players with the -1 ID.

This was SVN commit r14885.
This commit is contained in:
JoshuaJB 2014-03-29 15:09:42 +00:00
parent 22867fa9a3
commit a7b2f6ba47

View File

@ -597,10 +597,10 @@ void CNetServerWorker::OnUserLeave(CNetServerSession* session)
void CNetServerWorker::AddPlayer(const CStr& guid, const CStrW& name)
{
// Find all player IDs in active use; we mustn't give them to a second player
// Find all player IDs in active use; we mustn't give them to a second player (excluding the unassigned ID: -1)
std::set<i32> usedIDs;
for (PlayerAssignmentMap::iterator it = m_PlayerAssignments.begin(); it != m_PlayerAssignments.end(); ++it)
if (it->second.m_Enabled)
if (it->second.m_Enabled && it->second.m_PlayerID != -1)
usedIDs.insert(it->second.m_PlayerID);
// If the player is rejoining after disconnecting, try to give them