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:
parent
04534d6273
commit
0b8efea513
2 changed files with 35 additions and 14 deletions
|
@ -11,8 +11,33 @@ package micropolisj.engine;
|
||||||
public class CityBudget
|
public class CityBudget
|
||||||
{
|
{
|
||||||
private final Micropolis city;
|
private final Micropolis city;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of cash on hand.
|
||||||
|
*/
|
||||||
public int totalFunds;
|
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)
|
CityBudget(Micropolis city)
|
||||||
{
|
{
|
||||||
this.city = city;
|
this.city = city;
|
||||||
|
|
|
@ -178,10 +178,6 @@ public class Micropolis
|
||||||
int policeEffect = 1000;
|
int policeEffect = 1000;
|
||||||
int fireEffect = 1000;
|
int fireEffect = 1000;
|
||||||
|
|
||||||
int taxFund;
|
|
||||||
int roadFundEscrow;
|
|
||||||
int fireFundEscrow;
|
|
||||||
int policeFundEscrow;
|
|
||||||
int cashFlow; //net change in totalFunds in previous year
|
int cashFlow; //net change in totalFunds in previous year
|
||||||
|
|
||||||
boolean newPower;
|
boolean newPower;
|
||||||
|
@ -1686,10 +1682,10 @@ public class Micropolis
|
||||||
|
|
||||||
BudgetNumbers b = generateBudget();
|
BudgetNumbers b = generateBudget();
|
||||||
|
|
||||||
taxFund += b.taxIncome;
|
budget.taxFund += b.taxIncome;
|
||||||
roadFundEscrow -= b.roadFunded;
|
budget.roadFundEscrow -= b.roadFunded;
|
||||||
fireFundEscrow -= b.fireFunded;
|
budget.fireFundEscrow -= b.fireFunded;
|
||||||
policeFundEscrow -= b.policeFunded;
|
budget.policeFundEscrow -= b.policeFunded;
|
||||||
|
|
||||||
taxEffect = b.taxRate;
|
taxEffect = b.taxRate;
|
||||||
roadEffect = b.roadRequest != 0 ?
|
roadEffect = b.roadRequest != 0 ?
|
||||||
|
@ -1714,8 +1710,8 @@ public class Micropolis
|
||||||
|
|
||||||
void collectTax()
|
void collectTax()
|
||||||
{
|
{
|
||||||
int revenue = taxFund / TAXFREQ;
|
int revenue = budget.taxFund / TAXFREQ;
|
||||||
int expenses = -(roadFundEscrow + fireFundEscrow + policeFundEscrow) / TAXFREQ;
|
int expenses = -(budget.roadFundEscrow + budget.fireFundEscrow + budget.policeFundEscrow) / TAXFREQ;
|
||||||
|
|
||||||
FinancialHistory hist = new FinancialHistory();
|
FinancialHistory hist = new FinancialHistory();
|
||||||
hist.cityTime = cityTime;
|
hist.cityTime = cityTime;
|
||||||
|
@ -1728,10 +1724,10 @@ public class Micropolis
|
||||||
hist.totalFunds = budget.totalFunds;
|
hist.totalFunds = budget.totalFunds;
|
||||||
financialHistory.add(0,hist);
|
financialHistory.add(0,hist);
|
||||||
|
|
||||||
taxFund = 0;
|
budget.taxFund = 0;
|
||||||
roadFundEscrow = 0;
|
budget.roadFundEscrow = 0;
|
||||||
fireFundEscrow = 0;
|
budget.fireFundEscrow = 0;
|
||||||
policeFundEscrow = 0;
|
budget.policeFundEscrow = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Annual maintenance cost of each police station. */
|
/** Annual maintenance cost of each police station. */
|
||||||
|
|
Reference in a new issue