From 85b07c32860d832eef4cf53ab009d57837e04da8 Mon Sep 17 00:00:00 2001
From: Svornost <11434-svornost@users.noreply.gitgud.io>
Date: Tue, 28 Jan 2020 22:34:22 -0800
Subject: [PATCH] When an agent is removed from somewhere other than the
 diplomacy page, reset the correct arcology's government.

---
 src/js/assignJS.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/js/assignJS.js b/src/js/assignJS.js
index 7caead6c7c1..c80c39e24c4 100644
--- a/src/js/assignJS.js
+++ b/src/js/assignJS.js
@@ -594,8 +594,9 @@ window.removeJob = function removeJob(slave, assignment) {
 			case "be your agent":
 			case "live with your agent":
 				if (slave.assignment === "be your agent") {
-					App.activeArcology().leaderID = 0;
-					App.activeArcology().government = "your trustees";
+					const arc = V.arcologies.find((a) => a.leaderID === slave.ID);
+					arc.leaderID = 0;
+					arc.government = "your trustees";
 				}
 				slave.assignment = "rest";
 				V.leaders.deleteWith(s => s.ID === slave.ID);
-- 
GitLab