Ticket #3823: 3823.patch

File 3823.patch, 2.4 KB (added by svott, 8 years ago)
  • binaries/data/mods/public/gui/session/selection_panels.js

     
    192192    {
    193193        return 6;
    194194    },
    195     "getItems": function(unitEntState)
     195    "getItems": function(unitEntStateUNUSED, selection)
    196196    {
    197197        let commands = [];
    198198
    199         for (let c in g_EntityCommands)
     199        for (let cmd in g_EntityCommands)
    200200        {
    201             var info = g_EntityCommands[c].getInfo(unitEntState);
    202             if (!info)
    203                 continue;
     201            for (let id of selection)
     202            {
     203                let unitEntState = GetEntityState(id);
    204204
    205             info.name = c;
    206             commands.push(info);
     205                var info = g_EntityCommands[cmd].getInfo(unitEntState);
     206                if (!info)
     207                    continue;
     208
     209                info.name = cmd;
     210                commands.push(info);
     211                break; // add each command only once
     212            }
    207213        }
    208214        return commands;
    209215    },
  • binaries/data/mods/public/gui/session/unit_commands.js

     
    3131 * @param unitEntState Entity state of the selected unit with the lowest id.
    3232 * @param payerState Player state
    3333 */
    34 function setupUnitPanel(guiName, unitEntState, playerState)
     34function setupUnitPanel(guiName, unitEntState, playerState, selection)
    3535{
    3636    if (!g_SelectionPanels[guiName])
    3737    {
     
    3838        error("unknown guiName used '" + guiName + "'");
    3939        return;
    4040    }
    41     let selection = g_Selection.toList();
    4241
    4342    var items = g_SelectionPanels[guiName].getItems(unitEntState, selection);
    4443
     
    174173            )
    175174                continue;
    176175
    177             setupUnitPanel(guiName, entState, playerStates[entState.player]);
     176            setupUnitPanel(guiName, entState, playerStates[entState.player], selection);
    178177        }
    179178
    180179        supplementalDetailsPanel.hidden = false;
     
    184183    {
    185184        // TODO if there's a second panel needed for a different player
    186185        // we should consider adding the players list to g_SelectionPanels
    187         setupUnitPanel("Garrison", entState, playerState);
    188         setupUnitPanel("AllyCommand", entState, playerState);
     186        setupUnitPanel("Garrison", entState, playerState, selection);
     187        setupUnitPanel("AllyCommand", entState, playerState, selection);
    189188
    190189        supplementalDetailsPanel.hidden = !g_SelectionPanels.Garrison.used;
    191190