Remove redundant year/month date globals

This commit is contained in:
Jonathan G Rennison
2020-07-07 17:53:54 +01:00
parent c7f6a711b3
commit 53f9fa139d
9 changed files with 26 additions and 30 deletions

View File

@@ -720,7 +720,7 @@ static void CompaniesGenStatistics()
cur_company.Restore();
/* Only run the economic statics and update company stats every 3rd month (1st of quarter). */
if (!HasBit(1 << 0 | 1 << 3 | 1 << 6 | 1 << 9, _cur_month)) return;
if (!HasBit(1 << 0 | 1 << 3 | 1 << 6 | 1 << 9, _cur_date_ymd.month)) return;
for (Company *c : Company::Iterate()) {
/* Drop the oldest history off the end */
@@ -874,8 +874,8 @@ static void CompaniesPayInterest()
if (c->money < 0) {
yearly_fee += -c->money *_economy.interest_rate / 100;
}
Money up_to_previous_month = yearly_fee * _cur_month / 12;
Money up_to_this_month = yearly_fee * (_cur_month + 1) / 12;
Money up_to_previous_month = yearly_fee * _cur_date_ymd.month / 12;
Money up_to_this_month = yearly_fee * (_cur_date_ymd.month + 1) / 12;
SubtractMoneyFromCompany(CommandCost(EXPENSES_LOAN_INT, up_to_this_month - up_to_previous_month));