diff --git a/src/Corporation/corporate.js b/src/Corporation/corporate.js index 7b3ddf515b6ef891ec6bd621ab2a2cabf35c8989..9a8b10438e6e6f7918885a7a63d49d0faf0d0699 100644 --- a/src/Corporation/corporate.js +++ b/src/Corporation/corporate.js @@ -654,6 +654,7 @@ App.Corporate.Init = function() { }; App.Corporate.chargeAsset = function(cost, type) { if(!Number.isFinite(cost)) throw "The cost provided was not a real number"; + cost = Math.trunc(cost); if(!(type in this.ledger.current)) throw `Ledger doesn't record '${type}' category.`; if(cost == 0) return; @@ -661,7 +662,8 @@ App.Corporate.Init = function() { this.cash -= cost; }; App.Corporate.earnRevenue = function(cost, locality) { - if(!Number.isFinite(cost)) throw "The cost provided was not real" + if(!Number.isFinite(cost)) throw "The cost provided was not real"; + cost = Math.trunc(cost); let current = this.ledger.current; let key = `${locality}Revenue`; if(!(key in current)) throw `Unknown locality '${locality}'`; @@ -669,6 +671,8 @@ App.Corporate.Init = function() { this.cash += cost; }; App.Corporate.chargeDividend = function(cost, weekLedger) { + if(!Number.isFinite(cost)) throw "The cost provided was not real"; + cost = Math.trunc(cost); if(weekLedger == null) { debugger; throw "No weekLedger provided";