From de06dc76f743c9077fe491cc96dd98c214e76f7a Mon Sep 17 00:00:00 2001 From: elexis Date: Tue, 17 May 2016 19:05:18 +0000 Subject: [PATCH] Show researchable techs of all selected entities, not only the first one. Fixes #3288. This was SVN commit r18194. --- .../public/gui/session/selection_panels.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/binaries/data/mods/public/gui/session/selection_panels.js b/binaries/data/mods/public/gui/session/selection_panels.js index 9b910804d6..ead9e8413d 100644 --- a/binaries/data/mods/public/gui/session/selection_panels.js +++ b/binaries/data/mods/public/gui/session/selection_panels.js @@ -777,16 +777,20 @@ g_SelectionPanels.Research = { }, "getItems": function(unitEntState, selection) { - // TODO 8 is the row lenght, make variable - if (getNumberOfRightPanelButtons() > 8 && selection.length > 1) + if (getNumberOfRightPanelButtons() > g_SelectionPanels.Queue.getMaxNumberOfItems() && + selection.length > 1) return []; - for (var ent of selection) + + let techs = []; + for (let ent of selection) { - var entState = GetEntityState(ent); - if (entState.production && entState.production.technologies.length) - return entState.production.technologies; + let entState = GetEntityState(ent); + if (entState.production && entState.production.technologies) + for (let tech of entState.production.technologies) + if (techs.indexOf(tech) == -1) + techs.push(tech); } - return []; + return techs; }, "hideItem": function(i, rowLength) // called when no item is found {