From 05248d715f3aa6b114e1ee32f711cd31b49865d4 Mon Sep 17 00:00:00 2001
From: DCoded <dcoded@live.com>
Date: Fri, 30 Nov 2018 18:05:19 -0500
Subject: [PATCH] Maybe fixes

---
 src/facilities/farmyard/farmyard.tw         |  2 +-
 src/init/storyInit.tw                       |  6 +++---
 src/uncategorized/BackwardsCompatibility.tw |  6 +++---
 src/uncategorized/pit.tw                    | 23 +++++++++++----------
 4 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/src/facilities/farmyard/farmyard.tw b/src/facilities/farmyard/farmyard.tw
index 69922242888..dbe7da3ed3f 100644
--- a/src/facilities/farmyard/farmyard.tw
+++ b/src/facilities/farmyard/farmyard.tw
@@ -72,7 +72,7 @@ $farmyardNameCaps is an oasis of growth in the midst of the jungle of steel and
 <<elseif $Farmer != 0>>
 	$Farmer.slaveName is alone in $farmyardName, and has nothing to do but look after the animals and crops.
 <<else>>	/* TODO: is there any way of cleaning up $animalsBought? I can't think of a good way */
-	$farmyardNameCaps is empty and quiet. <<link "Decommission the Farmyard" "Main">><<set  $farmyardName = "the Farmyard", $farmyard = 0, $farmyardSlaves = 0, $farmyardDecoration = "standard", $farmyardUpgrade = {pump: 0, fertilizer: 0, hydroponics: 0, machinery: 0, seeds: 0, lab: 0}, $farmyardLab = 0, $farmyardLabUpgrades = {animalOvaries: 0, animalTesticles: 0, animalMpreg: 0}, $farmyardCrops = 0, $farmyardKennels = 0, $farmyardStable = 0, $farmyardCages = 0, $activeCanine = -1, $activeHooved = -1, $activeFeline = -1, $animalsBought = {canines: 0, hooved: 0, felines: 0, labradorRetrievers: 0, germanShepherds: 0, goldenRetrievers: 0, frenchBulldogs: 0, bulldogs: 0, beagles: 0, poodles: 0, rottweilers: 0, yorkshireTerriers: 0, siberianHuskies: 0, horses: 0, siameses: 0, persians: 0, maineCoons: 0, ragdolls: 0, bengals: 0, abbysinians: 0, birmans: 0, orientalShorthairs: 0, sphynxes: 0, russianBlues: 0, wolves: 0, foxes: 0, jackals: 0, dingos: 0, zebras: 0, cougars: 0, jaguars: 0, pumas: 0, lynx: 0, leopards: 0, lions: 0, tigers: 0}, $pitAnimal = 0, $canines = [], $hooved = [], $felines = []>>
+	$farmyardNameCaps is empty and quiet. <<link "Decommission the Farmyard" "Main">><<set  $farmyardName = "the Farmyard", $farmyard = 0, $farmyardSlaves = 0, $farmyardDecoration = "standard", $farmyardUpgrade = {pump: 0, fertilizer: 0, hydroponics: 0, machinery: 0, seeds: 0, lab: 0}, $farmyardLab = 0, $farmyardLabUpgrades = {animalOvaries: 0, animalTesticles: 0, animalMpreg: 0}, $farmyardCrops = 0, $farmyardKennels = 0, $farmyardStable = 0, $farmyardCages = 0, $activeCanine = 0, $activeHooved = 0, $activeFeline = 0, $animalsBought = {canines: 0, hooved: 0, felines: 0, labradorRetrievers: 0, germanShepherds: 0, goldenRetrievers: 0, frenchBulldogs: 0, bulldogs: 0, beagles: 0, poodles: 0, rottweilers: 0, yorkshireTerriers: 0, siberianHuskies: 0, horses: 0, siameses: 0, persians: 0, maineCoons: 0, ragdolls: 0, bengals: 0, abbysinians: 0, birmans: 0, orientalShorthairs: 0, sphynxes: 0, russianBlues: 0, wolves: 0, foxes: 0, jackals: 0, dingos: 0, zebras: 0, cougars: 0, jaguars: 0, pumas: 0, lynx: 0, leopards: 0, lions: 0, tigers: 0}, $pitAnimal = 0, $pitAnimalType = 0, $canines = [], $hooved = [], $felines = []>>
 	<<set _far = $sectors.findIndex(function(s) { return s.type == "Farmyard"; })>>
 	<<if _far != -1>>
 		<<set $sectors[_far].type = "Manufacturing">>
diff --git a/src/init/storyInit.tw b/src/init/storyInit.tw
index 7b1f295a1c8..dde5f8948af 100644
--- a/src/init/storyInit.tw
+++ b/src/init/storyInit.tw
@@ -578,9 +578,9 @@ DairyRestraintsSetting($dairyRestraintsSetting)
 <<set $farmyardStable = 0>>
 <<set $farmyardKennels = 0>>
 <<set $farmyardCages = 0>>
-<<set $activeCanine = -1>>
-<<set $activeHooved = -1>>
-<<set $activeFeline = -1>>
+<<set $activeCanine = 0>>
+<<set $activeHooved = 0>>
+<<set $activeFeline = 0>>
 <<set $farmyardLab = 0>>
 <<set $farmyardLabUpgrades = {animalOvaries: 0, animalTesticles: 0, animalMpreg: 0}>>
 <<set $animalsBought = {canines: 0, hooved: 0, felines: 0, labradorRetrievers: 0, germanShepherds: 0, goldenRetrievers: 0, frenchBulldogs: 0, bulldogs: 0, beagles: 0, poodles: 0, rottweilers: 0, yorkshireTerriers: 0, siberianHuskies: 0, horses: 0, siameses: 0, persians: 0, maineCoons: 0, ragdolls: 0, bengals: 0, abbysinians: 0, birmans: 0, orientalShorthairs: 0, sphynxes: 0, russianBlues: 0, wolves: 0, foxes: 0, jackals: 0, dingos: 0, zebras: 0, cougars: 0, jaguars: 0, pumas: 0, lynx: 0, leopards: 0, lions: 0, tigers: 0}>>
diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw
index d28f0c5da76..7c590495109 100644
--- a/src/uncategorized/BackwardsCompatibility.tw
+++ b/src/uncategorized/BackwardsCompatibility.tw
@@ -843,13 +843,13 @@
 	<<unset $defaultFelinePlural = "cougars">>
 <</if>>
 <<if ndef $activeCanine>>
-	<<set $activeCanine = -1>>
+	<<set $activeCanine = 0>>
 <</if>>
 <<if ndef $activeHooved>>
-	<<set $activeHooved = -1>>
+	<<set $activeHooved = 0>>
 <</if>>
 <<if ndef $activeFeline>>
-	<<set $activeFeline = -1>>
+	<<set $activeFeline = 0>>
 <</if>>
 <<if def $boughtWolves>>
 	<<unset $boughtWolves>>
diff --git a/src/uncategorized/pit.tw b/src/uncategorized/pit.tw
index 9d76bad811b..efad4386b39 100644
--- a/src/uncategorized/pit.tw
+++ b/src/uncategorized/pit.tw
@@ -38,7 +38,7 @@ $pitNameCaps is clean and ready,
 	Admission is charged to the fights here. [[Close them|Pit][$pitAudience = "none"]] | [[Stop charging|Pit][$pitAudience = "free"]]
 <</if>>
 
-<<if $Bodyguard != 0 || _CL > 0 || _HL > 0 || _FL > 0>>
+<<if $Bodyguard != 0 || (_CL > 0 && $activeCanine != 0) || (_HL > 0 && $activeHooved != 0) || (_FL > 0 && $activeFeline != 0)>>
 	<br>
 	<<if $pitBG == 0>>
 		<<if $pitAnimal == 0>>
@@ -106,7 +106,7 @@ $pitNameCaps is clean and ready,
 <<if $pitAnimal == 1>>
 	<br>
 	<<if $pitLethal == 1>>
-		<<if $pitAnimalType === $activeCanine>>
+		<<if $pitAnimalType.type == $activeCanine.type>>
 			<<if $activeCanine.species != "dog">>
 				Your slave will fight a ''$activeCanine.species''. 
 				$activeCanine.speciesCap
@@ -142,7 +142,7 @@ $pitNameCaps is clean and ready,
 					<</if>>
 				<</if>>
 			<</if>>
-		<<elseif $pitAnimalType === $activeHooved>>
+		<<elseif $pitAnimalType.type == $activeHooved.type>>
 			Your slave will fight a ''$activeHooved.species''. 
 			<<if _CL > 0>>
 				<<if $activeCanine.species != "dog">>
@@ -163,7 +163,7 @@ $pitNameCaps is clean and ready,
 					//Housecats are too small for your slave to fight//
 				<</if>>
 			<</if>>
-		<<elseif $pitAnimalType === $activeFeline>>
+		<<elseif $pitAnimalType.type == $activeFeline.type>>
 			<<if $activeFeline.species != "cat">>
 				Your slave will fight a ''$activeFeline.species''. 
 		<<else>>
@@ -199,7 +199,6 @@ $pitNameCaps is clean and ready,
 					<</if>>
 				<</if>>
 			<</if>>
-			/* yes, this block is a mess. if you figure out a cleaner way to do it, let me know */
 			<<if (_CL > 0 && _HL > 0) || (_CL > 0 && _FL > 0) || (_HL > 0 && _FL > 0)>> | <</if>>
 			<<if _HL > 0>>
 				[["" + $activeHooved.speciesCap + ""|Pit][$pitAnimalType = $activeHooved]]
@@ -213,7 +212,7 @@ $pitNameCaps is clean and ready,
 
 		<</if>>
 	<<elseif $pitLethal == 0>>
-		<<if $pitAnimalType === $activeCanine>>
+		<<if $pitAnimalType.type == $activeCanine.type>>
 			<<if $activeCanine.species != "dog">>
 				Your slave will try to avoid being used by a ''$activeCanine.species''. 
 				$activeCanine.speciesCap
@@ -249,7 +248,7 @@ $pitNameCaps is clean and ready,
 					//Housecats are too small to use your slave//
 				<</if>>
 			<</if>>
-		<<elseif $pitAnimalType === $activeHooved>>
+		<<elseif $pitAnimalType.type == $activeHooved.type>>
 			Your slave will try to avoid being used by a ''$activeHooved.species''. 
 			<<if _CL > 0>>
 				<<if $activeCanine.species != "dog">>
@@ -270,7 +269,7 @@ $pitNameCaps is clean and ready,
 					//Housecats are too small to use your slave//
 				<</if>>
 			<</if>>
-		<<elseif $pitAnimalType === $activeFeline>>
+		<<elseif $pitAnimalType.type == $activeFeline.type>>
 			<<if $activeFeline.species != "cat">>
 				Your slave will try to avoid being used by a ''$activeFeline.species''. 
 		<<else>>
@@ -306,8 +305,10 @@ $pitNameCaps is clean and ready,
 					<</if>>
 				<</if>>
 			<</if>>
-			<<if (_FL > 0 && _HL > 0) || (_FL > 0 && _CL > 0) || (_HL > 0 && _CL > 0)>> | <</if>>
-			<<if _HL > 0>>[["" + $activeHooved.speciesCap + ""|Pit][$pitAnimalType = $activeHooved]]<</if>>
+			<<if (_CL > 0 && _HL > 0) || (_CL > 0 && _FL > 0) || (_HL > 0 && _FL > 0)>> | <</if>>
+			<<if _HL > 0>>
+				[["" + $activeHooved.speciesCap + ""|Pit][$pitAnimalType = $activeHooved]]
+			<</if>>
 			<<if (_HL > 0 && _FL > 0)>> | <</if>>
 			<<if $activeFeline.species != "cat">>
 				<<if _FL > 0>>
@@ -318,7 +319,7 @@ $pitNameCaps is clean and ready,
 			<</if>>
 		<</if>>
 	<</if>>
-<<else>>
+<<else>>	/* if animal fight is unselected */
 	<<set $pitAnimalType = 0>>
 <</if>>
 <</if>>
-- 
GitLab