From 8c0521d60b9567d928024ec2c5c6f0dc19d91792 Mon Sep 17 00:00:00 2001
From: hexall90 <hexall90@gmail.com>
Date: Sat, 11 Nov 2017 22:24:55 +0100
Subject: [PATCH] fixes more

---
 src/SecExp/attackGenerator.tw        |  2 +-
 src/SecExp/unitsRebellionReport.tw   | 36 +++++++++++++---------------
 src/uncategorized/buildingWidgets.tw |  1 +
 3 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/src/SecExp/attackGenerator.tw b/src/SecExp/attackGenerator.tw
index 22b275ce829..0d5422e2f4d 100644
--- a/src/SecExp/attackGenerator.tw
+++ b/src/SecExp/attackGenerator.tw
@@ -24,7 +24,7 @@
 	<</if>>
 <</if>>
 
-<<if $forceBattle == 1 && $foughtThisWeek == 0>>
+<<if $forceBattle == 1 && $forceRebellion != 1 && $foughtThisWeek == 0>>
 	<<set _attackChance = 100>>
 <</if>>
 
diff --git a/src/SecExp/unitsRebellionReport.tw b/src/SecExp/unitsRebellionReport.tw
index 5cc79f3fe68..9a33ac7851b 100644
--- a/src/SecExp/unitsRebellionReport.tw
+++ b/src/SecExp/unitsRebellionReport.tw
@@ -456,37 +456,35 @@
 		
 	/* loss */
 	<<elseif $rebellingUnits.length > 0>>
-		<<set _militiaRebelled = 0>>
+		<<set _militiaRebelled = []>>
 		<<for _j = 0; _j < $militiaUnits.length; _j++>>
 			<<if $militiaUnits[_j].active == 1 && _rebellingID.includes($militiaUnits[_j].ID)>>
-				$militiaUnits[_j].platoonName,
-				<<set $militiaUnits.deleteAt(_j)>>
-				<<set _militiaRebelled++>>
-				had the gall to betray you and join your enemies. They participated in the looting following the battle, then vanished in the wastes.
+				<<set _militiaRebelled.push($militiaUnits[_j])>>
+				<br>$militiaUnits[_j].platoonName had the gall to betray you and join your enemies. They participated in the looting following the battle, then vanished in the wastes.
 			<</if>>
 		<</for>>
-		<<set $cash -= 1000 * _militiaRebelled>>
-		<br>
-		<<set _slaveRebelled = 0>>
+		<<set $cash -= 1000 * _militiaRebelled.length>>
+		<<set $militiaUnits.delete(_militiaRebelled)>>
+		
+		<<set _slaveRebelled = []>>
 		<<for _j = 0; _j < $slaveUnits.length; _j++>>
 			<<if $slaveUnits[_j].active == 1 && _rebellingID.includes($slaveUnits[_j].ID)>>
-				<br>$slaveUnits[_j].platoonName,
-				<<set $slaveUnits.deleteAt(_j)>>
-				<<set _slaveRebelled++>>
-				decided in their blind arrogance to betray you. They participated in the looting following the battle, then vanished in the wastes.
+				<<set _slaveRebelled.push($slaveUnits[_j])>>
+				<br>$slaveUnits[_j].platoonName decided in their blind arrogance to betray you. They participated in the looting following the battle, then vanished in the wastes.
 			<</if>>
 		<</for>>
-		<<set $cash -= 1000 * _slaveRebelled>>
-		<<set _mercRebelled = 0>>
+		<<set $cash -= 1000 * _slaveRebelled.length>>
+		<<set $slaveUnits.delete(_slaveRebelled)>>
+		
+		<<set _mercRebelled = []>>
 		<<for _j = 0; _j < $mercUnits.length; _j++>>
 			<<if $mercUnits[_j].active == 1 && _rebellingID.includes($mercUnits[_j].ID)>>
-				<br>$mercUnits[_j].platoonName,
-				<<set $mercUnits.deleteAt(_j)>>
-				<<set _mercRebelled++>>
-				made the grave mistake of betraying you. They participated in the looting following the battle, then vanished in the wastes.
+				<<set _mercRebelled.push($mercUnits[_j])>>
+				<br>$mercUnits[_j].platoonName made the grave mistake of betraying you. They participated in the looting following the battle, then vanished in the wastes.
 			<</if>>
 		<</for>>
-		<<set $cash -= 1000 * _mercRebelled>>
+		<<set $cash -= 1000 * _mercRebelled.length>>
+		<<set $mercUnits.delete(_slaveRebelled)>>
 		<<recalcManpower>>
 	<</if>>
 <<else>>
diff --git a/src/uncategorized/buildingWidgets.tw b/src/uncategorized/buildingWidgets.tw
index f4044d0190e..46f49463d9c 100644
--- a/src/uncategorized/buildingWidgets.tw
+++ b/src/uncategorized/buildingWidgets.tw
@@ -6,6 +6,7 @@ Displays the arcology as a table.
 Yes, I am aware this is horrible. If anyone can figure out how to get widgets to play nice with tables, or otherwise unfuck this, tell me and I'll implement it.
 %/
 <<widget "DisplayBuilding">>
+
 <<set _Pass = passage()>>
 
 <style>
-- 
GitLab