:: extended family widgets [nobr widget]

<<widget "parentName">>
<<if $activeSlave[$args[0]] == $PC.ID>>
	You
<<else>>
	<<set _j = $slaveIndices[$activeSlave[$args[0]]]>>
	<<if def _j>>
		<<print $slaves[_j].slaveName>>
	<<else>>
		Unknown
	<</if>>
<</if>>
<</widget>>

<<widget "redisplayFamily">>
<<replace '#dontBeDumb'>><br> //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.//<</replace>>
<<replace '#fatheredNames'>><<= App.StartingGirls.listOfSlavesWithParent("father", $activeSlave.ID)>><</replace>>
<<replace '#motheredNames'>><<= App.StartingGirls.listOfSlavesWithParent("mother", $activeSlave.ID)>><</replace>>
<<replace '#familySummary'>><<= App.Desc.family($activeSlave)>><</replace>>
<<replace '#motherName'>><<parentName "mother">><</replace>>
<<replace '#fatherName'>><<parentName "father">><</replace>>
<<replace '#sameMotherNames'>><<= App.StartingGirls.listOfSlavesWithParent("mother", $activeSlave.mother)>><</replace>>
<<replace '#sameFatherNames'>><<= App.StartingGirls.listOfSlavesWithParent("father", $activeSlave.father)>><</replace>>
<<run App.StartingGirls.uncommittedFamilyTree($activeSlave)>>
<</widget>>

<<widget "editFamily">>
<<set _allowPCFamily = ($freshPC == 1 || $saveImported == 0)>>
<div id="editFamily"><div id="familyTable">

<span id="dontBeDumb"></span>

<br>''Mother:'' <span id="motherName"><<parentName "mother">></span>
<<link "Reset">>
	<<set $activeSlave.mother = 0>>
	<<redisplayFamily>>
<</link>>
<<if $PC.vagina > 0 && (($PC.actualAge - $activeSlave.actualAge) >= $fertilityAge) && (($PC.mother != $activeSlave.mother) || ($activeSlave.mother == 0)) && _allowPCFamily>>
	| <<link "You">><<set $activeSlave.mother = $PC.ID>><<redisplayFamily>><</link>>
<</if>>
<<for _efw = 0; _efw < $slaves.length; _efw++>>
	<<if $slaves[_efw].vagina > 0 && (($slaves[_efw].actualAge - $activeSlave.actualAge) >= $fertilityAge) && (($slaves[_efw].mother != $activeSlave.mother) || ($activeSlave.mother == 0)) && $slaves[_efw].newGamePlus == 0>>
		|
		<<set _id = $slaves[_efw].ID>>
		<<set _slaveName = $slaves[_efw].slaveName>>
		<<print "
			<<link _slaveName>>
				<<set $activeSlave.mother = " + _id + ">>
				<<redisplayFamily>>
			<</link>>
		">>
	<</if>>
<</for>>

<br>''Father:'' <span id="fatherName"><<parentName "father">></span>
<<link "Reset">>
	<<set $activeSlave.father = 0>>
	<<redisplayFamily>>
<</link>>
<<if ($PC.dick > 0) && (($PC.actualAge - $activeSlave.actualAge) >= $potencyAge) && (($PC.father != $activeSlave.father) || ($activeSlave.father == 0)) && _allowPCFamily>>
	| <<link "You">><<set $activeSlave.father = $PC.ID>><<redisplayFamily>><</link>>
<</if>>
<<for _efw = 0; _efw < $slaves.length; _efw++>>
	<<if ($slaves[_efw].dick > 0) && ((($slaves[_efw].actualAge - $activeSlave.actualAge) >= $potencyAge)) && (($slaves[_efw].father != $activeSlave.father) || ($activeSlave.father == 0)) && $slaves[_efw].newGamePlus == 0>>
		|
		<<set _id = $slaves[_efw].ID>>
		<<set _slaveName = $slaves[_efw].slaveName>>
		<<print "
		<<link _slaveName>>
			<<set $activeSlave.father = " + _id + ">>
			<<redisplayFamily>>
		<</link>>
		">>
	<</if>>
<</for>>

<br>''Same mother as:'' <span id="sameMotherNames"><<= App.StartingGirls.listOfSlavesWithParent('mother', $activeSlave.mother)>></span>
<<link "Reset">>
	<<set $activeSlave.mother = 0>>
	<<redisplayFamily>>
<</link>>
<<if ($activeSlave.mother != $PC.ID) && ($PC.mother != $activeSlave.ID) && _allowPCFamily>>
	|
	<<link "You">>
		<<if $PC.mother != 0>>
			<<set $activeSlave.mother = $PC.mother>>
		<<elseif $activeSlave.mother != 0>>
			<<set $PC.mother = $activeSlave.mother>>
		<<else>>
			<<set $activeSlave.mother = -20 - 2*$activeSlave.ID>>
			<<set $PC.mother = $activeSlave.mother>>
		<</if>>
		<<redisplayFamily>>
	<</link>>
<</if>>
<<for _efw = 0; _efw < $slaves.length; _efw++>>
	<<if $slaves[_efw].newGamePlus == 0>>
		<<if $saveImported == 1>>|<</if>>
		<<set _slaveName = $slaves[_efw].slaveName>>
		<<set _slave = $slaves[_efw]>>
		<<if ($activeSlave.mother != _slave.ID) && (_slave.mother != $activeSlave.ID)>>
			|
			<<print "
				<<link _slaveName>>
					<<set _slave = $slaves[" + _efw + "]>>
					<<if _slave.mother != 0>>
						<<set $activeSlave.mother = _slave.mother>>
					<<elseif $activeSlave.mother != 0>>
						<<set _slave.mother = $activeSlave.mother>>
					<<else>>
						<<set $activeSlave.mother = -20 - 2*$activeSlave.ID>>
						<<set _slave.mother = $activeSlave.mother>>
					<</if>>
					<<redisplayFamily>>
				<</link>>
			">>
		<</if>>
	<</if>>
<</for>>

<br>''Same father as:'' <span id="sameFatherNames"><<= App.StartingGirls.listOfSlavesWithParent('father', $activeSlave.father)>></span>
<<link "Reset">>
	<<set $activeSlave.father = 0>>
	<<replace '#fatherName'>><</replace>>
	<<replace '#sameFatherNames'>><</replace>>
	<<redisplayFamily>>
<</link>>
<<if ($activeSlave.father != $PC.ID) && ($PC.father != $activeSlave.ID) && _allowPCFamily>>
	|
	<<link "You">>
		<<if $PC.father != 0>>
			<<set $activeSlave.father = $PC.father>>
		<<elseif $activeSlave.father != 0>>
			<<set $PC.father = $activeSlave.father>>
		<<else>>
			<<set $activeSlave.father = (-20 - 2*$activeSlave.ID -1)>>
			<<set $PC.father = $activeSlave.father>>
		<</if>>
		<<redisplayFamily>>
	<</link>>
<</if>>
<<for _efw = 0; _efw < $slaves.length; _efw++>>
	<<if $slaves[_efw].newGamePlus == 0>>
		<<if $saveImported == 1>>|<</if>>
		<<set _slaveName = $slaves[_efw].slaveName>>
		<<set _slave = $slaves[_efw]>>
		<<if ($activeSlave.father != _slave.ID) && (_slave.father != $activeSlave.ID)>>
			|
			<<print "
				<<link _slaveName>>
					<<set _slave = $slaves[" + _efw + "]>>
					<<if _slave.father != 0>>
						<<set $activeSlave.father = _slave.father>>
					<<elseif $activeSlave.father != 0>>
						<<set _slave.father = $activeSlave.father>>
					<<else>>
						<<set $activeSlave.father = (-20 - 2*$activeSlave.ID -1)>>
						<<set _slave.father = $activeSlave.father>>
					<</if>>
					<<redisplayFamily>>
				<</link>>
			">>
		<</if>>
	<</if>>
<</for>>

<br>''Mother of the children:'' <span id="motheredNames"><<= App.StartingGirls.listOfSlavesWithParent("mother", $activeSlave.ID)>></span>
<<link "Reset">>
	<<for _efw = 0; _efw < $slaves.length; _efw++>>
		<<if $slaves[_efw].mother == $activeSlave.ID && $slaves[_efw].newGamePlus == 0>>
			<<set $slaves[_efw].mother = 0>>
		<</if>>
	<</for>>
	<<if $PC.mother == $activeSlave.ID && _allowPCFamily>>
		<<set $PC.mother = 0>>
	<</if>>
	<<redisplayFamily>>
<</link>>
<<if $activeSlave.vagina >= 0>>
	<<if (($activeSlave.actualAge - $PC.actualAge) >= $fertilityAge) && (($PC.mother != $activeSlave.mother) || ($activeSlave.mother == 0)) && _allowPCFamily>>
		|
		<<link "You">>
			<<set $PC.mother = $activeSlave.ID>>
			<<if $activeSlave.vagina == 0>>
				<<set $activeSlave.vagina = 1>>
			<</if>>
			<<redisplayFamily>>
		<</link>>
	<</if>>

	<<for _efw = 0; _efw < $slaves.length; _efw++>>
		<<if $slaves[_efw].newGamePlus == 0>>
			<<set _slaveName = $slaves[_efw].slaveName>>
			<<set _slave = $slaves[_efw]>>
			<<if (($activeSlave.actualAge - _slave.actualAge) >= $fertilityAge) && ((_slave.mother != $activeSlave.mother) || ($activeSlave.mother == 0))>>
				|
				<<print "
				<<link _slaveName>>
					<<set _slave = $slaves[" + _efw + "]>>
					<<set _slave.mother = $activeSlave.ID>>
					<<if $activeSlave.vagina == 0>>
						<<set $activeSlave.vagina = 1>>
					<</if>>
					<<redisplayFamily>>
				<</link>>
				">>
			<</if>>
		<</if>>
	<</for>>
<</if>>

<br>''Father of the children:'' <span id="fatheredNames"><<= App.StartingGirls.listOfSlavesWithParent("father", $activeSlave.ID)>></span>
<<link "Reset">>
	<<for _efw = 0; _efw < $slaves.length; _efw++>>
		<<if $slaves[_efw].father == $activeSlave.ID && $slaves[_efw].newGamePlus == 0>>
			<<set $slaves[_efw].father = 0>>
		<</if>>
	<</for>>
	<<if $PC.father == $activeSlave.ID && _allowPCFamily>>
		<<set $PC.father = 0>>
	<</if>>
	<<redisplayFamily>>
<</link>>
<<if $activeSlave.dick > 0>>
	<<if (($activeSlave.actualAge - $PC.actualAge) >= $potencyAge) && (($PC.father != $activeSlave.father) || ($activeSlave.father == 0)) && _allowPCFamily>>
		|
		<<link "You">>
			<<set $PC.father = $activeSlave.ID>>
			<<redisplayFamily>>
		<</link>>
	<</if>>

	<<for _efw = 0; _efw < $slaves.length; _efw++>>
		<<if $slaves[_efw].newGamePlus == 0>>
			<<set _slaveName = $slaves[_efw].slaveName>>
			<<set _slave = $slaves[_efw]>>
			<<if (($activeSlave.actualAge - _slave.actualAge) >= $potencyAge) && ((_slave.father != $activeSlave.father) || ($activeSlave.father == 0))>>
				|
				<<print "
				<<link _slaveName>>
					<<set _slave = $slaves[" + _efw + "]>>
					<<set _slave.father = $activeSlave.ID>>
					<<redisplayFamily>>
				<</link>>
				">>
			<</if>>
		<</if>>
	<</for>>
<</if>>

<br>
<<if _allowPCFamily>>
	<<link "Reset ALL PC Relatives">>
		<<set _sameMother = 0, _sameFather = 0>>
		<<for _efw = 0; _efw < $slaves.length; _efw++>>
			<<if $slaves[_efw].newGamePlus == 0>>
				<<if $slaves[_efw].mother == $PC.ID>>
					<<set $slaves[_efw].mother = 0>>
				<</if>>
				<<if $slaves[_efw].father == $PC.ID>>
					<<set $slaves[_efw].father = 0>>
				<</if>>
				<<if $slaves[_efw].mother == $PC.mother>>
					<<set _sameMother++>>
				<</if>>
				<<if $slaves[_efw].father == $PC.father>>
					<<set _sameFather++>>
				<</if>>
			<</if>>
		<</for>>
		<<if _sameMother == 0 && $activeSlave.mother == $PC.mother>>
			<<set $activeSlave.mother = 0>>
		<</if>>
		<<if _sameFather == 0 && $activeSlave.father == $PC.father>>
			<<set $activeSlave.father = 0>>
		<</if>>
		<<for _efw = 0; (_efw < $slaves.length && (_sameMother == 1 || _sameFather == 1)); _efw++>>
			<<if $slaves[_efw].newGamePlus == 0>>
				<<if $slaves[_efw].mother == $PC.mother && _sameMother == 1>>
					<<set $slaves[_efw].mother = 0, _sameMother = 0>>
				<</if>>
				<<if $slaves[_efw].father == $PC.father && _sameFather == 1>>
					<<set $slaves[_efw].father = 0, _sameFather = 0>>
				<</if>>
			<</if>>
		<</for>>
		<<if $activeSlave.mother == $PC.ID>>
			<<set $activeSlave.mother = 0>>
		<</if>>
		<<if $activeSlave.father == $PC.ID>>
			<<set $activeSlave.father = 0>>
		<</if>>
		<<set $PC.father = 0>>
		<<set $PC.mother = 0>>
		<<redisplayFamily>>
	<</link>>
<</if>>

<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span id="familySummary"><<= App.Desc.family($activeSlave)>></span>
<br>
</div>
<div id="familyTree"></div>
</div>

<</widget>>

src/utility/extendedFamilyWidgets.tw