From f1f2aa5ccfa327c9879038f6aea1b646223cce7e Mon Sep 17 00:00:00 2001 From: Empress Sela <empresssela@cock.li> Date: Wed, 8 Jul 2020 19:33:24 -0400 Subject: [PATCH] Fix fathers not being added to missing table in NGP --- src/data/newGamePlus.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/data/newGamePlus.js b/src/data/newGamePlus.js index e6e70cd7ba9..4a4b1d814fa 100644 --- a/src/data/newGamePlus.js +++ b/src/data/newGamePlus.js @@ -78,6 +78,13 @@ App.Data.NewGamePlus = (function() { if (needed.indexOf(i) === -1) needed.push(i); }))); + (V.slaves || []).forEach(s => (s.womb + .forEach(f => ([f.fatherID, f.genetics.father, f.genetics.mother] + .filter(i => (i in missingTable)) + .forEach(i => { + if (needed.indexOf(i) === -1) + needed.push(i); + }))))); while (needed.length > 0) { let i = needed.shift(); @@ -113,11 +120,19 @@ App.Data.NewGamePlus = (function() { father: s.father, inbreedingCoeff: s.inbreedingCoeff }; - Object.values(V.missingTable).concat(V.slaves).forEach(so => { + Object.values(V.missingTable).forEach(so => { + if (so.mother === s.ID) + so.mother = oldMissingParentID; + if (so.father === s.ID) + so.father = oldMissingParentID; + }); + V.slaves.filter(so => (so.assignment === Job.IMPORTED)).forEach(so => { if (so.mother === s.ID) so.mother = oldMissingParentID; if (so.father === s.ID) so.father = oldMissingParentID; + WombChangeID(so, s.ID, oldMissingParentID); + WombChangeGeneID(so, s.ID, oldMissingParentID); }); oldMissingParentID--; }); -- GitLab