Ticket #3823: 3823_rebased.patch

File 3823_rebased.patch, 2.5 KB (added by Imarok, 3 years ago)

rebased

  • binaries/data/mods/public/gui/session/selection_panels.js

     
    175175    {
    176176        return 6;
    177177    },
    178     "getItems": function(unitEntState)
     178    "getItems": function(unitEntStateUNUSED, selection)
    179179    {
    180180        let commands = [];
    181181
    182         for (let c in g_EntityCommands)
     182        for (let cmd in g_EntityCommands)
    183183        {
    184             let info = g_EntityCommands[c].getInfo(unitEntState);
    185             if (!info)
    186                 continue;
     184            for (let id of selection)
     185            {
     186                let unitEntState = GetEntityState(id);
     187                let info = g_EntityCommands[cmd].getInfo(unitEntState);
     188                if (!info)
     189                    continue;
    187190
    188             info.name = c;
    189             commands.push(info);
     191                info.name = cmd;
     192                commands.push(info);
     193                break;
     194            }
    190195        }
    191196        return commands;
    192197    },
  • binaries/data/mods/public/gui/session/unit_commands.js

     
    4747 * @param unitEntState Entity state of the selected unit with the lowest id.
    4848 * @param payerState Player state
    4949 */
    50 function setupUnitPanel(guiName, unitEntState, playerState)
     50function setupUnitPanel(guiName, unitEntState, playerState, selection)
    5151{
    5252    if (!g_SelectionPanels[guiName])
    5353    {
     
    5555        return;
    5656    }
    5757
    58     let selection = g_Selection.toList();
    5958    let items = g_SelectionPanels[guiName].getItems(unitEntState, selection);
    6059
    6160    if (!items || !items.length)
     
    145144                g_SelectionPanels[guiName].conflictsWith.some(p => g_SelectionPanels[p].used))
    146145                continue;
    147146
    148             setupUnitPanel(guiName, entState, playerStates[entState.player]);
     147            setupUnitPanel(guiName, entState, playerStates[entState.player], selection);
    149148        }
    150149
    151150        supplementalDetailsPanel.hidden = false;
     
    155154    {
    156155        // TODO if there's a second panel needed for a different player
    157156        // we should consider adding the players list to g_SelectionPanels
    158         setupUnitPanel("Garrison", entState, playerState);
    159         setupUnitPanel("AllyCommand", entState, playerState);
     157        setupUnitPanel("Garrison", entState, playerState, selection);
     158        setupUnitPanel("AllyCommand", entState, playerState, selection);
    160159
    161160        supplementalDetailsPanel.hidden = !g_SelectionPanels.Garrison.used;
    162161