Changeset - r28341:d278e4273108
[Not reviewed]
master
0 1 0
Peter Nelson - 11 months ago 2023-12-28 18:08:39
peter1138@openttd.org
Fix: Prevent underflow if engine base life is less than 8 years.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/engine.cpp
Show inline comments
 
@@ -724,7 +724,7 @@ void StartupOneEngine(Engine *e, TimerGa
 
	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);
0 comments (0 inline, 0 general)