From cf247c9b9b831831ea3f5adb2f41514bc0b10a31 Mon Sep 17 00:00:00 2001
From: ErzengelLichtes <erzengel.des.lichtes@gmail.com>
Date: Thu, 4 Jul 2019 14:12:17 -0700
Subject: [PATCH] Added code for splitting shares so they can be less unwieldy
 when the corporation becomes more valuable.

---
 src/pregmod/manageCorporation.tw | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/pregmod/manageCorporation.tw b/src/pregmod/manageCorporation.tw
index 4af979d3a86..042a178beb9 100644
--- a/src/pregmod/manageCorporation.tw
+++ b/src/pregmod/manageCorporation.tw
@@ -1385,6 +1385,22 @@ __Shares__
 		<br>The corporation can buyback some of the public shares. [[Buyback 1000|Manage Corporation][$corpCash -= corpSharePrice(-1000), $publicShares -= 1000]]
 	<</if>>
 <</if>>
+
+/* Splitting shares when they're unwieldy */
+<<set _splitFeeInitial = 10000>>
+<<set _singleSplitInitial = 0.01>>
+<<set _splitFeeValue = _splitFeeInitial - Math.floor((_splitFeeInitial * ($PC.trading / 100.0) / 2.0) / 1000) * 1000>>
+<<set _singleSplitValue = _singleSplitInitial>>
+<<set _singleSplitTotal = _singleSplitValue * $publicShares * $personalShares + _splitFeeValue>>
+    <br>The corporation can split its shares for <<= cashFormat(_singleSplitValue) >> per share and a market fee of <<= cashFormat(_splitFeeValue)>> for a total of <<= cashFormat(_singleSplitTotal)>>. 
+<<if $corpSpecTimer > 0>>
+//The corporation restructured too recently.//
+<<elseif $corpCash > _singleSplitTotal>>
+[[Split Shares|Manage Corporation][$corpCash -= _singleSplitTotal, $publicShares *= 2, $personalShares *= 2, $corpSpecTimer=1]]
+<<else>>
+//The corporation cannot afford the fees.//
+<</if>>
+
 <<if $cash > corpSharePrice(1000)>>
 	<br>The corporation can issue 1000 shares to you. [[Issue 1000|Manage Corporation][cashX(forceNeg(corpSharePrice(1000)), "stocksTraded"), $corpCash += corpSharePrice(1000), $personalShares += 1000]]
 <</if>>
@@ -1408,7 +1424,7 @@ __Slave specialization__
 		<br>Your corporation has one specialization left.
 	<</if>>
 	<<if $corpSpecTimer > 0>>
-		You have recently changed specializations and the corporation needs <<if $corpSpecTimer > 1>>2 more weeks<<else>>another week<</if>> before it can comply with another directive.
+		You have recently changed specializations and the corporation needs <<if $corpSpecTimer > 1>>$corpSpecTimer more weeks<<else>>another week<</if>> before it can comply with another directive.
 	<<else>>
 		<br>Choosing to specialize your corporation uses a specialization. The corporation can be directed to focus on the following:
 		<<if $corpSpecRaces.length == 0 && ($corpDivExtra > 0 || $corpDivLegal > 0)>> /*This used to be $captureUpgradeRace, it is a general acquisition specialization*/
-- 
GitLab