diff --git a/src/js/slaveListing.js b/src/js/slaveListing.js index b97674baaa0da8c76dccc5452ac654ad4a279026..d3014a8eb346b123b77832981fa0da080df1f7b2 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>`);