Fix: Prevent underflow if engine base life is less than 8 years.

wip-string
Peter Nelson 5 months ago committed by Peter Nelson
parent ead5ad119c
commit 7b2c143df0

@ -724,7 +724,7 @@ void StartupOneEngine(Engine *e, TimerGameCalendar::Date aging_date, uint32_t se
r = Random();
e->reliability_final = GB(r, 16, 14) + 0x3FFF;
e->duration_phase_1 = GB(r, 0, 5) + 7;
e->duration_phase_2 = GB(r, 5, 4) + ei->base_life.base() * 12 - 96;
e->duration_phase_2 = std::max(0, int(GB(r, 5, 4)) + ei->base_life.base() * 12 - 96);
e->duration_phase_3 = GB(r, 9, 7) + 120;
RestoreRandomSeeds(saved_seeds);

Loading…
Cancel
Save