From c6631d6e9a49c1427354e4918ada328a33c42ab1 Mon Sep 17 00:00:00 2001
From: Cayleth <vikingbaerserker@gmail.com>
Date: Wed, 6 Mar 2019 18:44:17 -0800
Subject: [PATCH] Move for loop outside pregsource in storyinit

This is meant to help prevent surrogacy problems in the future
---
 src/init/storyInit.tw | 50 +++++++++++++++++++++----------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/init/storyInit.tw b/src/init/storyInit.tw
index 5f2f6c7417c..cf5245bd8b2 100644
--- a/src/init/storyInit.tw
+++ b/src/init/storyInit.tw
@@ -95,32 +95,32 @@ You should have received a copy of the GNU General Public License along with thi
 				<<set $slaves[_i].sisters += 1>>
 			<</if>>
 		<</for>>
-		<<if $slaves[_k].pregSource > 0>>
-			<<set $slaves[_k].pregSource += _NGPOffset>>
-			<<set _getFather = $slaveIndices[$slaves[_k].pregSource]>>
-			<<if ndef _getFather>>
-				<<set $slaves[_k].pregSource = 0>>
-			<</if>>
-			<<for _sInit = 0; _sInit < $slaves[_k].womb.length; _sInit++>>
-				<<if $slaves[_k].womb[_sInit].fatherID > 0>>
-					<<set $slaves[_k].womb[_sInit].fatherID += _NGPOffset>>
-				<</if>>
-				<<if $slaves[_k].womb[_sInit].genetics.father > 0>>
-					<<set $slaves[_k].womb[_sInit].genetics.father += _NGPOffset>>
-				<<elseif $freshPC == 1 && $slaves[_k].womb[_sInit].genetics.father == -1>>
-					<<set $slaves[_k].womb[_sInit].genetics.father = -_NGPOffset>>
-				<<elseif $slaves[_k].womb[_sInit].genetics.father < -1>>
-					<<set $slaves[_k].womb[_sInit].genetics.father -= _NGPOffset>>
-				<</if>>
-				<<if $slaves[_k].womb[_sInit].genetics.mother > 0>>
-					<<set $slaves[_k].womb[_sInit].genetics.mother += _NGPOffset>>
-				<<elseif $freshPC == 1 && $slaves[_k].womb[_sInit].genetics.mother == -1>>
-					<<set $slaves[_k].womb[_sInit].genetics.mother = -_NGPOffset>>
-				<<elseif $slaves[_k].womb[_sInit].genetics.mother < -1>>
-					<<set $slaves[_k].womb[_sInit].genetics.mother -= _NGPOffset>>
+		<<for _sInit = 0; _sInit < $slaves[_k].womb.length; _sInit++>>
+			<<if $slaves[_k].pregSource > 0>>
+				<<set $slaves[_k].pregSource += _NGPOffset>>
+				<<set _getFather = $slaveIndices[$slaves[_k].pregSource]>>
+				<<if ndef _getFather>>
+					<<set $slaves[_k].pregSource = 0>>
 				<</if>>
-			<</for>>
-		<</if>>
+					<<if $slaves[_k].womb[_sInit].fatherID > 0>>
+						<<set $slaves[_k].womb[_sInit].fatherID += _NGPOffset>>
+					<</if>>
+					<<if $slaves[_k].womb[_sInit].genetics.father > 0>>
+						<<set $slaves[_k].womb[_sInit].genetics.father += _NGPOffset>>
+					<<elseif $freshPC == 1 && $slaves[_k].womb[_sInit].genetics.father == -1>>
+						<<set $slaves[_k].womb[_sInit].genetics.father = -_NGPOffset>>
+					<<elseif $slaves[_k].womb[_sInit].genetics.father < -1>>
+						<<set $slaves[_k].womb[_sInit].genetics.father -= _NGPOffset>>
+					<</if>>
+					<<if $slaves[_k].womb[_sInit].genetics.mother > 0>>
+						<<set $slaves[_k].womb[_sInit].genetics.mother += _NGPOffset>>
+					<<elseif $freshPC == 1 && $slaves[_k].womb[_sInit].genetics.mother == -1>>
+						<<set $slaves[_k].womb[_sInit].genetics.mother = -_NGPOffset>>
+					<<elseif $slaves[_k].womb[_sInit].genetics.mother < -1>>
+						<<set $slaves[_k].womb[_sInit].genetics.mother -= _NGPOffset>>
+					<</if>>
+			<</if>>
+		<</for>>
 		<<if $slaves[_k].cloneID != 0>>
 			<<set _getClone = $slaveIndices[$slaves[_k].cloneID]>>
 			<<if ndef _getClone>>
-- 
GitLab