public override void consumeNeeds() { base.consumeNeeds(); if (artisansProduction != null) { PayWithoutRecord(artisansProduction, Cash); // take loan if don't have enough money to buy inputs if (Country.Invented(Invention.Banking) && !artisansProduction.isAllInputProductsCollected() && artisansProduction.Type.getPossibleProfit().isNotZero()) { var needs = artisansProduction.getRealAllNeeds(); if (!artisansProduction.CanAfford(needs)) { var loanSize = World.market.getCost(needs); // takes little more than really need, could be fixed Bank.GiveCredit(this, loanSize); PayWithoutRecord(artisansProduction, Cash); } } artisansProduction.consumeNeeds(); artisansProduction.PayWithoutRecord(this, artisansProduction.Cash); // consuming made in artisansProduction.consumeNeeds() // here is data transferring // todo rework data transferring from artisans? getConsumedInMarket().Add(artisansProduction.getConsumedInMarket()); getConsumed().Add(artisansProduction.getConsumed()); getConsumedLastTurn().Add(artisansProduction.getConsumedLastTurn()); } }
public override void consumeNeeds() { base.consumeNeeds(); if (artisansProduction != null) { payWithoutRecord(artisansProduction, cash); // take loan if don't have enough money to buy inputs if (getCountry().isInvented(Invention.Banking) && !artisansProduction.isAllInputProductsCollected()) { if (artisansProduction.getType().getPossibleProfit().isNotZero()) { var needs = artisansProduction.getRealAllNeeds(); if (!artisansProduction.canAfford(needs)) { var loanSize = Game.market.getCost(needs); // takes little more than really need, could be fixed if (getBank().canGiveMoney(this, loanSize)) { getBank().giveMoney(this, loanSize); } payWithoutRecord(artisansProduction, cash); } } } artisansProduction.consumeNeeds(); artisansProduction.payWithoutRecord(this, artisansProduction.cash); // consuming made in artisansProduction.consumeNeeds() // here is data transfering // todo rework data transfering from artisans? this.getConsumedInMarket().add(artisansProduction.getConsumedInMarket()); this.getConsumed().add(artisansProduction.getConsumed()); this.getConsumedLastTurn().add(artisansProduction.getConsumedLastTurn()); } }