Ticket #3409: sort_players_in_gamesteup.patch

File sort_players_in_gamesteup.patch, 1.3 KB (added by Sergey Kushnirenko, 8 years ago)
  • gamesetup.js

     
    115115const g_UnassignedColor = "140 140 140";
    116116
    117117/**
     118 * Highlight observer players in the dropdownlist.
     119 */
     120const g_ObserverColor = "170 170 250";
     121
     122/**
    118123 * Highlight ready players.
    119124 */
    120125const g_ReadyColor = "green";
     
    14231428    let noAssignment;
    14241429    let assignedCount = 0;
    14251430
     1431    //add assigned players
    14261432    for (let guid in g_PlayerAssignments)
    14271433    {
    14281434        let player = g_PlayerAssignments[guid].player;
    14291435
     1436        if (player == -1)
     1437            continue;
     1438   
    14301439        hostNameList.push(g_PlayerAssignments[guid].name);
    14311440        hostGuidList.push(guid);
    14321441        assignments[player] = hostNameList.length-1;
     1442        assignedCount++;
     1443    }
     1444   
     1445    //add observer players
     1446    for (let guid in g_PlayerAssignments)
     1447    {
     1448        let player = g_PlayerAssignments[guid].player;
    14331449
    14341450        if (player != -1)
    1435             assignedCount++;
    1436     }
     1451            continue;
    14371452
     1453        hostNameList.push("[color=\""+ g_ObserverColor + "\"]" + g_PlayerAssignments[guid].name + "[/color]");
     1454        hostGuidList.push(guid);
     1455        assignments[player] = hostNameList.length-1;
     1456    }
     1457
    14381458    // Only enable start button if we have enough assigned players
    14391459    if (g_IsController)
    14401460        Engine.GetGUIObjectByName("startGame").enabled = assignedCount > 0;