internal void markToDestroy() { toRemove = true; //return loans only if banking invented if (Country.Invented(Invention.Banking)) { if (loans.isNotZero()) { Value howMuchToReturn = loans.Copy(); if (howMuchToReturn.isSmallerOrEqual(Cash)) { howMuchToReturn.Set(Cash); } Bank.ReceiveMoney(this, howMuchToReturn); if (loans.isNotZero()) { Bank.OnLoanerRefusesToPay(this); } } } // send remaining money to owners foreach (var item in ownership.GetAllShares()) { Pay(item.Key as Agent, Cash.Copy().Multiply(item.Value), false); //pay(item.Key as Agent, item.Value.SendProcentOf(Cash), false); } MainCamera.factoryPanel.removeFactory(this); }
/// <summary> /// How much can /// Checks reserve limits. /// new value /// </summary> public MoneyView HowBigCreditCanGive(Agent whom) { MoneyView maxSum = Cash.Copy().Subtract(GetMinimalReservs(), false); // don't take in account banks deposits //if (whom.deposits.isBiggerThan(maxSum)) //{ // maxSum = whom.deposits.Copy(); // sets maxSum to deposits size // if (maxSum.isBiggerThan(Cash)) //decrease maxSum to Cash size // maxSum.Set(Cash); //} return(maxSum); }
/// <summary> /// How much can /// Checks reserve limits. /// </summary> internal ReadOnlyValue HowBigCreditCanGive(Agent whom) { Value maxSum = Cash.Copy().Subtract(GetMinimalReservs(), false); //if (whom.deposits.isBiggerThan(maxSum)) //{ // maxSum = whom.deposits.Copy(); // sets maxSum to deposits size // if (maxSum.isBiggerThan(Cash)) //decrease maxSum to Cash size // maxSum.Set(Cash); //} return(maxSum); }
/// <summary> /// includes checks for Cash and deposit. Returns copy /// </summary> internal ReadOnlyValue HowMuchDepositCanReturn(Agent agent) { var howMuchReturn = agent.deposits.Copy(); //initialization var wantedResrve = Cash.Copy().Subtract(GetMinimalReservs(), false); //defaults to zero if there is no money to give if (howMuchReturn.isBiggerThan(wantedResrve)) { howMuchReturn.Set(wantedResrve); } return(howMuchReturn); }
/// <summary> /// includes checks for Cash and deposit. Returns copy /// </summary> public MoneyView HowMuchDepositCanReturn(Agent agent) { var howMuchReturn = agent.deposits.Copy(); //initialization var wantedResrve = Cash.Copy().Subtract(GetMinimalReservs(), false); //defaults to zero if there is no money to give // doesn't account bank's deposits if (howMuchReturn.isBiggerThan(wantedResrve)) { howMuchReturn.Set(wantedResrve); } return(howMuchReturn); }