Ticket #3288: selection_panels_v2.patch

File selection_panels_v2.patch, 1.2 KB (added by elexis, 8 years ago)
  • binaries/data/mods/public/gui/session/selection_panels.js

    g_SelectionPanels.Research = {  
    778778    "getItems": function(unitEntState, selection)
    779779    {
    780780        // TODO 8 is the row lenght, make variable
    781781        if (getNumberOfRightPanelButtons() > 8 && selection.length > 1)
    782782            return [];
    783         for (var ent of selection)
     783
     784        let techs = [];
     785        for (let ent of selection)
    784786        {
    785             var entState = GetEntityState(ent);
    786             if (entState.production && entState.production.technologies.length)
    787                 return entState.production.technologies;
     787            let entState = GetEntityState(ent);
     788            if (entState.production && entState.production.technologies)
     789                for (let tech of entState.production.technologies)
     790                    if (techs.indexOf(tech) == -1)
     791                        techs.push(tech);
    788792        }
    789         return [];
     793        return techs;
    790794    },
    791795    "hideItem": function(i, rowLength) // called when no item is found
    792796    {
    793797        Engine.GetGUIObjectByName("unitResearchButton["+i+"]").hidden = true;
    794798        // We also remove the paired tech and the pair symbol