From 45c0221f324b83b0e7ba6df5ab0f8fe7881cdd35 Mon Sep 17 00:00:00 2001
From: kopareigns <kopareigns@gmail.com>
Date: Sat, 19 Jan 2019 12:15:05 -0500
Subject: [PATCH] Fixes

---
 devNotes/twine JS.txt                    | 28 ++++++++++++------------
 src/art/artJS.tw                         |  1 +
 src/facilities/farmyard/farmerSelect.tw  |  1 +
 src/facilities/nursery/matronSelect.tw   |  1 +
 src/js/assignJS.tw                       | 28 ++++++++++++------------
 src/uncategorized/attendantSelect.tw     |  1 +
 src/uncategorized/bgSelect.tw            |  1 +
 src/uncategorized/concubineSelect.tw     |  1 +
 src/uncategorized/djSelect.tw            |  1 +
 src/uncategorized/madamSelect.tw         |  1 +
 src/uncategorized/milkmaidSelect.tw      |  1 +
 src/uncategorized/nurseSelect.tw         |  1 +
 src/uncategorized/persBusiness.tw        |  5 ++---
 src/uncategorized/recruiterSelect.tw     |  2 ++
 src/uncategorized/schoolteacherSelect.tw |  1 +
 src/uncategorized/stewardessSelect.tw    |  1 +
 src/uncategorized/wardenessSelect.tw     |  1 +
 17 files changed, 45 insertions(+), 31 deletions(-)

diff --git a/devNotes/twine JS.txt b/devNotes/twine JS.txt
index ee4f7e5797d..556357298d5 100644
--- a/devNotes/twine JS.txt	
+++ b/devNotes/twine JS.txt	
@@ -10583,33 +10583,33 @@ window.removeJob = function removeJob(slave, assignment) {
 	else {
 		if (V.HeadGirl !== 0 && slave.ID === V.HeadGirl.ID)
 			V.HeadGirl = 0;
-		if (V.Recruiter !== 0 && slave.ID == V.Recruiter.ID)
+		else if (V.Recruiter !== 0 && slave.ID === V.Recruiter.ID)
 			V.Recruiter = 0;
-		if (V.Bodyguard !== 0 && slave.ID === V.Bodyguard.ID)
+		else if (V.Bodyguard !== 0 && slave.ID === V.Bodyguard.ID)
 			V.Bodyguard = 0;
-		if (V.Madam !== 0 && slave.ID === V.Madam.ID)
+		else if (V.Madam !== 0 && slave.ID === V.Madam.ID)
 			V.Madam = 0;
-		if (V.DJ !== 0 && slave.ID === V.DJ.ID)
+		else if (V.DJ !== 0 && slave.ID === V.DJ.ID)
 			V.DJ = 0;
-		if (V.Milkmaid !== 0 && slave.ID === V.Milkmaid.ID)
+		else if (V.Milkmaid !== 0 && slave.ID === V.Milkmaid.ID)
 			V.Milkmaid = 0;
-		if (V.Farmer !== 0 && slave.ID === V.Farmer.ID)
+		else if (V.Farmer !== 0 && slave.ID === V.Farmer.ID)
 			V.Farmer = 0;
-		if (V.Schoolteacher !== 0 && slave.ID === V.Schoolteacher.ID)
+		else if (V.Schoolteacher !== 0 && slave.ID === V.Schoolteacher.ID)
 			V.Schoolteacher = 0;
-		if (V.Attendant !== 0 && slave.ID === V.Attendant.ID)
+		else if (V.Attendant !== 0 && slave.ID === V.Attendant.ID)
 			V.Attendant = 0;
-		if (V.Matron !== 0 && slave.ID === V.Matron.ID)
+		else if (V.Matron !== 0 && slave.ID === V.Matron.ID)
 			V.Matron = 0;
-		if (V.Nurse !== 0 && slave.ID === V.Nurse.ID)
+		else if (V.Nurse !== 0 && slave.ID === V.Nurse.ID)
 			V.Nurse = 0;
-		if (V.Stewardess !== 0 && slave.ID === V.Stewardess.ID)
+		else if (V.Stewardess !== 0 && slave.ID === V.Stewardess.ID)
 			V.Stewardess = 0;
-		if (V.Wardeness !== 0 && slave.ID === V.Wardeness.ID)
+		else if (V.Wardeness !== 0 && slave.ID === V.Wardeness.ID)
 			V.Wardeness = 0;
-		if (V.Concubine !== 0 && slave.ID === V.Concubine.ID)
+		else if (V.Concubine !== 0 && slave.ID === V.Concubine.ID)
 			V.Concubine = 0;
-		if (V.Collectrix !== 0 && slave.ID === V.Collectrix.ID)
+		else if (V.Collectrix !== 0 && slave.ID === V.Collectrix.ID)
 			V.Collectrix = 0;
 
 		/* use .toLowerCase() to get rid of a few dupe conditions. */
diff --git a/src/art/artJS.tw b/src/art/artJS.tw
index 83187d5eff5..1b216ebeefd 100644
--- a/src/art/artJS.tw
+++ b/src/art/artJS.tw
@@ -1733,6 +1733,7 @@ window.skinColorCatcher = function (artSlave) {
 };
 
 window.VectorArt = (function (artSlave) {
+	"use strict";
 	let V, T, slave;
 	let r;
 	let leftArmType, rightArmType, legSize, torsoSize, buttSize, penisSize, hairLength;
diff --git a/src/facilities/farmyard/farmerSelect.tw b/src/facilities/farmyard/farmerSelect.tw
index be0a7bcb217..13c28547772 100644
--- a/src/facilities/farmyard/farmerSelect.tw
+++ b/src/facilities/farmyard/farmerSelect.tw
@@ -3,6 +3,7 @@
 <<set $nextButton = "Back", $nextLink = "Farmyard", $showEncyclopedia = 1, $encyclopedia = "Farmer">>
 <<showallAssignmentFilter>>
 <<if ($Farmer != 0)>>
+	<<set $Farmer = getSlave($Farmer.ID)>>
 	<<setLocalPronouns $Farmer>>
 	''__@@.pink;<<= SlaveFullName($Farmer)>>@@__'' is serving as your Farmer.<br><br>$He will tend to your crops and animals.
 <<else>>
diff --git a/src/facilities/nursery/matronSelect.tw b/src/facilities/nursery/matronSelect.tw
index 61def000231..a51bca44fa9 100644
--- a/src/facilities/nursery/matronSelect.tw
+++ b/src/facilities/nursery/matronSelect.tw
@@ -3,6 +3,7 @@
 <<set $nextButton = "Back", $nextLink = "Nursery", $showEncyclopedia = 1, $encyclopedia = "Matron">>
 <<showallAssignmentFilter>>
 <<if ($Matron != 0)>>
+	<<set $Matron = getSlave($Matron.ID)>>
 	<<setLocalPronouns $Matron>>
 	''__@@.pink;<<= SlaveFullName($Matron)>>@@__'' is serving as your Matron.<br><br>$He will manage the nursery.
 <<else>>
diff --git a/src/js/assignJS.tw b/src/js/assignJS.tw
index 342e01aa19a..1665ef1787e 100644
--- a/src/js/assignJS.tw
+++ b/src/js/assignJS.tw
@@ -340,33 +340,33 @@ window.removeJob = function removeJob(slave, assignment) {
 	else {
 		if (V.HeadGirl !== 0 && slave.ID === V.HeadGirl.ID)
 			V.HeadGirl = 0;
-		if (V.Recruiter !== 0 && slave.ID == V.Recruiter.ID)
+		else if (V.Recruiter !== 0 && slave.ID === V.Recruiter.ID)
 			V.Recruiter = 0;
-		if (V.Bodyguard !== 0 && slave.ID === V.Bodyguard.ID)
+		else if (V.Bodyguard !== 0 && slave.ID === V.Bodyguard.ID)
 			V.Bodyguard = 0;
-		if (V.Madam !== 0 && slave.ID === V.Madam.ID)
+		else if (V.Madam !== 0 && slave.ID === V.Madam.ID)
 			V.Madam = 0;
-		if (V.DJ !== 0 && slave.ID === V.DJ.ID)
+		else if (V.DJ !== 0 && slave.ID === V.DJ.ID)
 			V.DJ = 0;
-		if (V.Milkmaid !== 0 && slave.ID === V.Milkmaid.ID)
+		else if (V.Milkmaid !== 0 && slave.ID === V.Milkmaid.ID)
 			V.Milkmaid = 0;
-		if (V.Farmer !== 0 && slave.ID === V.Farmer.ID)
+		else if (V.Farmer !== 0 && slave.ID === V.Farmer.ID)
 			V.Farmer = 0;
-		if (V.Schoolteacher !== 0 && slave.ID === V.Schoolteacher.ID)
+		else if (V.Schoolteacher !== 0 && slave.ID === V.Schoolteacher.ID)
 			V.Schoolteacher = 0;
-		if (V.Attendant !== 0 && slave.ID === V.Attendant.ID)
+		else if (V.Attendant !== 0 && slave.ID === V.Attendant.ID)
 			V.Attendant = 0;
-		if (V.Matron !== 0 && slave.ID === V.Matron.ID)
+		else if (V.Matron !== 0 && slave.ID === V.Matron.ID)
 			V.Matron = 0;
-		if (V.Nurse !== 0 && slave.ID === V.Nurse.ID)
+		else if (V.Nurse !== 0 && slave.ID === V.Nurse.ID)
 			V.Nurse = 0;
-		if (V.Stewardess !== 0 && slave.ID === V.Stewardess.ID)
+		else if (V.Stewardess !== 0 && slave.ID === V.Stewardess.ID)
 			V.Stewardess = 0;
-		if (V.Wardeness !== 0 && slave.ID === V.Wardeness.ID)
+		else if (V.Wardeness !== 0 && slave.ID === V.Wardeness.ID)
 			V.Wardeness = 0;
-		if (V.Concubine !== 0 && slave.ID === V.Concubine.ID)
+		else if (V.Concubine !== 0 && slave.ID === V.Concubine.ID)
 			V.Concubine = 0;
-		if (V.Collectrix !== 0 && slave.ID === V.Collectrix.ID)
+		else if (V.Collectrix !== 0 && slave.ID === V.Collectrix.ID)
 			V.Collectrix = 0;
 
 		/* use .toLowerCase() to get rid of a few dupe conditions. */
diff --git a/src/uncategorized/attendantSelect.tw b/src/uncategorized/attendantSelect.tw
index 77c148e8886..18e7dd6c10a 100644
--- a/src/uncategorized/attendantSelect.tw
+++ b/src/uncategorized/attendantSelect.tw
@@ -3,6 +3,7 @@
 <<set $nextButton = "Back", $nextLink = "Spa", $showEncyclopedia = 1, $encyclopedia = "Attendant">>
 <<showallAssignmentFilter>>
 <<if ($Attendant != 0)>>
+	<<set $Attendant = getSlave($Attendant.ID)>>
 	<<setLocalPronouns $Attendant>>
 	''__@@.pink;<<= SlaveFullName($Attendant)>>@@__'' is serving as your Attendant.<br><br>$He will help pamper and counsel your slaves.
 <<else>>
diff --git a/src/uncategorized/bgSelect.tw b/src/uncategorized/bgSelect.tw
index f500a46ffa0..dca3c18ad31 100644
--- a/src/uncategorized/bgSelect.tw
+++ b/src/uncategorized/bgSelect.tw
@@ -3,6 +3,7 @@
 <<set $nextButton = "Back to Main", $nextLink = "Main", $showEncyclopedia = 1, $encyclopedia = "Bodyguard">>
 <<showallAssignmentFilter>>
 <<if ($Bodyguard != 0)>>
+	<<set $Bodyguard = getSlave($Bodyguard.ID)>>
 	<<setLocalPronouns $Bodyguard>>
 	''__@@.pink;<<= SlaveFullName($Bodyguard)>>@@__'' is serving as your bodyguard.<br><br>$He will remain close to you at all times and guard your person.
 <<else>>
diff --git a/src/uncategorized/concubineSelect.tw b/src/uncategorized/concubineSelect.tw
index 7ba78201ccc..b4242ad2b21 100644
--- a/src/uncategorized/concubineSelect.tw
+++ b/src/uncategorized/concubineSelect.tw
@@ -3,6 +3,7 @@
 <<set $nextButton = "Back", $nextLink = "Master Suite", $showEncyclopedia = 1, $encyclopedia = "Concubine">>
 <<showallAssignmentFilter>>
 <<if ($Concubine != 0)>>
+	<<set $Concubine = getSlave($Concubine.ID)>>
 	<<setLocalPronouns $Concubine>>
 	''__@@.pink;<<= SlaveFullName($Concubine)>>@@__'' is serving as your Concubine.<br><br>$He will take the lead in seeing to your pleasure.
 <<else>>
diff --git a/src/uncategorized/djSelect.tw b/src/uncategorized/djSelect.tw
index 4d4cb064d23..f4a6bf3cfcc 100644
--- a/src/uncategorized/djSelect.tw
+++ b/src/uncategorized/djSelect.tw
@@ -3,6 +3,7 @@
 <<set $nextButton = "Back", $nextLink = "Club", $showEncyclopedia = 1>><<set $encyclopedia = "DJ">>
 <<showallAssignmentFilter>>
 <<if ($DJ != 0)>>
+	<<set $DJ = getSlave($DJ.ID)>>
 	<<setLocalPronouns $DJ>>
 	''__@@.pink;<<= SlaveFullName($DJ)>>@@__'' is serving as your DJ.<br><br>$He will headline entertainment in $clubName.
 <<else>>
diff --git a/src/uncategorized/madamSelect.tw b/src/uncategorized/madamSelect.tw
index 16237564f8b..9da31ff648c 100644
--- a/src/uncategorized/madamSelect.tw
+++ b/src/uncategorized/madamSelect.tw
@@ -3,6 +3,7 @@
 <<set $nextButton = "Back", $nextLink = "Brothel", $showEncyclopedia = 1, $encyclopedia = "Madam">>
 <<showallAssignmentFilter>>
 <<if ($Madam != 0)>>
+	<<set $Madam = getSlave($Madam.ID)>>
 	''__@@.pink;<<= SlaveFullName($Madam)>>@@__'' is serving as your Madam.<br><br>She will manage the brothel.
 <<else>>
 	You have not selected a Madam.
diff --git a/src/uncategorized/milkmaidSelect.tw b/src/uncategorized/milkmaidSelect.tw
index 3b376235814..8664f5a4aba 100644
--- a/src/uncategorized/milkmaidSelect.tw
+++ b/src/uncategorized/milkmaidSelect.tw
@@ -3,6 +3,7 @@
 <<set $nextButton = "Back", $nextLink = "Dairy", $showEncyclopedia = 1, $encyclopedia = "Milkmaid">>
 <<showallAssignmentFilter>>
 <<if ($Milkmaid != 0)>>
+	<<set $Milkmaid = getSlave($Milkmaid.ID)>>
 	''__@@.pink;<<= SlaveFullName($Milkmaid)>>@@__'' is serving as your Milkmaid.<br><br>She will look after your livestock, helping them give milk<<if $seeDicks > 0>> and semen<</if>>.
 <<else>>
 	You have not selected a Milkmaid.
diff --git a/src/uncategorized/nurseSelect.tw b/src/uncategorized/nurseSelect.tw
index aec59b4518e..028cd08d534 100644
--- a/src/uncategorized/nurseSelect.tw
+++ b/src/uncategorized/nurseSelect.tw
@@ -3,6 +3,7 @@
 <<set $nextButton = "Back", $nextLink = "Clinic", $showEncyclopedia = 1, $encyclopedia = "Nurse">>
 <<showallAssignmentFilter>>
 <<if ($Nurse != 0)>>
+	<<set $Nurse = getSlave($Nurse.ID)>>
 	<<setLocalPronouns $Nurse>>
 	''__@@.pink;<<= SlaveFullName($Nurse)>>@@__'' is serving as your Nurse.<br><br>$He will help heal your slaves.
 <<else>>
diff --git a/src/uncategorized/persBusiness.tw b/src/uncategorized/persBusiness.tw
index 7a796ee551b..dd833aaaaab 100644
--- a/src/uncategorized/persBusiness.tw
+++ b/src/uncategorized/persBusiness.tw
@@ -802,12 +802,11 @@ Routine upkeep of your demesne costs @@.yellow;<<print cashFormat($costs)>>.@@
 		<</if>>
 	<</if>>
 <</if>>
-<<if !isInt($costs)>>
+<<set $costs = Math.trunc(Math.abs(getCost($slaves)) * 100)/100>> /*overwrite the prediction and actually pay the bill.  GetCost should return a negative. Round to two decimal places.*/
+<<if isNaN($costs)>>
 	<br>@@.red;Error, costs is NaN@@
 <</if>>
 
-<<set $costs = Math.abs(getCost($slaves))>> /*overwrite the prediction and actually pay the bill.  GetCost should return a negative.*/
-
 <<if $secExp == 1>>
 	<<if $weapManu == 1>>
 		<br>
diff --git a/src/uncategorized/recruiterSelect.tw b/src/uncategorized/recruiterSelect.tw
index b7450d1150f..c700e594dc9 100644
--- a/src/uncategorized/recruiterSelect.tw
+++ b/src/uncategorized/recruiterSelect.tw
@@ -3,6 +3,8 @@
 <<set $nextButton = "Back to Main", $nextLink = "Main", $showEncyclopedia = 1, $encyclopedia = "Recruiter">>
 <<showallAssignmentFilter>>
 <<if ($Recruiter != 0)>>
+	<<set $Recruiter = getSlave($Recruiter.ID)>>
+	<<setLocalPronouns $Recruiter>>
 	''__@@.pink;<<= SlaveFullName($Recruiter)>>@@__'' is
 	<<if $recruiterTarget != "other arcologies">>
 		recruiting girls.
diff --git a/src/uncategorized/schoolteacherSelect.tw b/src/uncategorized/schoolteacherSelect.tw
index 0cc6eab471a..549b492526f 100644
--- a/src/uncategorized/schoolteacherSelect.tw
+++ b/src/uncategorized/schoolteacherSelect.tw
@@ -3,6 +3,7 @@
 <<set $nextButton = "Back", $nextLink = "Schoolroom", $showEncyclopedia = 1, $encyclopedia = "Schoolteacher">>
 <<showallAssignmentFilter>>
 <<if ($Schoolteacher != 0)>>
+	<<set $Schoolteacher = getSlave($Schoolteacher.ID)>>
 	<<setLocalPronouns $Schoolteacher>>
 	''__@@.pink;<<= SlaveFullName($Schoolteacher)>>@@__'' is serving as your Schoolteacher.<br><br>$He will help teach your slaves.
 <<else>>
diff --git a/src/uncategorized/stewardessSelect.tw b/src/uncategorized/stewardessSelect.tw
index a328f48ee9c..021ad7ad589 100644
--- a/src/uncategorized/stewardessSelect.tw
+++ b/src/uncategorized/stewardessSelect.tw
@@ -3,6 +3,7 @@
 <<set $nextButton = "Back", $nextLink = "Servants' Quarters", $showEncyclopedia = 1, $encyclopedia = "Stewardesses">>
 <<showallAssignmentFilter>>
 <<if ($Stewardess != 0)>>
+	<<set $Stewardess = getSlave($Stewardess.ID)>>
 	<<setLocalPronouns $Stewardess>>
 	''__@@.pink;<<= SlaveFullName($Stewardess)>>@@__'' is serving as your Stewardess.<br><br>$He will manage the Servants' Quarters.
 <<else>>
diff --git a/src/uncategorized/wardenessSelect.tw b/src/uncategorized/wardenessSelect.tw
index fc352b2f0fa..2c87c790bea 100644
--- a/src/uncategorized/wardenessSelect.tw
+++ b/src/uncategorized/wardenessSelect.tw
@@ -3,6 +3,7 @@
 <<set $nextButton = "Back", $nextLink = "Cellblock", $showEncyclopedia = 1, $encyclopedia = "Wardeness">>
 <<showallAssignmentFilter>>
 <<if ($Wardeness != 0)>>
+	<<set $Wardeness = getSlave($Wardeness.ID)>>
 	''__@@.pink;<<= SlaveFullName($Wardeness)>>@@__'' is serving as your Wardeness.<br><br>She will help break your prisoners.
 <<else>>
 	You have not selected a Wardeness.
-- 
GitLab