Ticket #4120: fix_gamesetup_v1.patch

File fix_gamesetup_v1.patch, 1.0 KB (added by elexis, 8 years ago)
  • binaries/data/mods/public/gui/gamesetup/gamesetup.js

    function onTick()  
    10441044 * Called when the map or the number of players changes.
    10451045 */
    10461046function resizePlayerData(targetPlayerData, maxPlayers)
    10471047{
    10481048    if (g_IsNetworked)
    1049         // Unassign excess players
    1050         for (let guid in g_PlayerAssignments)
    1051         {
    1052             let playerID = g_PlayerAssignments[guid].player;
    1053             if (playerID > maxPlayers)
    1054                 Engine.AssignNetworkPlayer(playerID, "");
    1055         }
     1049    {
     1050        // Remove invalid playerIDs from the servers playerassignments copy
     1051        for (let playerID = +maxPlayers + 1; playerID <= g_MaxPlayers; ++playerID)
     1052            Engine.AssignNetworkPlayer(playerID, "");
     1053    }
    10561054    else if (!g_PlayerAssignments.local ||
    10571055             g_PlayerAssignments.local.player > maxPlayers)
    10581056        g_PlayerAssignments = {
    10591057            "local": {
    10601058                "name": singleplayerName(),