From e4c18a0b212d3e1803a1bc130504354e8e34d8e7 Mon Sep 17 00:00:00 2001
From: Pregmodder <pregmodder@gmail.com>
Date: Fri, 11 May 2018 18:40:08 -0400
Subject: [PATCH] It helps to spell things right!

---
 src/js/wombJS.tw                      | 40 ++++++++++++++-------------
 src/pregmod/csec.tw                   | 10 +++----
 src/pregmod/sePlayerBirth.tw          | 29 ++++++++++++++++---
 src/pregmod/widgets/seBirthWidgets.tw | 10 +++----
 4 files changed, 56 insertions(+), 33 deletions(-)

diff --git a/src/js/wombJS.tw b/src/js/wombJS.tw
index 0727794d917..587e725f49c 100644
--- a/src/js/wombJS.tw
+++ b/src/js/wombJS.tw
@@ -336,24 +336,26 @@ window.WombSort = function(actor)
 
 window.fetalSplit = function(actor)
 {
-	var i, ft, nft;
+	var i, ft;
+	var nft = {};
+    nft.age = actor.preg;
+    nft.fatherID = actor.pregSource;
+	nft.sex = Math.round(Math.random())+1;
+    nft.volume = 1;
+	nft.identical = 0;
 	
-	try{
-		for (i in actor.womb)
-		{
-			ft = actor.womb[i];
-			if (jsRandom(1,1000) == 1000 && ft.indentical !== 1)
-				nft = {};
-				nft.age = ft.age;
-				nft.fatherID = ft.fatherID;
-				nft.sex = ft.sex;
-				nft.volume = ft.volume;
-				actor.womb.push(nft);
-				ft.indentical = 1;
-		}
-		WombNormalizePreg(actor);
-    }catch(err){
-        WombInit(actor);
-        alert("no fetus count warning - " + actor.slaveName + " " + err);       
-    }
+	for (i in actor.womb)
+	{
+		ft = actor.womb[i];
+		if (jsRandom(1,1000) > 900 && ft.identical !== 1)
+			nft = {};
+			nft.age = ft.age;
+			nft.fatherID = ft.fatherID;
+			nft.sex = ft.sex;
+			nft.volume = ft.volume;
+			actor.womb.push(nft);
+			ft.identical = 1;
+	}
+	WombNormalizePreg(actor);
+
 }
diff --git a/src/pregmod/csec.tw b/src/pregmod/csec.tw
index 5063f6fed9b..57da8565843 100644
--- a/src/pregmod/csec.tw
+++ b/src/pregmod/csec.tw
@@ -114,10 +114,10 @@ Performing a cesarean section is trivial for the remote surgery to carry out. $a
 		<<set _incubated = 1>>
 	<</if>>
 	<<set $mom = $activeSlave>>
-	<<set _indenticalChildGen = 0>>
+	<<set _identicalChildGen = 0>>
 	<<for _cb = 0; _cb < _cToIncub; _cb++>> /* if there is no reserved children, code in loop will not trigger */
-			<<if _indenticalChildGen == 0>>
-				<<if _cb == $mom.curBabies.length-1 && $mom.curBabies.length > 1 && $mom.curBabies[_cb].identical == 1>> /* catch for improperly placed indentical twin flag to still generate*/
+			<<if _identicalChildGen == 0>>
+				<<if _cb == $mom.curBabies.length-1 && $mom.curBabies.length > 1 && $mom.curBabies[_cb].identical == 1>> /* catch for improperly placed identical twin flag to still generate*/
 					<<set _twin = clone($activeSlave)>>
 					<<set $activeSlave = _twin>>
 					<<set $activeSlave.ID = $IDNumber++>>
@@ -131,9 +131,9 @@ Performing a cesarean section is trivial for the remote surgery to carry out. $a
 			<</if>>
 			<<include "Incubator Workaround">>
 			<<if $mom.curBabies[_cb].identical === 1>>
-				<<set _indenticalChildGen = 1>>
+				<<set _identicalChildGen = 1>>
 			<<else>>
-				<<set _indenticalChildGen = 0>>
+				<<set _identicalChildGen = 0>>
 			<</if>>
 			<<set $mom.curBabies.shift()>> /*for now child generation method for incubator not changed. But here children for incubator removed from array of birthed babies. If we decide later - we can use them for incubator as real objects here. For now they just discarded silently */
 			<<set $reservedChildren-- >>
diff --git a/src/pregmod/sePlayerBirth.tw b/src/pregmod/sePlayerBirth.tw
index f3c3496cc0b..facea923c29 100644
--- a/src/pregmod/sePlayerBirth.tw
+++ b/src/pregmod/sePlayerBirth.tw
@@ -25,7 +25,7 @@ PC.pregSource documentation
 <<set _curBabies = $PC.curBabies.length>> 
 <<set _stilBirth = $PC.womb.length>>
 <<set WombFlush($PC)>>
-/* difference in code below: _curBabies - count of live babies after birth, $PC.pregType = all babies in PC. I assume that dead fetuses do not count to reputation, etc, and PC manages to hide them. This mainly for future possibilities, or early birth triggers. PC will not support partial birth - even she happens to be prenant at different stages at once, undeveloped babies will be dead as result. _stilBirth currently not used - it's just for future improvements.*/
+/* difference in code below: _curBabies - count of live babies after birth, $PC.pregType = all babies in PC. I assume that dead fetuses do not count to reputation, etc, and PC manages to hide them. This mainly for future possibilities, or early birth triggers. PC will not support partial birth - even she happens to be pregnant at different stages at once, undeveloped babies will be dead as result. _stilBirth currently not used - it's just for future improvements.*/
 
 <<set $PC.preg = 0, $PC.pregKnown = 0, $PC.labor = 0, $PC.births += _curBabies>>
 <<if $PC.pregSource == 0>>
@@ -440,8 +440,22 @@ You arrange yourself to give birth, relaxing until your body urges you to begin
 	<</if>>
 
 <<elseif _curBabies > 1>>
+	<<set _identicalChildGen = 0>>
 	<<for _p = 0; _p < _curBabies; _p++>>
-		<<include "Generate Child">>
+		<<print $PC.curBabies[_p].identical>>
+		<<if _identicalChildGen == 0>>
+			<<if _p == $PC.curBabies.length-1 && $PC.curBabies.length > 1 && $PC.curBabies[_p].identical == 1>> /* catch for improperly placed indentical twin flag to still generate*/
+				<<set _twin = clone($activeSlave)>>
+				<<set $activeSlave = _twin>>
+				<<set $activeSlave.ID = $IDNumber++>>
+			<<else>>
+				<<include "Generate Child">>
+			<</if>>
+		<<else>>
+			<<set _twin = clone($activeSlave)>>
+			<<set $activeSlave = _twin>>
+			<<set $activeSlave.ID = $IDNumber++>>
+		<</if>>
 
 		<<if $activeSlave.race == $PC.race>>
 			<<set _PCDegree++>>
@@ -457,7 +471,9 @@ You arrange yourself to give birth, relaxing until your body urges you to begin
 		<</if>>
 
 		<<if _p == 0>>Your first<<else>>The next<</if>> little <<if $babyGender == 1>>girl<<else>>boy<</if>>
-		<<if $PC.pregSource == -6>>
+		<<if _identicalChildGen == 1>>
+			looks exactly like the previous; they're identical twins.
+		<<elseif $PC.pregSource == -6>>
 			looks exactly like you<<if _p == 0>>, in fact, the resemblance seems uncanny. Since she has the exact same genetics as you, she'll likely look almost identical to you when she's your age<</if>>. Every one of your children look this way; it's kind of hard to tell them apart.
 		<<elseif _PCDegree == 4>>
 			looks just like you; she will likely grow up to closely resemble yourself.
@@ -475,7 +491,12 @@ You arrange yourself to give birth, relaxing until your body urges you to begin
 			<<set $PC.curBabies.shift()>>
 			<<set $PC.reservedChildren-- >>
 		<</if>>
-	<<set $babyGender = Math.floor(Math.random()*100) < $seeDicks ? 2 : 1>>
+		<<if $PC.curBabies[_p].identical === 1>>
+			<<set _identicalChildGen = 1>>
+		<<else>>
+			<<set _identicalChildGen = 0>>
+			<<set $babyGender = Math.floor(Math.random()*100) < $seeDicks ? 2 : 1>>
+		<</if>>
 	<</for>>
 
 <</if>>
diff --git a/src/pregmod/widgets/seBirthWidgets.tw b/src/pregmod/widgets/seBirthWidgets.tw
index 7878f88e59f..ed3a6a9f6d8 100644
--- a/src/pregmod/widgets/seBirthWidgets.tw
+++ b/src/pregmod/widgets/seBirthWidgets.tw
@@ -767,12 +767,12 @@ All in all,
 		<<set $slaves[$i].reservedChildren = 0, _cToIncub = _curBabies>>
 	<</if>>
 	<<set $mom = $slaves[$i]>>
-	<<set _indenticalChildGen = 0>>
+	<<set _identicalChildGen = 0>>
 	<br><br>
 	Of $possessive _curBabies child<<if $slaves[$i].pregType > 1>>ren<</if>>; _cToIncub <<if $slaves[$i].reservedChildren > 1>>were<<else>>was<</if>> taken to $incubatorName.
 	<<for _k = 0; _k < _cToIncub; _k-->> 
-		<<if _indenticalChildGen == 0>>
-			<<if _k == $slaves[$i].curBabies.length-1 && $slaves[$i].curBabies.length > 1 && $slaves[$i].curBabies[_k].identical == 1>> /* catch for improperly placed indentical twin flag to still generate*/
+		<<if _identicalChildGen == 0>>
+			<<if _k == $slaves[$i].curBabies.length-1 && $slaves[$i].curBabies.length > 1 && $slaves[$i].curBabies[_k].identical == 1>> /* catch for improperly placed identical twin flag to still generate*/
 				<<set _twin = clone($activeSlave)>>
 				<<set $activeSlave = _twin>>
 				<<set $activeSlave.ID = $IDNumber++>>
@@ -786,9 +786,9 @@ All in all,
 		<</if>>
 		<<include "Incubator Workaround">>
 		<<if $slaves[$i].curBabies[_k].identical === 1>>
-			<<set _indenticalChildGen = 1>>
+			<<set _identicalChildGen = 1>>
 		<<else>>
-			<<set _indenticalChildGen = 0>>
+			<<set _identicalChildGen = 0>>
 		<</if>>
 		<<set $slaves[$i].curBabies.shift()>> /*for now child generation metod for incubator not changed. But here children for incubator removed from array of birthed babies. If we decide later - we can use them for incubator as real objects here. For now they just discarded silently */
 	<</for>>
-- 
GitLab