Codechange: migrate all game-time-related timers to the new framework

This commit is contained in:
Patric Stout
2023-04-13 13:56:00 +02:00
committed by Patric Stout
parent 1ba4dcc924
commit 3ebc7ad16e
25 changed files with 166 additions and 145 deletions

View File

@@ -86,4 +86,15 @@ void TimerManager<TimerGameCalendar>::Elapsed(TimerGameCalendar::TElapsed delta)
timer->Elapsed(TimerGameCalendar::YEAR);
}
}
/* check if we reached the maximum year, decrement dates by a year */
if (_cur_year == MAX_YEAR + 1) {
int days_this_year;
_cur_year--;
days_this_year = IsLeapYear(_cur_year) ? DAYS_IN_LEAP_YEAR : DAYS_IN_YEAR;
_date -= days_this_year;
for (Vehicle *v : Vehicle::Iterate()) v->ShiftDates(-days_this_year);
for (LinkGraph *lg : LinkGraph::Iterate()) lg->ShiftDates(-days_this_year);
}
}