Ticket #3242: t3242_clear_player_assignments_when_starting_the_game.patch

File t3242_clear_player_assignments_when_starting_the_game.patch, 846 bytes (added by elexis, 9 years ago)

Fixes the other bug described in the comment above. Prevens players and observers from rejoining if they were not present when the game started.

  • source/network/NetServer.cpp

     
    10421042
    10431043    m_State = SERVER_STATE_LOADING;
    10441044
    10451045    // Send the final setup state to all clients
    10461046    UpdateGameAttributes(&m_GameAttributes.get());
     1047
     1048    // Remove players and observers from the assignment that are not present when the game starts
     1049    for (size_t i = 0; i < m_Sessions.size(); ++i)
     1050        for (PlayerAssignmentMap::iterator it = m_PlayerAssignments.begin(); it != m_PlayerAssignments.end(); ++it)
     1051            if (!it->second.m_Enabled)
     1052            {
     1053                m_PlayerAssignments.erase(it);
     1054                break;
     1055            }
     1056
    10471057    SendPlayerAssignments();
    10481058
    10491059    CGameStartMessage gameStart;
    10501060    Broadcast(&gameStart);
    10511061}