From 188e9b83ba255b56c0755a64c899e2e42a3786f1 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Tue, 15 Dec 2020 11:19:08 -0500
Subject: [PATCH] fixes

---
 src/npc/startingGirls/editFamily.js | 48 +++++++++++++++++------------
 1 file changed, 28 insertions(+), 20 deletions(-)

diff --git a/src/npc/startingGirls/editFamily.js b/src/npc/startingGirls/editFamily.js
index 40522e45870..b81cb6571a9 100644
--- a/src/npc/startingGirls/editFamily.js
+++ b/src/npc/startingGirls/editFamily.js
@@ -165,7 +165,7 @@ App.Intro.editFamily = function(slave) {
 		}
 
 		for (const potentialRel of V.slaves) {
-			if (canBeMom(potentialRel) && ((potentialRel.actualAge - slave.actualAge) >= potentialRel.pubertyAgeXX) && potentialRel.newGamePlus === 0) {
+			if ((slave.mother !== potentialRel.ID) && (potentialRel.mother !== slave.ID) && potentialRel.newGamePlus === 0) {
 				linkArray.push(
 					App.UI.DOM.link(
 						potentialRel.slaveName,
@@ -228,7 +228,7 @@ App.Intro.editFamily = function(slave) {
 		}
 
 		for (const potentialRel of V.slaves) {
-			if (canBeDad(potentialRel) && potentialRel.newGamePlus === 0) {
+			if ((slave.father !== potentialRel.ID) && (potentialRel.father !== slave.ID) && potentialRel.newGamePlus === 0) {
 				linkArray.push(
 					App.UI.DOM.link(
 						potentialRel.slaveName,
@@ -261,14 +261,7 @@ App.Intro.editFamily = function(slave) {
 		const div = document.createElement("div");
 		const linkArray = [];
 
-		const children = App.StartingGirls.listOfSlavesWithParent("mother", slave.ID);
-		const nameEl = makeElWithID("motheredNames", "span");
-		if (children) {
-			nameEl.append(`${slave.slaveName} is the mother of these children: ${children}. Add: `);
-		} else {
-			nameEl.append(`${slave.slaveName} is not a mother to any children yet. Add:  `);
-		}
-		div.append(nameEl);
+		div.append(motheredNames());
 
 		linkArray.push(
 			App.UI.DOM.link(
@@ -327,18 +320,22 @@ App.Intro.editFamily = function(slave) {
 		}
 	}
 
+	function motheredNames() {
+		const children = App.StartingGirls.listOfSlavesWithParent("mother", slave.ID);
+		const nameEl = makeElWithID("motheredNames", "span");
+		if (children) {
+			nameEl.append(`${slave.slaveName} is the mother of these children: ${children}. Add: `);
+		} else {
+			nameEl.append(`${slave.slaveName} is not a mother to any children yet. Add: `);
+		}
+		return nameEl;
+	}
+
 	function fatherOfTheChildren() {
 		const div = document.createElement("div");
 		const linkArray = [];
 
-		const children = App.StartingGirls.listOfSlavesWithParent("father", slave.ID);
-		const nameEl = makeElWithID("fatheredNames", "span");
-		if (children) {
-			nameEl.append(`${slave.slaveName} is the father of these children: ${children}. Add: `);
-		} else {
-			nameEl.append(`${slave.slaveName} is not a father to any children yet. Add: `);
-		}
-		div.append(nameEl);
+		div.append(fatheredNames());
 
 		linkArray.push(
 			App.UI.DOM.link(
@@ -390,6 +387,17 @@ App.Intro.editFamily = function(slave) {
 		return div;
 	}
 
+	function fatheredNames() {
+		const children = App.StartingGirls.listOfSlavesWithParent("father", slave.ID);
+		const nameEl = makeElWithID("fatheredNames", "span");
+		if (children) {
+			nameEl.append(`${slave.slaveName} is the father of these children: ${children}. Add: `);
+		} else {
+			nameEl.append(`${slave.slaveName} is not a father to any children yet. Add: `);
+		}
+		return nameEl;
+	}
+
 	function resetAllRelativesOfPC() {
 		return App.UI.DOM.makeElement(
 			"div",
@@ -468,8 +476,8 @@ App.Intro.editFamily = function(slave) {
 
 	function refresh() {
 		jQuery('#dont-be-dumb').empty().append(App.UI.DOM.makeElement("div", "You will break things by making impossible relations such as being your own father. If you do this, clearing all PC relations will fix it. Probably.", "note"));
-		jQuery('#fatheredNames').empty().append(App.StartingGirls.listOfSlavesWithParent("father", slave.ID), " ");
-		jQuery('#motheredNames').empty().append(App.StartingGirls.listOfSlavesWithParent("mother", slave.ID), " ");
+		jQuery('#fatheredNames').empty().append(fatheredNames());
+		jQuery('#motheredNames').empty().append(motheredNames());
 		jQuery('#familySummary').empty().append(App.Desc.family(slave));
 		jQuery('#motherName').empty().append(parentName("mother"), " ");
 		jQuery('#fatherName').empty().append(parentName("father"), " ");
-- 
GitLab