From f1dd51deebfe6c09c21a93a99dc671196e590c59 Mon Sep 17 00:00:00 2001
From: pregmodfan <pregmodfan@cock.li>
Date: Mon, 19 Feb 2018 20:02:12 +0200
Subject: [PATCH] more csec work

---
 src/pregmod/csec.tw                   | 116 ++++++++++++++------------
 src/pregmod/widgets/seBirthWidgets.tw |   2 +-
 2 files changed, 62 insertions(+), 56 deletions(-)

diff --git a/src/pregmod/csec.tw b/src/pregmod/csec.tw
index a783d34e0a3..351f631c9b7 100644
--- a/src/pregmod/csec.tw
+++ b/src/pregmod/csec.tw
@@ -66,63 +66,67 @@
 /* ------------------------------------------------ */
 
 Performing a cesarean section is trivial for the remote surgery for the remote surgery to carry out. $activeSlave.slaveName is sedated, her child<<if _curBabies > 1>>ren<</if>> extracted, and taken to a bed to recover. By the time she comes to,
-<<if $activeSlave.pregSource == -1>>
-	your
-<<elseif $activeSlave.pregSource == -2>>
-	your arcology's
-<<elseif $activeSlave.pregSource == -3>>
-	the Societal Elites'
-<<elseif $activeSlave.pregSource == 0>>
-	some man's
-<<elseif $activeSlave.ID == $daddy.ID>>
-	her own
-<<else>>
-	$daddy's
-<</if>>
-<<if _curBabies <= 1>>
-	baby has
-<<elseif _curBabies >= 40>>
-	massive brood of $activeSlave.pregType babies have
-<<elseif _curBabies >= 20>>
-	brood of $activeSlave.pregType babies have
-<<elseif _curBabies >= 10>>
-	impressive group of $activeSlave.pregType babies have
-<<elseif _curBabies == 9>>
-	nonuplets have
-<<elseif _curBabies == 8>>
-	octuplets have
-<<elseif _curBabies == 7>>
-	septuplets have
-<<elseif _curBabies == 6>>
-	sextuplets have
-<<elseif _curBabies == 5>>
-	quintuplets have
-<<elseif _curBabies == 4>>
-	quadruplets have
-<<elseif _curBabies == 3>>
-	triplets have
-<<else>>
-	twins have
-<</if>>
-already been
+<<if _curBabies >0 >>
+	<<if $activeSlave.pregSource == -1>>
+		your
+	<<elseif $activeSlave.pregSource == -2>>
+		your arcology's
+	<<elseif $activeSlave.pregSource == -3>>
+		the Societal Elites'
+	<<elseif $activeSlave.pregSource == 0>>
+		some man's
+	<<elseif $activeSlave.ID == $daddy.ID>>
+		her own
+	<<else>>
+		$daddy's
+	<</if>>
+	<<if _curBabies <= 1>>
+		baby has
+	<<elseif _curBabies >= 40>>
+		massive brood of $activeSlave.pregType babies have
+	<<elseif _curBabies >= 20>>
+		brood of $activeSlave.pregType babies have
+	<<elseif _curBabies >= 10>>
+		impressive group of $activeSlave.pregType babies have
+	<<elseif _curBabies == 9>>
+		nonuplets have
+	<<elseif _curBabies == 8>>
+		octuplets have
+	<<elseif _curBabies == 7>>
+		septuplets have
+	<<elseif _curBabies == 6>>
+		sextuplets have
+	<<elseif _curBabies == 5>>
+		quintuplets have
+	<<elseif _curBabies == 4>>
+		quadruplets have
+	<<elseif _curBabies == 3>>
+		triplets have
+	<<else>>
+		twins have
+	<</if>>
+	already been
 
-<<if _cToIncub == _curBabies >>
-	taken to $incubatorName.
-	<<set _incubated = 2>>
-<<elseif _cToIncub < _curBabies>>
-	split between $incubatorName and
-	<<set _incubated = 1>>
+	<<if _cToIncub == _curBabies >>
+		taken to $incubatorName.
+		<<set _incubated = 2>>
+	<<elseif _cToIncub < _curBabies>>
+		split between $incubatorName and
+		<<set _incubated = 1>>
+	<</if>>
+	<<set $mom = $activeSlave>>
+	<<for _cb = 0; _cb < _cToIncub; _cb++>> /* if there is no reserved children, code in loop will not trigger */
+			<<include "Generate Child">>
+			<<include "Incubator Workaround">>
+			<<set $activeSlave.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 */
+			<<set $reservedChildren-- >>
+	<</for>>
+<<else>>
+	/*No live babies. Placeholder */
 <</if>>
-<<set $mom = $activeSlave>>
-<<for _cb = 0; _cb < _cToIncub; _cb++>> /* if there is no reserved children, code in loop will not trigger */
-		<<include "Generate Child">>
-		<<include "Incubator Workaround">>
-		<<set $activeSlave.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 */
-		<<set $reservedChildren-- >>
-<</for>>
 <<set _curBabies = $slaves[$i].curBabies.length >>
 
-<<if _incubated != 2>>
+<<if _incubated != 2 && _curBabies > 0 >>
 	<span id="_disposition">
 	<<if _incubated == 1>>the rest<</if>>
 	<<if $arcologies[0].FSRestart != "unset" && $activeSlave.breedingMark == 1 && $activeSlave.pregSource == -1>>
@@ -223,7 +227,9 @@ already been
 	</span>
 <</if>>
 
-<<if $activeSlave.fetish != "mindbroken" && $activeSlave.fuckdoll == 0>>
+<<if _curBabies+_cToIncub < 1>>
+	/* Reaction for no live babies here. Placeholder.*/	
+<<elseif $activeSlave.fetish != "mindbroken" && $activeSlave.fuckdoll == 0>> 
 	<br><br>
 	<<if $activeSlave.pregSource == -1>>
 		<<if $activeSlave.devotion < 20 && ($week-$activeSlave.weekAcquired >= $activeSlave.weekAcquired)>>
@@ -250,7 +256,7 @@ already been
 	<</if>>
 <</if>>
 
-<<if $arcologies[0].FSRestart != "unset">>
+<<if $arcologies[0].FSRestart != "unset" && _curBabies > 0>>
 	<br><br>
 	<<if $activeSlave.breedingMark == 1 && $activeSlave.pregSource == -1>>
 		The Societal Elite @@.green;are pleased@@ at the new additions to their class.
diff --git a/src/pregmod/widgets/seBirthWidgets.tw b/src/pregmod/widgets/seBirthWidgets.tw
index 3d4f3dc00c0..3f14f0e83ce 100644
--- a/src/pregmod/widgets/seBirthWidgets.tw
+++ b/src/pregmod/widgets/seBirthWidgets.tw
@@ -745,7 +745,7 @@ All in all,
 	<</if>>
 	<<if _lostBabies != 1>>
 		<<set $slaveOrphanageTotal += _curBabies>>
-		Unless you provide otherwise, the child<<if $slaves[$i].pregType > 1>>ren<</if>> will be remanded to one of $arcologies[0].name's slave orphanages. $slaves[$i].slaveName
+		Unless you provide otherwise, the child<<if _curBabies > 1>>ren<</if>> will be remanded to one of $arcologies[0].name's slave orphanages. $slaves[$i].slaveName
 		<<if $slaves[$i].devotion > 95>>
 			worships you so completely that $pronoun will not resent this.
 		<<elseif $slaves[$i].devotion > 50>>
-- 
GitLab