Codechange: use Date/Year constructor explicitly
This commit is contained in:
@@ -70,7 +70,7 @@ TimerGameEconomy::DateFract TimerGameEconomy::date_fract = {};
|
||||
|
||||
/* If we're using wallclock units, economy months have 30 days and an economy year has 360 days. */
|
||||
const int total_months = (year.base() * EconomyTime::MONTHS_IN_YEAR) + month;
|
||||
return (total_months * EconomyTime::DAYS_IN_ECONOMY_MONTH) + day - 1; // Day is 1-indexed but Date is 0-indexed, hence the - 1.
|
||||
return TimerGameEconomy::Date{(total_months * EconomyTime::DAYS_IN_ECONOMY_MONTH) + day - 1}; // Day is 1-indexed but Date is 0-indexed, hence the - 1.
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -179,13 +179,11 @@ bool TimerManager<TimerGameEconomy>::Elapsed([[maybe_unused]] TimerGameEconomy::
|
||||
|
||||
/* check if we reached the maximum year, decrement dates by a year */
|
||||
if (TimerGameEconomy::year == EconomyTime::MAX_YEAR + 1) {
|
||||
int days_this_year;
|
||||
|
||||
TimerGameEconomy::year--;
|
||||
days_this_year = TimerGameEconomy::IsLeapYear(TimerGameEconomy::year) ? EconomyTime::DAYS_IN_LEAP_YEAR : EconomyTime::DAYS_IN_YEAR;
|
||||
TimerGameEconomy::date -= days_this_year;
|
||||
for (Vehicle *v : Vehicle::Iterate()) v->ShiftDates(-days_this_year);
|
||||
for (LinkGraph *lg : LinkGraph::Iterate()) lg->ShiftDates(-days_this_year);
|
||||
int days_this_year = TimerGameEconomy::IsLeapYear(TimerGameEconomy::year) ? EconomyTime::DAYS_IN_LEAP_YEAR : EconomyTime::DAYS_IN_YEAR;
|
||||
TimerGameEconomy::date -= TimerGameEconomy::Date{days_this_year};
|
||||
for (Vehicle *v : Vehicle::Iterate()) v->ShiftDates(TimerGameEconomy::Date{-days_this_year});
|
||||
for (LinkGraph *lg : LinkGraph::Iterate()) lg->ShiftDates(TimerGameEconomy::Date{-days_this_year});
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user