mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-31 11:23:21 +00:00
Fix: Prevent underflow if engine base life is less than 8 years.
This commit is contained in:
parent
ead5ad119c
commit
7b2c143df0
@ -724,7 +724,7 @@ void StartupOneEngine(Engine *e, TimerGameCalendar::Date aging_date, uint32_t se
|
|||||||
r = Random();
|
r = Random();
|
||||||
e->reliability_final = GB(r, 16, 14) + 0x3FFF;
|
e->reliability_final = GB(r, 16, 14) + 0x3FFF;
|
||||||
e->duration_phase_1 = GB(r, 0, 5) + 7;
|
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;
|
e->duration_phase_3 = GB(r, 9, 7) + 120;
|
||||||
|
|
||||||
RestoreRandomSeeds(saved_seeds);
|
RestoreRandomSeeds(saved_seeds);
|
||||||
|
Loading…
Reference in New Issue
Block a user