Codechange: Replace vehicle related FOR_ALL with range-based for loops

This commit is contained in:
glx
2019-12-17 03:37:43 +01:00
committed by Niels Martin Hansen
parent 9892d90b26
commit d8a1be48cd
39 changed files with 155 additions and 317 deletions

View File

@@ -202,14 +202,12 @@ static void OnNewYear()
ShowEndGameChart();
/* check if we reached the maximum year, decrement dates by a year */
} else if (_cur_year == MAX_YEAR + 1) {
Vehicle *v;
int days_this_year;
_cur_year--;
days_this_year = IsLeapYear(_cur_year) ? DAYS_IN_LEAP_YEAR : DAYS_IN_YEAR;
_date -= days_this_year;
FOR_ALL_VEHICLES(v) v->date_of_last_service -= days_this_year;
for (Vehicle *v : Vehicle::Iterate()) v->date_of_last_service -= days_this_year;
for (LinkGraph *lg : LinkGraph::Iterate()) lg->ShiftDates(-days_this_year);
/* Because the _date wraps here, and text-messages expire by game-days, we have to clean out