From 20779aac33d7e01759d4506a42549beb8f956158 Mon Sep 17 00:00:00 2001 From: GinjaNinja32 Date: Mon, 24 Nov 2014 18:11:09 +0000 Subject: [PATCH 1/2] Fix ultra-rich people crashing the server --- code/modules/economy/cash.dm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/modules/economy/cash.dm b/code/modules/economy/cash.dm index 3b8a2fe0bf1..e996a6c7082 100644 --- a/code/modules/economy/cash.dm +++ b/code/modules/economy/cash.dm @@ -67,9 +67,11 @@ /obj/item/weapon/spacecash/bundle/update_icon() overlays.Cut() var/sum = src.worth + var/num = 0 for(var/i in list(1000,500,200,100,50,20,10,1)) - while(sum >= i) + while(sum >= i && num < 50) sum -= i + num++ var/image/banknote = image('icons/obj/items.dmi', "spacecash[i]") var/matrix/M = matrix() M.Translate(rand(-6, 6), rand(-4, 8)) From a543d557b931f2b6c75c436701d8b42c833f6fcf Mon Sep 17 00:00:00 2001 From: GinjaNinja32 Date: Mon, 24 Nov 2014 18:56:41 +0000 Subject: [PATCH 2/2] Fix sub-1 thaler piles being invisible, disallow subdivision below 0.01 --- code/modules/economy/ATM.dm | 3 +++ code/modules/economy/cash.dm | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/code/modules/economy/ATM.dm b/code/modules/economy/ATM.dm index 05828ed7dd7..1274abff64c 100644 --- a/code/modules/economy/ATM.dm +++ b/code/modules/economy/ATM.dm @@ -217,6 +217,7 @@ log transactions if("transfer") if(authenticated_account) var/transfer_amount = text2num(href_list["funds_amount"]) + transfer_amount = round(transfer_amount, 0.01) if(transfer_amount <= 0) alert("That is not a valid amount.") else if(transfer_amount <= authenticated_account.money) @@ -302,6 +303,7 @@ log transactions previous_account_number = tried_account_num if("e_withdrawal") var/amount = max(text2num(href_list["funds_amount"]),0) + amount = round(amount, 0.01) if(amount <= 0) alert("That is not a valid amount.") else if(authenticated_account && amount > 0) @@ -327,6 +329,7 @@ log transactions usr << "\icon[src]You don't have enough funds to do that!" if("withdrawal") var/amount = max(text2num(href_list["funds_amount"]),0) + amount = round(amount, 0.01) if(amount <= 0) alert("That is not a valid amount.") else if(authenticated_account && amount > 0) diff --git a/code/modules/economy/cash.dm b/code/modules/economy/cash.dm index e996a6c7082..862708742cd 100644 --- a/code/modules/economy/cash.dm +++ b/code/modules/economy/cash.dm @@ -78,6 +78,13 @@ M.Turn(pick(-45, -27.5, 0, 0, 0, 0, 0, 0, 0, 27.5, 45)) banknote.transform = M src.overlays += banknote + if(num == 0) // Less than one thaler, let's just make it look like 1 for ease + var/image/banknote = image('icons/obj/items.dmi', "spacecash1") + var/matrix/M = matrix() + M.Translate(rand(-6, 6), rand(-4, 8)) + M.Turn(pick(-45, -27.5, 0, 0, 0, 0, 0, 0, 0, 27.5, 45)) + banknote.transform = M + src.overlays += banknote src.desc = "They are worth [worth] Thalers." /obj/item/weapon/spacecash/bundle/attack_self()