From 6beddd87c5d2fb37edf3093de33c613e0f46756d Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Thu, 13 Feb 2020 01:32:48 -0500
Subject: [PATCH] use getSlave

---
 src/js/useSlave.JS | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/js/useSlave.JS b/src/js/useSlave.JS
index f24361b65f2..b06c192d103 100644
--- a/src/js/useSlave.JS
+++ b/src/js/useSlave.JS
@@ -282,24 +282,24 @@ window.useSlaveDisplay = function(slave) {
 			}
 		}
 		if (slave.relationship > 0) {
-			const si = V.slaveIndices[slave.relationshipTarget];
-			if (isSlaveAvailable(V.slaves[si])) {
-				sexOptions.push({text: `Fuck ${him} with ${his} ${relationshipTermShort(slave)} ${SlaveFullName(V.slaves[si])}`, scene: `FRelation`, update: {partner: "relationship"}});
+			const lover = getSlave(slave.relationshipTarget);
+			if (isSlaveAvailable(lover)) {
+				sexOptions.push({text: `Fuck ${him} with ${his} ${relationshipTermShort(slave)} ${SlaveFullName(lover)}`, scene: `FRelation`, update: {partner: "relationship"}});
 			} else {
-				if (V.slaves[si].assignment === "be your agent") {
+				if (lover.assignment === "be your agent") {
 					if (slave.broodmother < 2) {
-						sexOptions.push({text: `Send ${him} to live with your agent ${SlaveFullName(V.slaves[si])}`, goto: `Agent Company`, update: {subSlave: V.slaves[si]}});
+						sexOptions.push({text: `Send ${him} to live with your agent ${SlaveFullName(lover)}`, goto: `Agent Company`, update: {subSlave: lover}});
 					} else {
 						sexOptions.push({text: `A hyper-broodmother cannot be sent to live with your agent`});
 					}
 				} else {
-					sexOptions.push({text: `${SlaveFullName(V.slaves[si])} is unavailable`});
+					sexOptions.push({text: `${SlaveFullName(lover)} is unavailable`});
 				}
 			}
 		}
 		if (slave.rivalryTarget !== 0 && hasAllLimbs(slave)) {
-			let rsi = V.slaveIndices[slave.rivalryTarget];
-			if (isSlaveAvailable(V.slaves[rsi]) && hasAnyLegs(V.slaves[rsi])) {
+			const rival = getSlave(slave.relationshipTarget);
+			if (isSlaveAvailable(rival) && hasAnyLegs(rival)) {
 				sexOptions.push({text: `Abuse ${his} rival with ${him}`, scene: `FRival`});
 			}
 		}
-- 
GitLab