CityBudget: move in the four escrow-style account balances

git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@601 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
jason@long.name 2013-03-23 15:45:52 +00:00
parent 04534d6273
commit 0b8efea513
2 changed files with 35 additions and 14 deletions

View file

@ -11,8 +11,33 @@ package micropolisj.engine;
public class CityBudget
{
private final Micropolis city;
/**
* The amount of cash on hand.
*/
public int totalFunds;
/**
* Amount of taxes collected so far in the current financial
* period (in 1/TAXFREQ's).
*/
int taxFund;
/**
* Amount of prepaid road maintenance (in 1/TAXFREQ's).
*/
int roadFundEscrow;
/**
* Amount of prepaid fire station maintenance (in 1/TAXFREQ's).
*/
int fireFundEscrow;
/**
* Amount of prepaid police station maintenance (in 1/TAXFREQ's).
*/
int policeFundEscrow;
CityBudget(Micropolis city)
{
this.city = city;

View file

@ -178,10 +178,6 @@ public class Micropolis
int policeEffect = 1000;
int fireEffect = 1000;
int taxFund;
int roadFundEscrow;
int fireFundEscrow;
int policeFundEscrow;
int cashFlow; //net change in totalFunds in previous year
boolean newPower;
@ -1686,10 +1682,10 @@ public class Micropolis
BudgetNumbers b = generateBudget();
taxFund += b.taxIncome;
roadFundEscrow -= b.roadFunded;
fireFundEscrow -= b.fireFunded;
policeFundEscrow -= b.policeFunded;
budget.taxFund += b.taxIncome;
budget.roadFundEscrow -= b.roadFunded;
budget.fireFundEscrow -= b.fireFunded;
budget.policeFundEscrow -= b.policeFunded;
taxEffect = b.taxRate;
roadEffect = b.roadRequest != 0 ?
@ -1714,8 +1710,8 @@ public class Micropolis
void collectTax()
{
int revenue = taxFund / TAXFREQ;
int expenses = -(roadFundEscrow + fireFundEscrow + policeFundEscrow) / TAXFREQ;
int revenue = budget.taxFund / TAXFREQ;
int expenses = -(budget.roadFundEscrow + budget.fireFundEscrow + budget.policeFundEscrow) / TAXFREQ;
FinancialHistory hist = new FinancialHistory();
hist.cityTime = cityTime;
@ -1728,10 +1724,10 @@ public class Micropolis
hist.totalFunds = budget.totalFunds;
financialHistory.add(0,hist);
taxFund = 0;
roadFundEscrow = 0;
fireFundEscrow = 0;
policeFundEscrow = 0;
budget.taxFund = 0;
budget.roadFundEscrow = 0;
budget.fireFundEscrow = 0;
budget.policeFundEscrow = 0;
}
/** Annual maintenance cost of each police station. */