Codechange: Remove min/max functions in favour of STL variants (#8502)

This commit is contained in:
Charles Pigott
2021-01-08 10:16:18 +00:00
committed by GitHub
parent c1fddb9a6a
commit 9b800a96ed
181 changed files with 900 additions and 954 deletions

View File

@@ -578,7 +578,7 @@ static void CalcEngineReliability(Engine *e)
/* Check for early retirement */
if (e->company_avail != 0 && !_settings_game.vehicle.never_expire_vehicles && e->info.base_life != 0xFF) {
int retire_early = e->info.retire_early;
uint retire_early_max_age = max(0, e->duration_phase_1 + e->duration_phase_2 - retire_early * 12);
uint retire_early_max_age = std::max(0, e->duration_phase_1 + e->duration_phase_2 - retire_early * 12);
if (retire_early != 0 && age >= retire_early_max_age) {
/* Early retirement is enabled and we're past the date... */
e->company_avail = 0;
@@ -625,7 +625,7 @@ void SetYearEngineAgingStops()
YearMonthDay ymd;
ConvertDateToYMD(ei->base_intro + (ei->lifelength * DAYS_IN_LEAP_YEAR) / 2, &ymd);
_year_engine_aging_stops = max(_year_engine_aging_stops, ymd.year);
_year_engine_aging_stops = std::max(_year_engine_aging_stops, ymd.year);
}
}
@@ -693,7 +693,7 @@ void StartupOneEngine(Engine *e, Date aging_date)
void StartupEngines()
{
/* Aging of vehicles stops, so account for that when starting late */
const Date aging_date = min(_date, ConvertYMDToDate(_year_engine_aging_stops, 0, 1));
const Date aging_date = std::min(_date, ConvertYMDToDate(_year_engine_aging_stops, 0, 1));
for (Engine *e : Engine::Iterate()) {
StartupOneEngine(e, aging_date);
@@ -1196,7 +1196,7 @@ void CheckEngines()
if ((e->flags & ENGINE_AVAILABLE) != 0 && e->company_avail != 0) return;
/* Okay, try to find the earliest date. */
min_date = min(min_date, e->info.base_intro);
min_date = std::min(min_date, e->info.base_intro);
}
if (min_date < INT32_MAX) {