From 33451249fad82915bf4504d6ba49bac18ac10c68 Mon Sep 17 00:00:00 2001 From: Svornost <11434-svornost@users.noreply.gitgud.io> Date: Fri, 22 May 2020 21:32:43 -0700 Subject: [PATCH] Fix NGP slave list to use IDs too --- src/js/slaveListing.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/js/slaveListing.js b/src/js/slaveListing.js index b97674baaa0..d3014a8eb34 100644 --- a/src/js/slaveListing.js +++ b/src/js/slaveListing.js @@ -757,29 +757,29 @@ App.UI.SlaveList.listNGPSlaves = function() { } if (V.slavesToImport > 0) { - const importedSlavesIndices = slaves.reduce((acc, s, i) => { + const importedSlavesIDs = slaves.reduce((acc, s) => { if (s.assignment === NGPassignment) { - acc.push(i); + acc.push(s.ID); } return acc; }, []); - SlaveSort.indices(importedSlavesIndices); - r += App.UI.tabbar.makeTab("remove", App.UI.SlaveList.render.listMarkup(importedSlavesIndices, [], + SlaveSort.IDs(importedSlavesIDs); + r += App.UI.tabbar.makeTab("remove", App.UI.SlaveList.render.listMarkup(importedSlavesIDs, [], App.UI.SlaveList.makeNameDecorator(["emphasizedSlave", "pink"]), - (s, i) => App.UI.DOM.passageLink('Remove from import list', thisPassage, - () => { variables().slavesToImport -= 1; removeJob(variables().slaves[i], NGPassignment); } + (s) => App.UI.DOM.passageLink('Remove from import list', thisPassage, + () => { variables().slavesToImport -= 1; removeJob(s, NGPassignment); } ))); } else { r += App.UI.tabbar.makeTab("remove", `<em>No slaves will go with you to the new game</em>`); } if (V.slavesToImport < V.slavesToImportMax) { - const slavesToImportIndices = slaves.reduce((acc, s, i) => { if (s.assignment !== NGPassignment) { acc.push(i); } return acc; }, []); - SlaveSort.indices(slavesToImportIndices); - r += App.UI.tabbar.makeTab("assign", App.UI.SlaveList.render.listMarkup(slavesToImportIndices, [], + const slavesToImportIDs = slaves.reduce((acc, s) => { if (s.assignment !== NGPassignment) { acc.push(s.ID); } return acc; }, []); + SlaveSort.IDs(slavesToImportIDs); + r += App.UI.tabbar.makeTab("assign", App.UI.SlaveList.render.listMarkup(slavesToImportIDs, [], App.UI.SlaveList.makeNameDecorator(["emphasizedSlave", "pink"]), - (s, i) => App.UI.DOM.passageLink('Add to import list', thisPassage, - () => { variables().slavesToImport += 1; assignJob(variables().slaves[i], NGPassignment); } + (s) => App.UI.DOM.passageLink('Add to import list', thisPassage, + () => { variables().slavesToImport += 1; assignJob(s, NGPassignment); } ))); } else { r += App.UI.tabbar.makeTab("assign", `<strong>Slave import limit reached</strong>`); -- GitLab