From f707904c4e87ab263d034b45212eb50c3756367b Mon Sep 17 00:00:00 2001
From: hexall90 <hexall90@gmail.com>
Date: Sat, 11 Nov 2017 14:05:23 +0100
Subject: [PATCH] fixes

---
 TODO.txt                                    |   4 +-
 src/SecExp/SecExpBackwardCompatibility.tw   |   2 +-
 src/SecExp/rebellionEvents.tw               |  43 ++++++-
 src/SecExp/secExpEventsOld.tw               | 126 --------------------
 src/SecExp/secInit.tw                       |   2 +-
 src/uncategorized/BackwardsCompatibility.tw |   2 +-
 src/uncategorized/persBusiness.tw           |   6 +-
 7 files changed, 49 insertions(+), 136 deletions(-)
 delete mode 100644 src/SecExp/secExpEventsOld.tw

diff --git a/TODO.txt b/TODO.txt
index 670cbd81d46..76fad42ae7e 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,14 +1,12 @@
 Main:
--finish recalc widgets
+-fix the "fix it" widgets
 
 Rebellions:
 -citizens mini events
--add security maluses to losses
 
 further development:
 -specialized slave schools
 -fortifications
--weap manufactoring
 -transport hub
 
 Events:
diff --git a/src/SecExp/SecExpBackwardCompatibility.tw b/src/SecExp/SecExpBackwardCompatibility.tw
index 35c0cd60747..fec5164fd88 100644
--- a/src/SecExp/SecExpBackwardCompatibility.tw
+++ b/src/SecExp/SecExpBackwardCompatibility.tw
@@ -82,7 +82,7 @@
 <<set $majorBattleGameOver = 1>>
 <</if>>
 <<if ndef $rebellionsEnabled>>
-<<set $rebellionsEnabled = 0>>
+<<set $rebellionsEnabled = 1>>
 <</if>>
 <<if ndef $forceRebellion>>
 <<set $forceRebellion = 0>>
diff --git a/src/SecExp/rebellionEvents.tw b/src/SecExp/rebellionEvents.tw
index 00690f7c6eb..2c82cd80a1e 100644
--- a/src/SecExp/rebellionEvents.tw
+++ b/src/SecExp/rebellionEvents.tw
@@ -69,13 +69,50 @@
 	<</if>>
 	<<set $tension += random(10,15)>>
 <<case 4>>
-	random citizen mini event, low tension
+	<<set _rand = random(0,6)>>
+	<<if _rand == 0>>
+		This week a citizen refused to pay rent, claiming ideological opposition to the arcology's owner policies. He was quickly dealt with, but his words might not have fallen silent yet.
+	<<elseif _rand == 1>>
+		This week books of unknwon origin and dangerous content were found in the possession of several citizens. They were mostly sociopolitical treaties, making it clear that the intent of the responsibles was to fan the fire of rebellion. Most of them were bought and archived, but a few are still circling between the citizens of the arcology.
+	<<elseif _rand == 2>>
+		This week a citizen was caught giving refuge to other citizens, who would be liable to be enslaved because of their debts. The situation was quickly resolved, but the misplaced generosity of that citizen might have inflamed a few souls.
+	<<elseif _rand == 3>>
+		
+	<<elseif _rand == 4>>
+		
+	<<elseif _rand == 5>>
+		
+	<<else>>
+		
+	<</if>>
 	<<set $tension += random(1,5)>>
 <<case 5>>
-	random citizen mini event, med tension
+	<<set _rand = random(0,5)>>
+	<<if _rand == 0>>
+		
+	<<elseif _rand == 1>>
+		
+	<<elseif _rand == 2>>
+		
+	<<elseif _rand == 3>>
+		
+	<<elseif _rand == 4>>
+		
+	<<else>>
+		
+	<</if>>
 	<<set $tension += random(5,10)>>
 <<case 6>>
-	random citizen mini event, high tension
+	<<set _rand = random(0,4)>>
+	<<if _rand == 0>>
+		
+	<<elseif _rand == 1>>
+		
+	<<elseif _rand == 2>>
+		
+	<<elseif _rand == 3>>
+		
+	<</if>>
 	<<set $tension += random(10,15)>>
 <</switch>>
 
diff --git a/src/SecExp/secExpEventsOld.tw b/src/SecExp/secExpEventsOld.tw
deleted file mode 100644
index d79ec19164d..00000000000
--- a/src/SecExp/secExpEventsOld.tw
+++ /dev/null
@@ -1,126 +0,0 @@
-:: secExpEvents [nobr]
-
-<<if $slaveRebellionEventFires == 1>>
-	<<if $tension <= 33>>
-		<<set _event = 1>>
-	<<elseif $tension <= 66>>
-		<<set _event = 2>>
-	<<else>>
-		<<set _event = 3>>
-	<</if>>
-<<elseif $citizenRebellionEventFires == 1>>
-	<<if $tension <= 33>>
-		<<set _event = 4>>
-	<<elseif $tension <= 66>>
-		<<set _event = 5>>
-	<<else>>
-		<<set _event = 6>>
-	<</if>>
-<<else>>
-	<<set _event = 0>>
-<</if>>
-
-<<switch _event>>
-<<case 0>>
-	/* random events not linked to rebellions */
-<<case 1>>
-	/* low tension slave rebellion events */
-	<<set _select = random(1,3)>>
-	<<if _select == 1>>
-		<<set $slaveEvent11 += 1>>
-		Dangerous Communications
-		<hr>
-		Your quiet morning routine is interrupted by an urgent message from your assistant. It seems an interesting conversation were intercepted during the night<<if $slaveEvent11 > 0>> and it's not the first time something like this happened<</if>>. The authors were quite smart in their execution:
-		knowing all digital channels are to some level under surveillance, they resolved to use simple written messages hidden away in incospicuos drop points. A couple of security drones reported suspicious activity and <<if $secHQ == 1>>the security department<<else>>your assistant<</if>> quickly extracted the messages. It used a simple encryption code based on alphanumerical recombinations, nothing your faithful AI cloud not handle.
-		You quickly read the short message and immediately understand the urgency of the call: the conversation was between two or maybe more slaves, plotting the death of their master and their escape.
-		<br>Masters dying by the hands of their slaves is nothing newsworthy, any human being pushed too far will eventually snap, with potentially lethal consequences, any slaver worth half a dime know this. As such you are not really surprised by the intent of the conspirators, but by their cold calculations and planning. The minds behind those written lines were clever and experienced, too much of a danger to be left alone or free.
-		<br>
-		<br>
-		You silently evaluate your options: the atmosphere of the arcology is rather calm at the moment, so harsh punishment for the responsibles will most likely not spark any violent reaction, on the other hand however stepping out of the boundaries of your public figure will not be seen in a good light.
-		<br>
-		<<link "Quietly deal with the slaves involved">>
-			<<set _result = 0>>
-			<<replace "#effect">>
-				Order your <<if $secHQ == 1>>security department<<else>>loyal subordinates<</if>> to find and permanently deal with the slave conspirators. This way your public person will not be involved in the aftermath and dangerous individuals will not be free to act against your institutions. That said covert ops like this will make your citizens doubt the efficacy of your security systems or even worse suspect foul play. <<if $blackOps == 1>>Your black ops team stands ready to carry out your orders<<else>>Hiring a black ops team to carry out the action will cost some cash<</if>>
-			<</replace>>
-		<</link>>
-		|
-		<<link "Tip the victim">>
-			<<set _result = 1>>
-			<<replace "#effect">>
-				Make the discovery reach the ears of the slave owner. This way you will stay out of the public eye, while the slaves residing in the arcology will witness the result of rebellious activity.
-				Revealing the depth of your control over the information flow and movements in the arcology will scare and anger many of your citizens, damaging your reputation. Furthermore, while tensions may subdue in the short term, public display of punishments may radicalize more slave.
-			<</replace>>
-		<</link>>
-		|
-		<<link "Publically punish the slaves">>
-			<<set _result = 2>>
-			<<replace "#effect">>
-				Act quickyl and harshly against those who would rise against their better. The slaves residing in the arcology will witness the result of rebellious activity, but many of your citizens will be concerned with your authoritarian actions against what is private property of one of your citizens. Furthermore, while tensions may subdue in the short term, such public display may radicalize more slave.
-			<</replace>>
-		<</link>>
-		<br>
-		<br>
-		<span id="effect">Click on a choice to see its effects</span>
-		<br>
-		<<link "Confirm">>
-			<<if _result == 0>>
-				<<if $blackOps == 0>>
-					<<set $cash -= 2500>>
-				<</if>>
-				<<set $slaveProgression += random(0,5)>>
-				<<set $tension += random(0,5)>>
-				<<set $security -= random(0,3)>>
-			<<elseif _result == 1>>
-				<<set $slaveProgression += random(2,8)>>
-				<<set $tension -= random(0,5)>>
-				<<set $rep -= random(1000,1500)>>
-			<<elseif _result == 2>>
-				<<set $slaveProgression += random(2,8)>>
-				<<set $tension -= random(0,5)>>
-				<<set $authority -= random(1000,1500)>>
-			<</if>>
-			<<goto "">>
-		<</link>>
-	<<elseif _select == 2>>
-		<<set $slaveEvent12 += 1>>
-		Dangerous books
-		<hr>
-		During your daily routine, you stumble on a rather worrying report<<if $slaveEvent12 > 0>>, not the first of its kind to land on your desk<</if>>. It seems some peculiar books have been found in the possession of several citizens, who seems to be unaware of their presence on their property. After reviewing the data,<<if $secHQ == 1>> your security department<<else>> you<</if>> seem to believe.
-		This means of course that slaves in your arcology have not only managed to acquire books about terror warfare and infiltration, anarchist manuals, not to mention books about less than welcome political theories, but managed to keep them hidden from their masters for who knows how long. You don't know what is more infuriating: the idea of slaves threatening your arcology with uprisings and terrorist actions under your watch or the fact that  
-		your citizens allowed something like this to happen under their noses to begin with.
-		<br>
-		
-		
-	<<else>>
-		/* escape attempt */
-	
-	<</if>>
-<<case 2>>
-	/* med tension slave rebellion events */
-<<case 3>>
-	/* high tension slave rebellion events */
-<<case 4>>
-	/* low tension citizen rebellion events */
-<<case 5>>
-	/* med tension citizen rebellion events */
-<<case 6>>
-	/* high tension citizen rebellion events */
-<</switch>>
-
-
-
-
-events:
-	Slaves:
-		low:
-			-inflammatory material
-			-escape attempt
-		med:
-			-disappearing of weapons
-			-mysterious homicide
-			-rumors of slave assemblies
-		high:
-			-riots
-			-night raids
-			-burning of personal properties
\ No newline at end of file
diff --git a/src/SecExp/secInit.tw b/src/SecExp/secInit.tw
index d7795c41835..33a04f5f967 100644
--- a/src/SecExp/secInit.tw
+++ b/src/SecExp/secInit.tw
@@ -29,7 +29,7 @@
 <<set $battlesEnabled = 1>>
 <<set $majorBattlesEnabled = 1>>
 <<set $majorBattleGameOver = 1>>
-<<set $rebellionsEnabled = 0>>
+<<set $rebellionsEnabled = 1>>
 <<set $forceRebellion = 0>>
 <<set $rebellionGameOver = 1>>
 
diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw
index e5c0b1b8277..5f938e2b024 100644
--- a/src/uncategorized/BackwardsCompatibility.tw
+++ b/src/uncategorized/BackwardsCompatibility.tw
@@ -592,7 +592,7 @@
 <</if>>
 <<if ndef $DOLFigureHeadFamilyStatuesChildren>>
 	<<set $DOLFigureHeadFamilyStatuesChildren = 0>>
-<</if<<
+<</if>>
 <<if ndef $DOLFigureHeadFamilyStatuesEscorts>>
 	<<set $DOLFigureHeadFamilyStatuesEscorts = 0>>
 <</if>>
diff --git a/src/uncategorized/persBusiness.tw b/src/uncategorized/persBusiness.tw
index 47b50e94550..c10878f44ba 100644
--- a/src/uncategorized/persBusiness.tw
+++ b/src/uncategorized/persBusiness.tw
@@ -697,7 +697,11 @@ Routine upkeep of your demesne costs @@.yellow;¤$costs.@@
 		<<set _income += Math.round($peacekeepers.strength * _price * 10 * _factoryMod)>>
 	<</if>>
 	This week we made @@.yellowgreen;¤<<print _income>>@@
-	<<set $cash += _income>>
+	<<if !isInt(_income)>>
+		<br>@@.red;Error failed to calculate income@@
+	<<else>>
+		<<set $cash += _income>>
+	<</if>>
 <</if>>
 
 <br>
-- 
GitLab