From ff85aaf98ccb067be52021c374a2d2441c0c1814 Mon Sep 17 00:00:00 2001
From: pregmodfan <pregmodfan@cock.li>
Date: Thu, 22 Mar 2018 03:38:58 +0200
Subject: [PATCH] csec error with incubator fix

---
 src/pregmod/csec.tw | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/pregmod/csec.tw b/src/pregmod/csec.tw
index a7a19ed75c3..e46649af910 100644
--- a/src/pregmod/csec.tw
+++ b/src/pregmod/csec.tw
@@ -1,6 +1,7 @@
 :: csec [nobr]
 
 <<set $nextButton = " ", $nextLink = "Slave Interact">>
+
 <<ClearSummaryCache $activeSlave>>
 
 <<set _getFather = $slaves.find(function(s) { return s.ID == $activeSlave.pregSource; })>>
@@ -15,7 +16,6 @@
 <<set $activeSlave.pregControl = "none">>
 <<set _beforeSize = WombGetVolume($activeSlave)>>
 <<set $activeSlave.curBabies = WombBirth($activeSlave, 34)>> /* 34 week is minimal gestation time for live birth. Here we take only ready to survive. With others we will deal later in code. */
-
 <<set $activeSlave.curStillBirth = 0 >>
 
 <<set _curBabies = $activeSlave.curBabies.length>> /*just to improve speed and usability here.*/
@@ -117,9 +117,10 @@ Performing a cesarean section is trivial for the remote surgery to carry out. $a
 	<<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 $mom.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 $activeSlave = $mom>>
 <<else>>
 	/*No live babies. Placeholder */
 <</if>>
-- 
GitLab