Fixed Corporation bugs with Product Sell Amt being negative and NSA Bladeburner button bug

This commit is contained in:
danielyxie 2018-11-29 01:16:19 -08:00
parent 9c5af1d3a7
commit 2f716b5b23
3 changed files with 6 additions and 3 deletions

File diff suppressed because one or more lines are too long

@ -1521,6 +1521,7 @@ Industry.prototype.processProduct = function(marketCycles=1, product, corporatio
//Backwards compatibility, -1 = 0 //Backwards compatibility, -1 = 0
sellAmt = maxSell; sellAmt = maxSell;
} }
if (sellAmt < 0) { sellAmt = 0; }
sellAmt = sellAmt * SecsPerMarketCycle * marketCycles; sellAmt = sellAmt * SecsPerMarketCycle * marketCycles;
sellAmt = Math.min(product.data[city][0], sellAmt); //data[0] is qty sellAmt = Math.min(product.data[city][0], sellAmt); //data[0] is qty
if (sellAmt && sCost) { if (sellAmt && sCost) {
@ -3097,6 +3098,8 @@ Corporation.prototype.process = function() {
this.revenue = new Decimal(0); this.revenue = new Decimal(0);
this.expenses = new Decimal(0); this.expenses = new Decimal(0);
this.divisions.forEach((ind) => { this.divisions.forEach((ind) => {
if (ind.lastCycleRevenue === -Infinity || ind.lastCycleRevenue === Infinity) { return; }
if (ind.lastCycleExpenses === -Infinity || ind.lastCycleExpenses === Infinity) { return; }
this.revenue = this.revenue.plus(ind.lastCycleRevenue); this.revenue = this.revenue.plus(ind.lastCycleRevenue);
this.expenses = this.expenses.plus(ind.lastCycleExpenses); this.expenses = this.expenses.plus(ind.lastCycleExpenses);
}); });

@ -113,7 +113,7 @@ function displayLocationContent() {
var cityHallCreateCorporation = document.getElementById("location-cityhall-create-corporation"); var cityHallCreateCorporation = document.getElementById("location-cityhall-create-corporation");
var nsaBladeburner = clearEventListeners("location-nsa-bladeburner"); var nsaBladeburner = document.getElementById("location-nsa-bladeburner");
var loc = Player.location; var loc = Player.location;