From 06c06495e5ca08d5f0ee743e53999c55b8db9c84 Mon Sep 17 00:00:00 2001
From: lowercase-donkey <lowercasedonkey@gmail.com>
Date: Sat, 19 Jan 2019 13:20:02 -0500
Subject: [PATCH] ezsh simplification to cashX

---
 devNotes/twine JS.txt | 12 +++---------
 src/js/economyJS.tw   | 12 +++---------
 2 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/devNotes/twine JS.txt b/devNotes/twine JS.txt
index 4e5c393eac6..cab476276c2 100644
--- a/devNotes/twine JS.txt	
+++ b/devNotes/twine JS.txt	
@@ -3117,11 +3117,11 @@ window.cashX = function(cost, what, who) {
 		`;
 	} else {
 		
+		//Spend the money
+		V.cash += cost;
+		
 		//INCOME
 		if(cost > 0) {
-			
-				//Spend the money
-				V.cash += cost;
 
 				//record the action
 				if (typeof V.lastWeeksCashIncome[what] !== 'undefined') {
@@ -3140,9 +3140,6 @@ window.cashX = function(cost, what, who) {
 		//EXPENSES
 		else if(cost < 0) {
 
-			//Spend the money
-			V.cash += cost;
-
 			//record the action
 			if (typeof V.lastWeeksCashExpenses[what] !== 'undefined') {
 				V.lastWeeksCashExpenses[what] += cost;
@@ -3159,9 +3156,6 @@ window.cashX = function(cost, what, who) {
 				}
 			}
 		}
-		else {
-			//somebody probably tried to pass a 0, ignore it.  New slaves will default to "slaveCost: 0", no need to call a costX for it.
-		}
 		return cost;
 	}
 };
diff --git a/src/js/economyJS.tw b/src/js/economyJS.tw
index d54156cd24c..8ac5d2cab7d 100644
--- a/src/js/economyJS.tw
+++ b/src/js/economyJS.tw
@@ -973,11 +973,11 @@ window.cashX = function(cost, what, who) {
 		`;
 	} else {
 		
+		//Spend the money
+		V.cash += cost;
+		
 		//INCOME
 		if(cost > 0) {
-			
-				//Spend the money
-				V.cash += cost;
 
 				//record the action
 				if (typeof V.lastWeeksCashIncome[what] !== 'undefined') {
@@ -996,9 +996,6 @@ window.cashX = function(cost, what, who) {
 		//EXPENSES
 		else if(cost < 0) {
 
-			//Spend the money
-			V.cash += cost;
-
 			//record the action
 			if (typeof V.lastWeeksCashExpenses[what] !== 'undefined') {
 				V.lastWeeksCashExpenses[what] += cost;
@@ -1015,9 +1012,6 @@ window.cashX = function(cost, what, who) {
 				}
 			}
 		}
-		else {
-			//somebody probably tried to pass a 0, ignore it.  New slaves will default to "slaveCost: 0", no need to call a costX for it.
-		}
 		return cost;
 	}
 };
-- 
GitLab