diff --git a/src/js/removeActiveSlave.tw b/src/js/removeActiveSlave.tw index 6b8c3db5675fdfab8d607309771e9d16b04cdef2..889349a420f6d5b664fe9da3d56a2345c30c9be9 100644 --- a/src/js/removeActiveSlave.tw +++ b/src/js/removeActiveSlave.tw @@ -183,6 +183,9 @@ window.removeActiveSlave = function removeActiveSlave() { keep = true; } } + if (isImpregnatedBy(V.PC, V.activeSlave)) { /* did we impregnate the PC */ + keep = true; + } if (!keep) { /* avoid going through this loop if possible */ keep = V.slaves.some(slave => { /* have we impregnated a slave that is not ourself? */ diff --git a/src/pregmod/generateChild.tw b/src/pregmod/generateChild.tw index 878a029f25ecddfdc041d7b283123a3c0485cf54..023e75bd4637f50179ef14ed04c542a33a85dd50 100644 --- a/src/pregmod/generateChild.tw +++ b/src/pregmod/generateChild.tw @@ -5,10 +5,10 @@ <<set $mergeDad = 0>> <<for $m = 0; $m < $genePool.length; $m++>> <<if $mom.ID == $genePool[$m].ID>> - <<set $mergeMom = $genePool[$m]>> + <<set $mergeMom = clone($genePool[$m])>> <</if>> <<if $mom.pregSource == $genePool[$m].ID>> - <<set $mergeDad = $genePool[$m]>> + <<set $mergeDad = clone($genePool[$m])>> <</if>> <</for>> <<if $mom.pregSource == -1>> diff --git a/src/pregmod/testGenetics.tw b/src/pregmod/testGenetics.tw index 4499bbb868b6665eb60245a5c945ad2912fd09ca..e7064b3cc5231b02a3eaeee43ce31d5155f6bbae 100644 --- a/src/pregmod/testGenetics.tw +++ b/src/pregmod/testGenetics.tw @@ -50,3 +50,15 @@ All slave array slaves MUST be present in genePool or else there is a malfunctio <</if>> <</for>> </table> + +<<if _errorCause>> + @@.red;Errors in the gene pool detected! Please report this.@@ + <<link "Add missing slaves to the gene pool">> + <<for _i = 0; _i < $slaves.length; _i++>> + <<if $genePool.every(function(g) { return $slaves[_i].ID !== g.ID; })>> + <<set $genePool.push($slaves[_i])>> + <</if>> + <</for>> + <<goto "Main">> + <</link>> //This will not fix missing properties.// +<</if>> diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw index 587897030fe5a23f32658a66741f0ea9858107c3..3ca616c3223ba961fc1b83344a5fb3023643425a 100644 --- a/src/uncategorized/BackwardsCompatibility.tw +++ b/src/uncategorized/BackwardsCompatibility.tw @@ -3377,6 +3377,9 @@ Setting missing slave variables: <<set _dontDeleteMe = 1>> <</if>> <</if>> + <<if isImpregnatedBy($PC, _Slave)>> /* did we impregnate the PC */ + <<set _dontDeleteMe = 1>> + <</if>> <<if _dontDeleteMe == 0>> /* avoid going through this loop if possible */ <<for _bci2 = 0; _bci2 < $slaves.length; _bci2++>> <<if isImpregnatedBy($slaves[_bci2], _Slave)>> /* have we impregnated a slave on the slaves array? */