mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Use economy dates for economy statistics and interest payments
parent
8601dd5a4f
commit
ee5868f4b4
|
@ -691,8 +691,8 @@ static void CompaniesGenStatistics()
|
||||||
}
|
}
|
||||||
cur_company.Restore();
|
cur_company.Restore();
|
||||||
|
|
||||||
/* Only run the economic statics and update company stats every 3rd month (1st of quarter). */
|
/* Only run the economic statics and update company stats every 3rd economy month (1st of quarter). */
|
||||||
if (!HasBit(1 << 0 | 1 << 3 | 1 << 6 | 1 << 9, TimerGameCalendar::month)) return;
|
if (!HasBit(1 << 0 | 1 << 3 | 1 << 6 | 1 << 9, TimerGameEconomy::month)) return;
|
||||||
|
|
||||||
for (Company *c : Company::Iterate()) {
|
for (Company *c : Company::Iterate()) {
|
||||||
/* Drop the oldest history off the end */
|
/* Drop the oldest history off the end */
|
||||||
|
@ -845,8 +845,8 @@ static void CompaniesPayInterest()
|
||||||
if (c->money < 0) {
|
if (c->money < 0) {
|
||||||
yearly_fee += -c->money *_economy.interest_rate / 100;
|
yearly_fee += -c->money *_economy.interest_rate / 100;
|
||||||
}
|
}
|
||||||
Money up_to_previous_month = yearly_fee * TimerGameCalendar::month / 12;
|
Money up_to_previous_month = yearly_fee * TimerGameEconomy::month / 12;
|
||||||
Money up_to_this_month = yearly_fee * (TimerGameCalendar::month + 1) / 12;
|
Money up_to_this_month = yearly_fee * (TimerGameEconomy::month + 1) / 12;
|
||||||
|
|
||||||
SubtractMoneyFromCompany(CommandCost(EXPENSES_LOAN_INTEREST, up_to_this_month - up_to_previous_month));
|
SubtractMoneyFromCompany(CommandCost(EXPENSES_LOAN_INTEREST, up_to_this_month - up_to_previous_month));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue